Add a repository to an app installation

Add a single repository to an installation. The authenticated user must have admin access to the repository.

You must use a personal access token (which you can create via the command line or Basic Authentication) to access this endpoint.

octokit.apps.addRepoToInstallation({
installation_id,
repository_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

repository_idyes

See also: GitHub Developer Guide documentation.

Check a token

OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use Basic Authentication to use this endpoint, where the username is the OAuth application client_id and the password is its client_secret. Invalid tokens will return 404 NOT FOUND.

octokit.apps.checkToken({
client_id,
access_token,
});

Parameters

namerequireddescription
client_idyes

The client ID of your GitHub app.

access_tokenyes

The access_token of the OAuth application.

See also: GitHub Developer Guide documentation.

Create a content attachment

Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the id of the content reference from the content_reference event to create an attachment.

The app must create a content attachment within six hours of the content reference URL being posted. See "Using content attachments" for details about content attachments.

You must use an installation access token to access this endpoint.

octokit.apps.createContentAttachment({
content_reference_id,
title,
body,
});

Parameters

namerequireddescription
content_reference_idyes
titleyes

The title of the attachment

bodyyes

The body of the attachment

See also: GitHub Developer Guide documentation.

Create a GitHub App from a manifest

Use this endpoint to complete the handshake necessary when implementing the GitHub App Manifest flow. When you create a GitHub App with the manifest flow, you receive a temporary code used to retrieve the GitHub App's id, pem (private key), and webhook_secret.

octokit.apps.createFromManifest({
code,
});

Parameters

namerequireddescription
codeyes

See also: GitHub Developer Guide documentation.

Create an installation access token for an app

Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of 401 - Unauthorized, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the repository_ids when creating the token. When you omit repository_ids, the response does not contain the repositories key.

You must use a JWT to access this endpoint.

octokit.apps.createInstallationAccessToken({
installation_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

repositoriesno

List of repository names that the token should have access to

repository_idsno

List of repository IDs that the token should have access to

permissionsno

The permissions granted to the user-to-server access token.

permissions.actionsno

The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: read or write.

permissions.administrationno

The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be one of: read or write.

permissions.checksno

The level of permission to grant the access token for checks on code. Can be one of: read or write.

permissions.content_referencesno

The level of permission to grant the access token for notification of content references and creation content attachments. Can be one of: read or write.

permissions.contentsno

The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be one of: read or write.

permissions.deploymentsno

The level of permission to grant the access token for deployments and deployment statuses. Can be one of: read or write.

permissions.environmentsno

The level of permission to grant the access token for managing repository environments. Can be one of: read or write.

permissions.issuesno

The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be one of: read or write.

permissions.metadatano

The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be one of: read or write.

permissions.packagesno

The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: read or write.

permissions.pagesno

The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be one of: read or write.

permissions.pull_requestsno

The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be one of: read or write.

permissions.repository_hooksno

The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be one of: read or write.

permissions.repository_projectsno

The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: read, write, or admin.

permissions.secret_scanning_alertsno

The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: read or write.

permissions.secretsno

The level of permission to grant the access token to manage repository secrets. Can be one of: read or write.

permissions.security_eventsno

The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be one of: read or write.

permissions.single_fileno

The level of permission to grant the access token to manage just a single file. Can be one of: read or write.

permissions.statusesno

The level of permission to grant the access token for commit statuses. Can be one of: read or write.

permissions.vulnerability_alertsno

The level of permission to grant the access token to retrieve Dependabot alerts. Can be one of: read.

permissions.workflowsno

The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: write.

permissions.membersno

The level of permission to grant the access token for organization teams and members. Can be one of: read or write.

permissions.organization_administrationno

The level of permission to grant the access token to manage access to an organization. Can be one of: read or write.

permissions.organization_hooksno

The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be one of: read or write.

permissions.organization_planno

The level of permission to grant the access token for viewing an organization's plan. Can be one of: read.

permissions.organization_projectsno

The level of permission to grant the access token to manage organization projects, columns, and cards. Can be one of: read, write, or admin.

permissions.organization_secretsno

The level of permission to grant the access token to manage organization secrets. Can be one of: read or write.

permissions.organization_self_hosted_runnersno

The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be one of: read or write.

permissions.organization_user_blockingno

The level of permission to grant the access token to view and manage users blocked by the organization. Can be one of: read or write.

permissions.team_discussionsno

The level of permission to grant the access token to manage team discussions and related comments. Can be one of: read or write.

See also: GitHub Developer Guide documentation.

Delete an app authorization

OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. You must also provide a valid OAuth access_token as an input parameter and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on the application authorizations settings screen within GitHub.

octokit.apps.deleteAuthorization({
client_id,
});

Parameters

namerequireddescription
client_idyes

The client ID of your GitHub app.

access_tokenno

The OAuth access token used to authenticate to the GitHub API.

See also: GitHub Developer Guide documentation.

Delete an installation for the authenticated app

Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the "Suspend an app installation" endpoint.

You must use a JWT to access this endpoint.

octokit.apps.deleteInstallation({
installation_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

See also: GitHub Developer Guide documentation.

Delete an app token

OAuth application owners can revoke a single token for an OAuth application. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password.

octokit.apps.deleteToken({
client_id,
});

Parameters

namerequireddescription
client_idyes

The client ID of your GitHub app.

access_tokenno

The OAuth access token used to authenticate to the GitHub API.

See also: GitHub Developer Guide documentation.

Get the authenticated app

Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the installations_count in the response. For more details about your app's installations, see the "List installations for the authenticated app" endpoint.

You must use a JWT to access this endpoint.

octokit.apps.getAuthenticated();

Parameters

This endpoint has no parameters

See also: GitHub Developer Guide documentation.

Get an app

Note: The :app_slug is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., https://github.com/settings/apps/:app_slug).

If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a personal access token or an installation access token to access this endpoint.

octokit.apps.getBySlug({
app_slug,
});

Parameters

namerequireddescription
app_slugyes

See also: GitHub Developer Guide documentation.

Get an installation for the authenticated app

Enables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (target_type) will be either an organization or a user account, depending which account the repository belongs to.

You must use a JWT to access this endpoint.

octokit.apps.getInstallation({
installation_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

See also: GitHub Developer Guide documentation.

Get an organization installation for the authenticated app

Enables an authenticated GitHub App to find the organization's installation information.

You must use a JWT to access this endpoint.

octokit.apps.getOrgInstallation({
org,
});

Parameters

namerequireddescription
orgyes

See also: GitHub Developer Guide documentation.

Get a repository installation for the authenticated app

Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to.

You must use a JWT to access this endpoint.

octokit.apps.getRepoInstallation({
owner,
repo,
});

Parameters

namerequireddescription
owneryes
repoyes

See also: GitHub Developer Guide documentation.

Get a subscription plan for an account

Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.

GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.

octokit.apps.getSubscriptionPlanForAccount({
account_id,
});

Parameters

namerequireddescription
account_idyes

account_id parameter

See also: GitHub Developer Guide documentation.

Get a subscription plan for an account (stubbed)

Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.

GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.

octokit.apps.getSubscriptionPlanForAccountStubbed({
account_id,
});

Parameters

namerequireddescription
account_idyes

account_id parameter

See also: GitHub Developer Guide documentation.

Get a user installation for the authenticated app

Enables an authenticated GitHub App to find the user’s installation information.

You must use a JWT to access this endpoint.

octokit.apps.getUserInstallation({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

Get a webhook configuration for an app

Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "Creating a GitHub App."

You must use a JWT to access this endpoint.

octokit.apps.getWebhookConfigForApp();

Parameters

This endpoint has no parameters

See also: GitHub Developer Guide documentation.

List accounts for a plan

Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.

GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.

octokit.apps.listAccountsForPlan({
plan_id,
});

Parameters

namerequireddescription
plan_idyes

plan_id parameter

sortno

One of created (when the repository was starred) or updated (when it was last pushed to).

directionno

To return the oldest accounts first, set to asc. Can be one of asc or desc. Ignored without the sort parameter.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List accounts for a plan (stubbed)

Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.

GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.

octokit.apps.listAccountsForPlanStubbed({
plan_id,
});

Parameters

namerequireddescription
plan_idyes

plan_id parameter

sortno

One of created (when the repository was starred) or updated (when it was last pushed to).

directionno

To return the oldest accounts first, set to asc. Can be one of asc or desc. Ignored without the sort parameter.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List repositories accessible to the user access token

List repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access for an installation.

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint.

The access the user has to each repository is included in the hash under the permissions key.

octokit.apps.listInstallationReposForAuthenticatedUser({
installation_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List installations for the authenticated app

You must use a JWT to access this endpoint.

The permissions the installation has are included under the permissions key.

octokit.apps.listInstallations();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

sinceno

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

outdatedno

See also: GitHub Developer Guide documentation.

List app installations accessible to the user access token

Lists installations of your GitHub App that the authenticated user has explicit permission (:read, :write, or :admin) to access.

You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint.

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

You can find the permissions for the installation under the permissions key.

octokit.apps.listInstallationsForAuthenticatedUser();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List plans

Lists all plans that are part of your GitHub Marketplace listing.

GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.

octokit.apps.listPlans();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List plans (stubbed)

Lists all plans that are part of your GitHub Marketplace listing.

GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.

octokit.apps.listPlansStubbed();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List repositories accessible to the app installation

List repositories that an app installation can access.

You must use an installation access token to access this endpoint.

octokit.apps.listReposAccessibleToInstallation();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List subscriptions for the authenticated user

Lists the active subscriptions for the authenticated user. You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an OAuth token.

octokit.apps.listSubscriptionsForAuthenticatedUser();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List subscriptions for the authenticated user (stubbed)

Lists the active subscriptions for the authenticated user. You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an OAuth token.

octokit.apps.listSubscriptionsForAuthenticatedUserStubbed();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

Remove a repository from an app installation

Remove a single repository from an installation. The authenticated user must have admin access to the repository.

You must use a personal access token (which you can create via the command line or Basic Authentication) to access this endpoint.

octokit.apps.removeRepoFromInstallation({
installation_id,
repository_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

repository_idyes

See also: GitHub Developer Guide documentation.

Reset a token

OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. Invalid tokens will return 404 NOT FOUND.

octokit.apps.resetToken({
client_id,
access_token,
});

Parameters

namerequireddescription
client_idyes

The client ID of your GitHub app.

access_tokenyes

The access_token of the OAuth application.

See also: GitHub Developer Guide documentation.

Revoke an installation access token

Revokes the installation token you're using to authenticate as an installation and access this endpoint.

Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "Create an installation access token for an app" endpoint.

You must use an installation access token to access this endpoint.

octokit.apps.revokeInstallationAccessToken();

Parameters

This endpoint has no parameters

See also: GitHub Developer Guide documentation.

Create a scoped access token

Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. Invalid tokens will return 404 NOT FOUND.

octokit.apps.scopeToken({
client_id,
});

Parameters

namerequireddescription
client_idyes

The client ID of your GitHub app.

access_tokenno

Required. The OAuth access token used to authenticate to the GitHub API.

targetno

The name of the user or organization to scope the user-to-server access token to. Required unless target_id is specified.

target_idno

The ID of the user or organization to scope the user-to-server access token to. Required unless target is specified.

repositoriesno

The list of repository IDs to scope the user-to-server access token to. repositories may not be specified if repository_ids is specified.

repository_idsno

The list of repository names to scope the user-to-server access token to. repository_ids may not be specified if repositories is specified.

permissionsno

The permissions granted to the user-to-server access token.

permissions.actionsno

The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: read or write.

permissions.administrationno

The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be one of: read or write.

permissions.checksno

The level of permission to grant the access token for checks on code. Can be one of: read or write.

permissions.content_referencesno

The level of permission to grant the access token for notification of content references and creation content attachments. Can be one of: read or write.

permissions.contentsno

The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be one of: read or write.

permissions.deploymentsno

The level of permission to grant the access token for deployments and deployment statuses. Can be one of: read or write.

permissions.environmentsno

The level of permission to grant the access token for managing repository environments. Can be one of: read or write.

permissions.issuesno

The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be one of: read or write.

permissions.metadatano

The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be one of: read or write.

permissions.packagesno

The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: read or write.

permissions.pagesno

The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be one of: read or write.

permissions.pull_requestsno

The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be one of: read or write.

permissions.repository_hooksno

The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be one of: read or write.

permissions.repository_projectsno

The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: read, write, or admin.

permissions.secret_scanning_alertsno

The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: read or write.

permissions.secretsno

The level of permission to grant the access token to manage repository secrets. Can be one of: read or write.

permissions.security_eventsno

The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be one of: read or write.

permissions.single_fileno

The level of permission to grant the access token to manage just a single file. Can be one of: read or write.

permissions.statusesno

The level of permission to grant the access token for commit statuses. Can be one of: read or write.

permissions.vulnerability_alertsno

The level of permission to grant the access token to retrieve Dependabot alerts. Can be one of: read.

permissions.workflowsno

The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: write.

permissions.membersno

The level of permission to grant the access token for organization teams and members. Can be one of: read or write.

permissions.organization_administrationno

The level of permission to grant the access token to manage access to an organization. Can be one of: read or write.

permissions.organization_hooksno

The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be one of: read or write.

permissions.organization_planno

The level of permission to grant the access token for viewing an organization's plan. Can be one of: read.

permissions.organization_projectsno

The level of permission to grant the access token to manage organization projects, columns, and cards. Can be one of: read, write, or admin.

permissions.organization_secretsno

The level of permission to grant the access token to manage organization secrets. Can be one of: read or write.

permissions.organization_self_hosted_runnersno

The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be one of: read or write.

permissions.organization_user_blockingno

The level of permission to grant the access token to view and manage users blocked by the organization. Can be one of: read or write.

permissions.team_discussionsno

The level of permission to grant the access token to manage team discussions and related comments. Can be one of: read or write.

See also: GitHub Developer Guide documentation.

Suspend an app installation

Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account.

You must use a JWT to access this endpoint.

octokit.apps.suspendInstallation({
installation_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

See also: GitHub Developer Guide documentation.

Unsuspend an app installation

Removes a GitHub App installation suspension.

You must use a JWT to access this endpoint.

octokit.apps.unsuspendInstallation({
installation_id,
});

Parameters

namerequireddescription
installation_idyes

installation_id parameter

See also: GitHub Developer Guide documentation.

Update a webhook configuration for an app

Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "Creating a GitHub App."

You must use a JWT to access this endpoint.

octokit.apps.updateWebhookConfigForApp();

Parameters

namerequireddescription
urlno

The URL to which the payloads will be delivered.

content_typeno

The media type used to serialize the payloads. Supported values include json and form. The default is form.

secretno

If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.

insecure_sslno

Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.

See also: GitHub Developer Guide documentation.