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](https://docs.github.com/[email protected]/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
/app/installations/{installation_id}/access_tokens- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- installation_id integerrequired
installation_id parameter
Body Params
optional permissions App Permissions objectoptionalThe permissions granted to the user-to-server access token.
Example:{
"contents": "read",
"deployments": "write",
"issues": "read",
"single_file": "read"
}
The permissions granted to the user-to-server access token.
{
"contents": "read",
"deployments": "write",
"issues": "read",
"single_file": "read"
}The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token for checks on code. Can be one of: `read` or `write`.
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`.
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`.
The level of permission to grant the access token for deployments and deployment statuses. Can be one of: `read` or `write`.
The level of permission to grant the access token for managing repository environments. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token for organization teams and members. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token to manage access to an organization. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token for organization packages published to GitHub Packages. Can be one of: `read` or `write`.
The level of permission to grant the access token for viewing an organization's plan. Can be one of: `read`.
The level of permission to grant the access token to manage organization projects and projects beta (where available). Can be one of: `read`, `write`, or `admin`.
The level of permission to grant the access token to manage organization secrets. Can be one of: `read` or `write`.
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`.
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`.
The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: `read` or `write`.
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`.
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`.
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`.
The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: `read`, `write`, or `admin`.
The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: `read` or `write`.
The level of permission to grant the access token to manage repository secrets. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token to manage just a single file. Can be one of: `read` or `write`.
The level of permission to grant the access token for commit statuses. Can be one of: `read` or `write`.
The level of permission to grant the access token to manage team discussions and related comments. Can be one of: `read` or `write`.
The level of permission to grant the access token to manage Dependabot alerts. Can be one of: `read` or `write`.
The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: `write`.
List of repository names that the token should have access to
List of repository IDs that the token should have access to
[
1
]Responses
Response
Example: true
permissions App Permissions objectoptionalThe permissions granted to the user-to-server access token.
Example:{
"contents": "read",
"deployments": "write",
"issues": "read",
"single_file": "read"
}
The permissions granted to the user-to-server access token.
{
"contents": "read",
"deployments": "write",
"issues": "read",
"single_file": "read"
}The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token for checks on code. Can be one of: `read` or `write`.
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`.
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`.
The level of permission to grant the access token for deployments and deployment statuses. Can be one of: `read` or `write`.
The level of permission to grant the access token for managing repository environments. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token for organization teams and members. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token to manage access to an organization. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token for organization packages published to GitHub Packages. Can be one of: `read` or `write`.
The level of permission to grant the access token for viewing an organization's plan. Can be one of: `read`.
The level of permission to grant the access token to manage organization projects and projects beta (where available). Can be one of: `read`, `write`, or `admin`.
The level of permission to grant the access token to manage organization secrets. Can be one of: `read` or `write`.
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`.
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`.
The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: `read` or `write`.
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`.
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`.
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`.
The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: `read`, `write`, or `admin`.
The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: `read` or `write`.
The level of permission to grant the access token to manage repository secrets. Can be one of: `read` or `write`.
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`.
The level of permission to grant the access token to manage just a single file. Can be one of: `read` or `write`.
The level of permission to grant the access token for commit statuses. Can be one of: `read` or `write`.
The level of permission to grant the access token to manage team discussions and related comments. Can be one of: `read` or `write`.
The level of permission to grant the access token to manage Dependabot alerts. Can be one of: `read` or `write`.
The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: `write`.
repositories array[Repository object]optional
items Repository objectA git repository
A git repository
Whether to allow forking this repo
Whether to allow merge commits for pull requests.
Example: true
Whether to allow rebase merges for pull requests.
Example: true
Whether to allow squash merges for pull requests.
Example: true
Example: http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}
Whether the repository is archived.
Example: http://api.github.com/repos/octocat/Hello-World/assignees{/user}
Example: http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}
Example: http://api.github.com/repos/octocat/Hello-World/branches{/branch}
Example: https://github.com/octocat/Hello-World.git
Example: http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}
Example: http://api.github.com/repos/octocat/Hello-World/comments{/number}
Example: http://api.github.com/repos/octocat/Hello-World/commits{/sha}
Example: http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}
Example: http://api.github.com/repos/octocat/Hello-World/contents/{+path}
Example: http://api.github.com/repos/octocat/Hello-World/contributors
Example: 2011-01-26T19:01:12Z
The default branch of the repository.
Example: master
Whether to delete head branches when pull requests are merged
Example: false
Example: http://api.github.com/repos/octocat/Hello-World/deployments
Example: This your first repo!
Returns whether or not this repository disabled.
Example: http://api.github.com/repos/octocat/Hello-World/downloads
Example: http://api.github.com/repos/octocat/Hello-World/events
Example: 9
Example: http://api.github.com/repos/octocat/Hello-World/forks
Example: octocat/Hello-World
Example: http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}
Example: http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}
Example: http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}
Example: git:github.com/octocat/Hello-World.git
Whether downloads are enabled.
Example: true
Whether issues are enabled.
Example: true
Whether projects are enabled.
Example: true
Whether the wiki is enabled.
Example: true
Example: https://github.com
Example: http://api.github.com/repos/octocat/Hello-World/hooks
Example: https://github.com/octocat/Hello-World
Unique identifier of the repository
Example: 42
Whether this repository acts as a template that can be used to generate new repositories.
Example: true
Example: http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}
Example: http://api.github.com/repos/octocat/Hello-World/issues/events{/number}
Example: http://api.github.com/repos/octocat/Hello-World/issues{/number}
Example: http://api.github.com/repos/octocat/Hello-World/keys{/key_id}
Example: http://api.github.com/repos/octocat/Hello-World/labels{/name}
Example: http://api.github.com/repos/octocat/Hello-World/languages
license License Simple objectrequirednullable License Simple
License Simple
Example: mit
Example: MIT License
Example: MDc6TGljZW5zZW1pdA==
Example: MIT
Example: https://api.github.com/licenses/mit
Example: http://api.github.com/repos/octocat/Hello-World/merges
Example: http://api.github.com/repos/octocat/Hello-World/milestones{/number}
Example: git:git.example.com/octocat/Hello-World
The name of the repository.
Example: Team Environment
Example: MDEwOlJlcG9zaXRvcnkxMjk2MjY5
Example: http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}
Example: 0
organization Simple User objectoptionalnullable Simple User
Simple User
Example: https://github.com/images/error/octocat_happy.gif
Example: https://api.github.com/users/octocat/events{/privacy}
Example: https://api.github.com/users/octocat/followers
Example: https://api.github.com/users/octocat/following{/other_user}
Example: https://api.github.com/users/octocat/gists{/gist_id}
Example: 41d064eb2195891e12d0413f63227ea7
Example: https://github.com/octocat
Example: 1
Example: octocat
Example: MDQ6VXNlcjE=
Example: https://api.github.com/users/octocat/orgs
Example: https://api.github.com/users/octocat/received_events
Example: https://api.github.com/users/octocat/repos
Example: "2020-07-09T00:17:55Z"
Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
Example: https://api.github.com/users/octocat/subscriptions
Example: User
Example: https://api.github.com/users/octocat
owner Simple User objectrequiredSimple User
Simple User
Example: https://github.com/images/error/octocat_happy.gif
Example: https://api.github.com/users/octocat/events{/privacy}
Example: https://api.github.com/users/octocat/followers
Example: https://api.github.com/users/octocat/following{/other_user}
Example: https://api.github.com/users/octocat/gists{/gist_id}
Example: 41d064eb2195891e12d0413f63227ea7
Example: https://github.com/octocat
Example: 1
Example: octocat
Example: MDQ6VXNlcjE=
Example: https://api.github.com/users/octocat/orgs
Example: https://api.github.com/users/octocat/received_events
Example: https://api.github.com/users/octocat/repos
Example: "2020-07-09T00:17:55Z"
Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
Example: https://api.github.com/users/octocat/subscriptions
Example: User
Example: https://api.github.com/users/octocat
permissions objectoptional
Whether the repository is private or public.
Example: http://api.github.com/repos/octocat/Hello-World/pulls{/number}
Example: 2011-01-26T19:06:43Z
Example: http://api.github.com/repos/octocat/Hello-World/releases{/id}
Example: 108
Example: [email protected]:octocat/Hello-World.git
Example: 80
Example: http://api.github.com/repos/octocat/Hello-World/stargazers
Example: "2020-07-09T00:17:42Z"
Example: http://api.github.com/repos/octocat/Hello-World/statuses/{sha}
Example: http://api.github.com/repos/octocat/Hello-World/subscribers
Example: http://api.github.com/repos/octocat/Hello-World/subscription
Example: https://svn.github.com/octocat/Hello-World
Example: http://api.github.com/repos/octocat/Hello-World/tags
Example: http://api.github.com/repos/octocat/Hello-World/teams
template_repository objectoptionalnullable
Example: http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}
Example: 2011-01-26T19:14:43Z
Example: https://api.github.com/repos/octocat/Hello-World
The repository visibility: public, private, or internal.
Example: 80
Example: README.md
[
"config.yml",
".github/issue_TEMPLATE.md"
]Requires authentication
Forbidden
Resource not found
Preview header missing
Validation failed