OAuth Authorizations
Download SpecList your grants
Deprecation Notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the list your authorizations API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on the application authorizations settings screen within GitHub. The scopes
returned are the union of scopes authorized for the application. For example, if an application has one token with repo
scope and another token with user
scope, the grant will return ["repo", "user"]
.
per_page
int
The number of results per page (max 100).
- Default
- 30
page
int
Page number of the results to fetch.
- Default
- 1
client_id
string
The client ID of your GitHub app.
Response
Response
[
{
"id": 1,
"url": "https://api.github.com/applications/grants/1",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"created_at": "2011-09-06T17:26:27Z",
"updated_at": "2011-09-06T20:39:23Z",
"scopes": [
"public_repo"
]
}
]
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
No schema
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
Not modified
Empty response
Forbidden
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Requires authentication
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Resource not found
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
array[object (Application Grant)]
- Content Type
- application/json
Application Grant
object (Application Grant)
The authorization associated with an OAuth Access.
id
int
required
- Example
- 1
url
string
uri
required
- Example
- "https://api.github.com/applications/grants/1"
app
object (app)
required
client_id
string
required
name
string
required
url
string
uri
required
created_at
string
date-time
required
- Example
- "2011-09-06T17:26:27Z"
updated_at
string
date-time
required
- Example
- "2011-09-06T20:39:23Z"
scopes
array[string]
required
- Example
- [ "public_repo" ]
string
user
object (user) or null
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
string
required
- Example
- "https://api.github.com/users/octocat/events{/privacy}"
received_events_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/received_events"
type
string
required
- Example
- "User"
site_admin
boolean
required
starred_at
string
- Example
- "\"2020-07-09T00:17:55Z\""
Link
string
Get a single grant
Deprecation Notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
grant_id
int
required
The unique identifier of the grant.
Response
Response
{
"id": 1,
"url": "https://api.github.com/applications/grants/1",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"created_at": "2011-09-06T17:26:27Z",
"updated_at": "2011-09-06T20:39:23Z",
"scopes": [
"public_repo"
]
}
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
No schema
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
Not modified
Empty response
Forbidden
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Requires authentication
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
id
int
required
- Example
- 1
url
string
uri
required
- Example
- "https://api.github.com/applications/grants/1"
app
object (app)
required
client_id
string
required
name
string
required
url
string
uri
required
created_at
string
date-time
required
- Example
- "2011-09-06T17:26:27Z"
updated_at
string
date-time
required
- Example
- "2011-09-06T20:39:23Z"
scopes
array[string]
required
- Example
- [ "public_repo" ]
string
user
object (user) or null
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
string
required
- Example
- "https://api.github.com/users/octocat/events{/privacy}"
received_events_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/received_events"
type
string
required
- Example
- "User"
site_admin
boolean
required
starred_at
string
- Example
- "\"2020-07-09T00:17:55Z\""
Delete a grant
Deprecation Notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on the application authorizations settings screen within GitHub.
grant_id
int
required
The unique identifier of the grant.
Response
Response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
No schema
No schema
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
Not modified
Empty response
Forbidden
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Requires authentication
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
List your authorizations
Deprecation Notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
per_page
int
The number of results per page (max 100).
- Default
- 30
page
int
Page number of the results to fetch.
- Default
- 1
client_id
string
The client ID of your GitHub app.
Response
Response
[
{
"id": 2,
"url": "https://enterprise.octocat.com/api/v3/authorizations/2",
"app": {
"name": "My personal access token",
"url": "https://docs.github.com/enterprise/rest/reference/enterprise-admin#list-personal-access-tokens",
"client_id": "00000000000000000000"
},
"token": "ghp_16C7e42F292c6912E7710c838347Ae178B4a",
"hashed_token": "23cffb2fab1b0a62747863eba88cb9327e561f2f7a0c8661c0d9b83146cb8d45",
"token_last_eight": "Ae178B4a",
"note": "My personal access token",
"note_url": null,
"created_at": "2019-04-24T21:49:02Z",
"updated_at": "2019-04-24T21:49:02Z",
"scopes": [
"admin:business",
"admin:gpg_key",
"admin:org",
"admin:org_hook",
"admin:pre_receive_hook",
"admin:public_key",
"admin:repo_hook",
"delete_repo",
"gist",
"notifications",
"repo",
"user",
"write:discussion"
],
"fingerprint": null
}
]
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
No schema
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
Not modified
Empty response
Forbidden
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Requires authentication
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Resource not found
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
array[object (Authorization)]
- Content Type
- application/json
Authorization
object (Authorization)
The authorization for an OAuth app, GitHub App, or a Personal Access Token.
id
int
required
url
string
uri
required
scopes
array[string] or null
required
A list of scopes that this authorization is in.
string
token
string
required
token_last_eight
string or null
required
hashed_token
string or null
required
app
object (app)
required
client_id
string
required
name
string
required
url
string
uri
required
note
string or null
required
note_url
string or null
uri
required
updated_at
string
date-time
required
created_at
string
date-time
required
fingerprint
string or null
required
user
object (user) or null
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
string
required
- Example
- "https://api.github.com/users/octocat/events{/privacy}"
received_events_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/received_events"
type
string
required
- Example
- "User"
site_admin
boolean
required
starred_at
string
- Example
- "\"2020-07-09T00:17:55Z\""
installation
object (installation) or null
permissions
object (permissions)
required
The permissions granted to the user-to-server access token.
- Example
- { "contents": "read", "issues": "read", "deployments": "write", "single_file": "read" }
actions
string
The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts.
- Enum
-
- read
- write
administration
string
The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation.
- Enum
-
- read
- write
checks
string
The level of permission to grant the access token for checks on code.
- Enum
-
- read
- write
contents
string
The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges.
- Enum
-
- read
- write
deployments
string
The level of permission to grant the access token for deployments and deployment statuses.
- Enum
-
- read
- write
environments
string
The level of permission to grant the access token for managing repository environments.
- Enum
-
- read
- write
issues
string
The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones.
- Enum
-
- read
- write
metadata
string
The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.
- Enum
-
- read
- write
packages
string
The level of permission to grant the access token for packages published to GitHub Packages.
- Enum
-
- read
- write
pages
string
The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds.
- Enum
-
- read
- write
pull_requests
string
The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges.
- Enum
-
- read
- write
repository_hooks
string
The level of permission to grant the access token to manage the post-receive hooks for a repository.
- Enum
-
- read
- write
repository_projects
string
The level of permission to grant the access token to manage repository projects, columns, and cards.
- Enum
-
- read
- write
- admin
secret_scanning_alerts
string
The level of permission to grant the access token to view and manage secret scanning alerts.
- Enum
-
- read
- write
secrets
string
The level of permission to grant the access token to manage repository secrets.
- Enum
-
- read
- write
security_events
string
The level of permission to grant the access token to view and manage security events like code scanning alerts.
- Enum
-
- read
- write
single_file
string
The level of permission to grant the access token to manage just a single file.
- Enum
-
- read
- write
statuses
string
The level of permission to grant the access token for commit statuses.
- Enum
-
- read
- write
vulnerability_alerts
string
The level of permission to grant the access token to manage Dependabot alerts.
- Enum
-
- read
- write
workflows
string
The level of permission to grant the access token to update GitHub Actions workflow files.
- Enum
-
- write
members
string
The level of permission to grant the access token for organization teams and members.
- Enum
-
- read
- write
organization_administration
string
The level of permission to grant the access token to manage access to an organization.
- Enum
-
- read
- write
organization_custom_roles
string
The level of permission to grant the access token for custom repository roles management. This property is in beta and is subject to change.
- Enum
-
- read
- write
organization_announcement_banners
string
The level of permission to grant the access token to view and manage announcement banners for an organization.
- Enum
-
- read
- write
organization_hooks
string
The level of permission to grant the access token to manage the post-receive hooks for an organization.
- Enum
-
- read
- write
organization_personal_access_tokens
string
The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization.
- Enum
-
- read
- write
organization_personal_access_token_requests
string
The level of permission to grant the access token for viewing and managing fine-grained personal access tokens that have been approved by an organization.
- Enum
-
- read
- write
organization_plan
string
The level of permission to grant the access token for viewing an organization's plan.
- Enum
-
- read
organization_projects
string
The level of permission to grant the access token to manage organization projects and projects beta (where available).
- Enum
-
- read
- write
- admin
organization_packages
string
The level of permission to grant the access token for organization packages published to GitHub Packages.
- Enum
-
- read
- write
organization_secrets
string
The level of permission to grant the access token to manage organization secrets.
- Enum
-
- read
- write
organization_self_hosted_runners
string
The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization.
- Enum
-
- read
- write
organization_user_blocking
string
The level of permission to grant the access token to view and manage users blocked by the organization.
- Enum
-
- read
- write
team_discussions
string
The level of permission to grant the access token to manage team discussions and related comments.
- Enum
-
- read
- write
repository_selection
string
required
Describe whether all repositories have been selected or there's a selection involved
- Enum
-
- all
- selected
single_file_name
string or null
required
- Example
- "config.yaml"
has_multiple_single_files
boolean
- Example
- true
single_file_paths
array[string]
- Example
- [ "config.yml", ".github/issue_TEMPLATE.md" ]
string
repositories_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
account
object (account)
required
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
string
required
- Example
- "https://api.github.com/users/octocat/events{/privacy}"
received_events_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/received_events"
type
string
required
- Example
- "User"
site_admin
boolean
required
starred_at
string
- Example
- "\"2020-07-09T00:17:55Z\""
expires_at
string or null
date-time
required
Link
string
Create a new authorization
Deprecation Notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
Warning: Apps must use the web application flow to obtain OAuth tokens that work with GitHub Enterprise Server SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub Enterprise Server SAML organizations. For more information, see the blog post.
Creates OAuth tokens using Basic Authentication. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "Working with two-factor authentication."
To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use fingerprint
to differentiate between them.
You can also create tokens on GitHub Enterprise Server from the personal access tokens settings page. Read more about these tokens in the GitHub Help documentation.
Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in the GitHub Help documentation.
scopes
array[string] or null
A list of scopes that this authorization is in.
- Example
- [ "public_repo", "user" ]
string
note
string
A note to remind you what the OAuth token is for.
- Example
- "Update all gems"
note_url
string
A URL to remind you what app the OAuth token is for.
client_id
string
The OAuth app client key for which to create the token.
- Max Length
- 20
client_secret
string
The OAuth app client secret for which to create the token.
- Max Length
- 40
fingerprint
string
A unique string to distinguish an authorization from others created for the same client ID and user.
Request
{
"scopes": [
"public_repo"
],
"note": "optional note",
"note_url": "http://optional/note/url",
"client_id": "abcde12345fghij67890",
"client_secret": "3ef4ad510c59ad37bac6bb4f80047fb3aee3cc7f"
}
Response
Response
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo"
],
"token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
"token_last_eight": "Ae178B4a",
"hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"note": "optional note",
"note_url": "http://optional/note/url",
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"expires_at": "2011-10-06T17:26:27Z",
"fingerprint": "jklmnop12345678"
}
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
No schema
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
Validation failed, or the endpoint has been spammed.
{
"message": "string",
"documentation_url": "string",
"errors": [
{
"resource": "string",
"field": "string",
"message": "string",
"code": "string",
"index": 123,
"value": "string"
}
]
}
Gone
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Not modified
Empty response
Forbidden
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Requires authentication
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
message
string
required
documentation_url
string
required
errors
array[object]
object
resource
string
field
string
message
string
code
string
required
index
int
value
One Of
string or null
int or null
array[string] or null
string
id
int
required
url
string
uri
required
scopes
array[string] or null
required
A list of scopes that this authorization is in.
string
token
string
required
token_last_eight
string or null
required
hashed_token
string or null
required
app
object (app)
required
client_id
string
required
name
string
required
url
string
uri
required
note
string or null
required
note_url
string or null
uri
required
updated_at
string
date-time
required
created_at
string
date-time
required
fingerprint
string or null
required
user
object (user) or null
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
string
required
- Example
- "https://api.github.com/users/octocat/events{/privacy}"
received_events_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/received_events"
type
string
required
- Example
- "User"
site_admin
boolean
required
starred_at
string
- Example
- "\"2020-07-09T00:17:55Z\""
installation
object (installation) or null
permissions
object (permissions)
required
The permissions granted to the user-to-server access token.
- Example
- { "contents": "read", "issues": "read", "deployments": "write", "single_file": "read" }
actions
string
The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts.
- Enum
-
- read
- write
administration
string
The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation.
- Enum
-
- read
- write
checks
string
The level of permission to grant the access token for checks on code.
- Enum
-
- read
- write
contents
string
The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges.
- Enum
-
- read
- write
deployments
string
The level of permission to grant the access token for deployments and deployment statuses.
- Enum
-
- read
- write
environments
string
The level of permission to grant the access token for managing repository environments.
- Enum
-
- read
- write
issues
string
The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones.
- Enum
-
- read
- write
metadata
string
The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.
- Enum
-
- read
- write
packages
string
The level of permission to grant the access token for packages published to GitHub Packages.
- Enum
-
- read
- write
pages
string
The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds.
- Enum
-
- read
- write
pull_requests
string
The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges.
- Enum
-
- read
- write
repository_hooks
string
The level of permission to grant the access token to manage the post-receive hooks for a repository.
- Enum
-
- read
- write
repository_projects
string
The level of permission to grant the access token to manage repository projects, columns, and cards.
- Enum
-
- read
- write
- admin
secret_scanning_alerts
string
The level of permission to grant the access token to view and manage secret scanning alerts.
- Enum
-
- read
- write
secrets
string
The level of permission to grant the access token to manage repository secrets.
- Enum
-
- read
- write
security_events
string
The level of permission to grant the access token to view and manage security events like code scanning alerts.
- Enum
-
- read
- write
single_file
string
The level of permission to grant the access token to manage just a single file.
- Enum
-
- read
- write
statuses
string
The level of permission to grant the access token for commit statuses.
- Enum
-
- read
- write
vulnerability_alerts
string
The level of permission to grant the access token to manage Dependabot alerts.
- Enum
-
- read
- write
workflows
string
The level of permission to grant the access token to update GitHub Actions workflow files.
- Enum
-
- write
members
string
The level of permission to grant the access token for organization teams and members.
- Enum
-
- read
- write
organization_administration
string
The level of permission to grant the access token to manage access to an organization.
- Enum
-
- read
- write
organization_custom_roles
string
The level of permission to grant the access token for custom repository roles management. This property is in beta and is subject to change.
- Enum
-
- read
- write
organization_announcement_banners
string
The level of permission to grant the access token to view and manage announcement banners for an organization.
- Enum
-
- read
- write
organization_hooks
string
The level of permission to grant the access token to manage the post-receive hooks for an organization.
- Enum
-
- read
- write
organization_personal_access_tokens
string
The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization.
- Enum
-
- read
- write
organization_personal_access_token_requests
string
The level of permission to grant the access token for viewing and managing fine-grained personal access tokens that have been approved by an organization.
- Enum
-
- read
- write
organization_plan
string
The level of permission to grant the access token for viewing an organization's plan.
- Enum
-
- read
organization_projects
string
The level of permission to grant the access token to manage organization projects and projects beta (where available).
- Enum
-
- read
- write
- admin
organization_packages
string
The level of permission to grant the access token for organization packages published to GitHub Packages.
- Enum
-
- read
- write
organization_secrets
string
The level of permission to grant the access token to manage organization secrets.
- Enum
-
- read
- write
organization_self_hosted_runners
string
The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization.
- Enum
-
- read
- write
organization_user_blocking
string
The level of permission to grant the access token to view and manage users blocked by the organization.
- Enum
-
- read
- write
team_discussions
string
The level of permission to grant the access token to manage team discussions and related comments.
- Enum
-
- read
- write
repository_selection
string
required
Describe whether all repositories have been selected or there's a selection involved
- Enum
-
- all
- selected
single_file_name
string or null
required
- Example
- "config.yaml"
has_multiple_single_files
boolean
- Example
- true
single_file_paths
array[string]
- Example
- [ "config.yml", ".github/issue_TEMPLATE.md" ]
string
repositories_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
account
object (account)
required
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
string
required
- Example
- "https://api.github.com/users/octocat/events{/privacy}"
received_events_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/received_events"
type
string
required
- Example
- "User"
site_admin
boolean
required
starred_at
string
- Example
- "\"2020-07-09T00:17:55Z\""
expires_at
string or null
date-time
required
Location
string
Get-or-create an authorization for a specific app
Deprecation Notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
Warning: Apps must use the web application flow to obtain OAuth tokens that work with GitHub Enterprise Server SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub Enterprise Server SAML organizations. For more information, see the blog post.
Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.
If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "Working with two-factor authentication."
Deprecation Notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
client_secret
string
required
The OAuth app client secret for which to create the token.
- Max Length
- 40
scopes
array[string] or null
A list of scopes that this authorization is in.
- Example
- [ "public_repo", "user" ]
string
note
string
A note to remind you what the OAuth token is for.
- Example
- "Update all gems"
note_url
string
A URL to remind you what app the OAuth token is for.
fingerprint
string
A unique string to distinguish an authorization from others created for the same client ID and user.
client_id
string
required
The client ID of the OAuth app.
Request
{
"client_secret": "3ef4ad510c59ad37bac6bb4f80047fb3aee3cc7f",
"scopes": [
"public_repo"
],
"note": "optional note",
"note_url": "http://optional/note/url"
}
Response
if returning an existing token
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo"
],
"token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
"token_last_eight": "Ae178B4a",
"hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"note": "optional note",
"note_url": "http://optional/note/url",
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"expires_at": "2011-10-06T17:26:27Z",
"fingerprint": ""
}
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
Empty response
No schema
message
string
documentation_url
string
url
string
status
string
message
string
documentation_url
string
url
string
status
string
Validation failed, or the endpoint has been spammed.
{
"message": "string",
"documentation_url": "string",
"errors": [
{
"resource": "string",
"field": "string",
"message": "string",
"code": "string",
"index": 123,
"value": "string"
}
]
}
Not modified
Empty response
Forbidden
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
Requires authentication
{
"message": "string",
"documentation_url": "string",
"url": "string",
"status": "string"
}
message
string
required
documentation_url
string
required
errors
array[object]
object
resource
string
field
string
message
string
code
string
required
index
int
value
One Of
string or null
int or null
array[string] or null
string
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the blog post.
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo"
],
"token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
"token_last_eight": "Ae178B4a",
"hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"note": "optional note",
"note_url": "http://optional/note/url",
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"expires_at": "2011-10-06T17:26:27Z",
"fingerprint": "jklmnop12345678"
}
id
int
required
url
string
uri
required
scopes
array[string] or null
required
A list of scopes that this authorization is in.
string
token
string
required
token_last_eight
string or null
required
hashed_token
string or null
required
app
object (app)
required
client_id
string
required
name
string
required
url
string
uri
required
note
string or null
required
note_url
string or null
uri
required
updated_at
string
date-time
required
created_at
string
date-time
required
fingerprint
string or null
required
user
object (user) or null
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
string
required
- Example
- "https://api.github.com/users/octocat/events{/privacy}"
received_events_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/received_events"
type
string
required
- Example
- "User"
site_admin
boolean
required
starred_at
string
- Example
- "\"2020-07-09T00:17:55Z\""
installation
object (installation) or null
permissions
object (permissions)
required
The permissions granted to the user-to-server access token.
- Example
- { "contents": "read", "issues": "read", "deployments": "write", "single_file": "read" }
actions
string
The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts.
- Enum
-
- read
- write
administration
string
The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation.
- Enum
-
- read
- write
checks
string
The level of permission to grant the access token for checks on code.
- Enum
-
- read
- write
contents
string
The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges.
- Enum
-
- read
- write
deployments
string
The level of permission to grant the access token for deployments and deployment statuses.
- Enum
-
- read
- write
environments
string
The level of permission to grant the access token for managing repository environments.
- Enum
-
- read
- write
issues
string
The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones.
- Enum
-
- read
- write
metadata
string
The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.
- Enum
-
- read
- write
packages
string
The level of permission to grant the access token for packages published to GitHub Packages.
- Enum
-
- read
- write
pages
string
The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds.
- Enum
-
- read
- write
pull_requests
string
The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges.
- Enum
-
- read
- write
repository_hooks
string
The level of permission to grant the access token to manage the post-receive hooks for a repository.
- Enum
-
- read
- write
repository_projects
string
The level of permission to grant the access token to manage repository projects, columns, and cards.
- Enum
-
- read
- write
- admin
secret_scanning_alerts
string
The level of permission to grant the access token to view and manage secret scanning alerts.
- Enum
-
- read
- write
secrets
string
The level of permission to grant the access token to manage repository secrets.
- Enum
-
- read
- write
security_events
string
The level of permission to grant the access token to view and manage security events like code scanning alerts.
- Enum
-
- read
- write
single_file
string
The level of permission to grant the access token to manage just a single file.
- Enum
-
- read
- write
statuses
string
The level of permission to grant the access token for commit statuses.
- Enum
-
- read
- write
vulnerability_alerts
string
The level of permission to grant the access token to manage Dependabot alerts.
- Enum
-
- read
- write
workflows
string
The level of permission to grant the access token to update GitHub Actions workflow files.
- Enum
-
- write
members
string
The level of permission to grant the access token for organization teams and members.
- Enum
-
- read
- write
organization_administration
string
The level of permission to grant the access token to manage access to an organization.
- Enum
-
- read
- write
organization_custom_roles
string
The level of permission to grant the access token for custom repository roles management. This property is in beta and is subject to change.
- Enum
-
- read
- write
organization_announcement_banners
string
The level of permission to grant the access token to view and manage announcement banners for an organization.
- Enum
-
- read
- write
organization_hooks
string
The level of permission to grant the access token to manage the post-receive hooks for an organization.
- Enum
-
- read
- write
organization_personal_access_tokens
string
The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization.
- Enum
-
- read
- write
organization_personal_access_token_requests
string
The level of permission to grant the access token for viewing and managing fine-grained personal access tokens that have been approved by an organization.
- Enum
-
- read
- write
organization_plan
string
The level of permission to grant the access token for viewing an organization's plan.
- Enum
-
- read
organization_projects
string
The level of permission to grant the access token to manage organization projects and projects beta (where available).
- Enum
-
- read
- write
- admin
organization_packages
string
The level of permission to grant the access token for organization packages published to GitHub Packages.
- Enum
-
- read
- write
organization_secrets
string
The level of permission to grant the access token to manage organization secrets.
- Enum
-
- read
- write
organization_self_hosted_runners
string
The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization.
- Enum
-
- read
- write
organization_user_blocking
string
The level of permission to grant the access token to view and manage users blocked by the organization.
- Enum
-
- read
- write
team_discussions
string
The level of permission to grant the access token to manage team discussions and related comments.
- Enum
-
- read
- write
repository_selection
string
required
Describe whether all repositories have been selected or there's a selection involved
- Enum
-
- all
- selected
single_file_name
string or null
required
- Example
- "config.yaml"
has_multiple_single_files
boolean
- Example
- true
single_file_paths
array[string]
- Example
- [ "config.yml", ".github/issue_TEMPLATE.md" ]
string
repositories_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
account
object (account)
required
A GitHub user.
name
string or null
string or null
login
string
required
- Example
- "octocat"
id
int
required
- Example
- 1
node_id
string
required
- Example
- "MDQ6VXNlcjE="
avatar_url
string
uri
required
- Example
- "https://github.com/images/error/octocat_happy.gif"
gravatar_id
string or null
required
- Example
- "41d064eb2195891e12d0413f63227ea7"
url
string
uri
required
- Example
- "https://api.github.com/users/octocat"
html_url
string
uri
required
- Example
- "https://github.com/octocat"
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}"
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"
organizations_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/orgs"
repos_url
string
uri
required
- Example
- "https://api.github.com/users/octocat/repos"
events_url
<