Skip to main content

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.

POST/app/installations/{installation_id}/access_tokens
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
installation_id integer
required

installation_id parameter

Body Params
optional
application/jsonobject
permissions App Permissions object
optional

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

Example:
{
  "contents": "read",
  "deployments": "write",
  "issues": "read",
  "single_file": "read"
}
actions string
optional

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

administration string
optional

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`.

checks string
optional

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

content_references string
optional

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`.

contents string
optional

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`.

deployments string
optional

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

environments string
optional

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

issues string
optional

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`.

members string
optional

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

metadata string
optional

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`.

organization_administration string
optional

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

organization_hooks string
optional

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`.

organization_packages string
optional

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

organization_plan string
optional

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

organization_projects string
optional

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`.

organization_secrets string
optional

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

organization_self_hosted_runners string
optional

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`.

organization_user_blocking string
optional

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`.

packages string
optional

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

pages string
optional

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`.

pull_requests string
optional

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`.

repository_hooks string
optional

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`.

repository_projects string
optional

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

secret_scanning_alerts string
optional

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

secrets string
optional

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

security_events string
optional

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`.

single_file string
optional

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

statuses string
optional

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

team_discussions string
optional

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

vulnerability_alerts string
optional

The level of permission to grant the access token to manage Dependabot alerts. Can be one of: `read` or `write`.

workflows string
optional

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

repositories array[string]
optional

List of repository names that the token should have access to

repository_ids array[integer]
optional

List of repository IDs that the token should have access to

Example:
[
  1
]

Responses

application/json Installation Token object

Response

expires_at string
required
has_multiple_single_files boolean
optional

Example: true

permissions App Permissions object
optional

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

Example:
{
  "contents": "read",
  "deployments": "write",
  "issues": "read",
  "single_file": "read"
}
actions string
optional

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

administration string
optional

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`.

checks string
optional

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

content_references string
optional

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`.

contents string
optional

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`.

deployments string
optional

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

environments string
optional

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

issues string
optional

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`.

members string
optional

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

metadata string
optional

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`.

organization_administration string
optional

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

organization_hooks string
optional

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`.

organization_packages string
optional

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

organization_plan string
optional

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

organization_projects string
optional

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`.

organization_secrets string
optional

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

organization_self_hosted_runners string
optional

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`.

organization_user_blocking string
optional

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`.

packages string
optional

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

pages string
optional

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`.

pull_requests string
optional

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`.

repository_hooks string
optional

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`.

repository_projects string
optional

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

secret_scanning_alerts string
optional

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

secrets string
optional

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

security_events string
optional

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`.

single_file string
optional

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

statuses string
optional

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

team_discussions string
optional

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

vulnerability_alerts string
optional

The level of permission to grant the access token to manage Dependabot alerts. Can be one of: `read` or `write`.

workflows string
optional

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 object

A git repository

allow_forking boolean
optional

Whether to allow forking this repo

allow_merge_commit boolean
optional

Whether to allow merge commits for pull requests.

Example: true

allow_rebase_merge boolean
optional

Whether to allow rebase merges for pull requests.

Example: true

allow_squash_merge boolean
optional

Whether to allow squash merges for pull requests.

Example: true

archive_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}

archived boolean
required

Whether the repository is archived.

assignees_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/assignees{/user}

blobs_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}

branches_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/branches{/branch}

clone_url string
required

Example: https://github.com/octocat/Hello-World.git

collaborators_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}

comments_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/comments{/number}

commits_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/commits{/sha}

compare_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}

contents_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/contents/{+path}

contributors_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/contributors

created_at string<date-time>
requirednullable

Example: 2011-01-26T19:01:12Z

default_branch string
required

The default branch of the repository.

Example: master

delete_branch_on_merge boolean
optional

Whether to delete head branches when pull requests are merged

Example: false

deployments_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/deployments

description string
requirednullable

Example: This your first repo!

disabled boolean
required

Returns whether or not this repository disabled.

downloads_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/downloads

events_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/events

fork boolean
required
forks integer
required
forks_count integer
required

Example: 9

forks_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/forks

full_name string
required

Example: octocat/Hello-World

git_commits_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}

git_refs_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}

git_tags_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}

git_url string
required

Example: git:github.com/octocat/Hello-World.git

has_downloads boolean
required

Whether downloads are enabled.

Example: true

has_issues boolean
required

Whether issues are enabled.

Example: true

has_pages boolean
required
has_projects boolean
required

Whether projects are enabled.

Example: true

has_wiki boolean
required

Whether the wiki is enabled.

Example: true

homepage string<uri>
requirednullable

Example: https://github.com

hooks_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/hooks

html_url string<uri>
required

Example: https://github.com/octocat/Hello-World

id integer
required

Unique identifier of the repository

Example: 42

is_template boolean
optional

Whether this repository acts as a template that can be used to generate new repositories.

Example: true

issue_comment_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}

issue_events_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/issues/events{/number}

issues_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/issues{/number}

keys_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/keys{/key_id}

labels_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/labels{/name}

language string
requirednullable
languages_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/languages

license License Simple object
requirednullable

License Simple

html_url string<uri>
optional
key string
required

Example: mit

name string
required

Example: MIT License

node_id string
required

Example: MDc6TGljZW5zZW1pdA==

spdx_id string
requirednullable

Example: MIT

url string<uri>
requirednullable

Example: https://api.github.com/licenses/mit

master_branch string
optional
merges_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/merges

milestones_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/milestones{/number}

mirror_url string<uri>
requirednullable

Example: git:git.example.com/octocat/Hello-World

name string
required

The name of the repository.

Example: Team Environment

network_count integer
optional
node_id string
required

Example: MDEwOlJlcG9zaXRvcnkxMjk2MjY5

notifications_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}

open_issues integer
required
open_issues_count integer
required

Example: 0

organization Simple User object
optionalnullable

Simple User

avatar_url string<uri>
required

Example: https://github.com/images/error/octocat_happy.gif

email string
optionalnullable
events_url string
required

Example: https://api.github.com/users/octocat/events{/privacy}

followers_url string<uri>
required

Example: https://api.github.com/users/octocat/followers

following_url string
required

Example: https://api.github.com/users/octocat/following{/other_user}

gists_url string
required

Example: https://api.github.com/users/octocat/gists{/gist_id}

gravatar_id string
requirednullable

Example: 41d064eb2195891e12d0413f63227ea7

html_url string<uri>
required

Example: https://github.com/octocat

id integer
required

Example: 1

login string
required

Example: octocat

name string
optionalnullable
node_id string
required

Example: MDQ6VXNlcjE=

organizations_url string<uri>
required

Example: https://api.github.com/users/octocat/orgs

received_events_url string<uri>
required

Example: https://api.github.com/users/octocat/received_events

repos_url string<uri>
required

Example: https://api.github.com/users/octocat/repos

site_admin boolean
required
starred_at string
optional

Example: "2020-07-09T00:17:55Z"

starred_url string
required

Example: https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_url string<uri>
required

Example: https://api.github.com/users/octocat/subscriptions

type string
required

Example: User

url string<uri>
required

Example: https://api.github.com/users/octocat

owner Simple User object
required

Simple User

avatar_url string<uri>
required

Example: https://github.com/images/error/octocat_happy.gif

email string
optionalnullable
events_url string
required

Example: https://api.github.com/users/octocat/events{/privacy}

followers_url string<uri>
required

Example: https://api.github.com/users/octocat/followers

following_url string
required

Example: https://api.github.com/users/octocat/following{/other_user}

gists_url string
required

Example: https://api.github.com/users/octocat/gists{/gist_id}

gravatar_id string
requirednullable

Example: 41d064eb2195891e12d0413f63227ea7

html_url string<uri>
required

Example: https://github.com/octocat

id integer
required

Example: 1

login string
required

Example: octocat

name string
optionalnullable
node_id string
required

Example: MDQ6VXNlcjE=

organizations_url string<uri>
required

Example: https://api.github.com/users/octocat/orgs

received_events_url string<uri>
required

Example: https://api.github.com/users/octocat/received_events

repos_url string<uri>
required

Example: https://api.github.com/users/octocat/repos

site_admin boolean
required
starred_at string
optional

Example: "2020-07-09T00:17:55Z"

starred_url string
required

Example: https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_url string<uri>
required

Example: https://api.github.com/users/octocat/subscriptions

type string
required

Example: User

url string<uri>
required

Example: https://api.github.com/users/octocat

permissions object
optional
admin boolean
required
maintain boolean
optional
pull boolean
required
push boolean
required
triage boolean
optional
private boolean
required

Whether the repository is private or public.

pulls_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/pulls{/number}

pushed_at string<date-time>
requirednullable

Example: 2011-01-26T19:06:43Z

releases_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/releases{/id}

size integer
required

Example: 108

ssh_url string
required

Example: [email protected]:octocat/Hello-World.git

stargazers_count integer
required

Example: 80

stargazers_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/stargazers

starred_at string
optional

Example: "2020-07-09T00:17:42Z"

statuses_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/statuses/{sha}

subscribers_count integer
optional
subscribers_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/subscribers

subscription_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/subscription

svn_url string<uri>
required

Example: https://svn.github.com/octocat/Hello-World

tags_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/tags

teams_url string<uri>
required

Example: http://api.github.com/repos/octocat/Hello-World/teams

temp_clone_token string
optional
template_repository object
optionalnullable
allow_merge_commit boolean
optional
allow_rebase_merge boolean
optional
allow_squash_merge boolean
optional
allow_update_branch boolean
optional
archive_url string
optional
archived boolean
optional
assignees_url string
optional
blobs_url string
optional
branches_url string
optional
clone_url string
optional
collaborators_url string
optional
comments_url string
optional
commits_url string
optional
compare_url string
optional
contents_url string
optional
contributors_url string
optional
created_at string
optional
default_branch string
optional
delete_branch_on_merge boolean
optional
deployments_url string
optional
description string
optional
disabled boolean
optional
downloads_url string
optional
events_url string
optional
fork boolean
optional
forks_count integer
optional
forks_url string
optional
full_name string
optional
git_commits_url string
optional
git_refs_url string
optional
git_tags_url string
optional
git_url string
optional
has_downloads boolean
optional
has_issues boolean
optional
has_pages boolean
optional
has_projects boolean
optional
has_wiki boolean
optional
homepage string
optional
hooks_url string
optional
html_url string
optional
id integer
optional
is_template boolean
optional
issue_comment_url string
optional
issue_events_url string
optional
issues_url string
optional
keys_url string
optional
labels_url string
optional
language string
optional
languages_url string
optional
merges_url string
optional
milestones_url string
optional
mirror_url string
optional
name string
optional
network_count integer
optional
node_id string
optional
notifications_url string
optional
open_issues_count integer
optional
owner object
optional
permissions object
optional
private boolean
optional
pulls_url string
optional
pushed_at string
optional
releases_url string
optional
size integer
optional
ssh_url string
optional
stargazers_count integer
optional
stargazers_url string
optional
statuses_url string
optional
subscribers_count integer
optional
subscribers_url string
optional
subscription_url string
optional
svn_url string
optional
tags_url string
optional
teams_url string
optional
temp_clone_token string
optional
topics array
optional
trees_url string
optional
updated_at string
optional
url string
optional
visibility string
optional
watchers_count integer
optional
topics array[string]
optional
trees_url string
required

Example: http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}

updated_at string<date-time>
requirednullable

Example: 2011-01-26T19:14:43Z

url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World

visibility string
optional

The repository visibility: public, private, or internal.

watchers integer
required
watchers_count integer
required

Example: 80

repository_selection string
optional
single_file string
optional

Example: README.md

single_file_paths array[string]
optional
Example:
[
  "config.yml",
  ".github/issue_TEMPLATE.md"
]
token string
required
application/json Basic Error object

Requires authentication

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Basic Error object

Forbidden

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Basic Error object

Resource not found

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json object

Preview header missing

documentation_url string
required
message string
required
application/json Validation Error object

Validation failed

documentation_url string
required
errors array[object]
optional
items object
code string
required
field string
optional
index integer
optional
message string
optional
resource string
optional
value
optional
message string
required