Skip to content

Reset a token

PATCH
/applications/{client_id}/token

OAuth applications and GitHub applications with OAuth authorizations can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the “token” property in the response because changes take effect immediately. Invalid tokens will return 404 NOT FOUND.

API method documentation

client_id
required
string

The client ID of the GitHub app.

Examples
Example default
Iv1.8a61f9b3a7aba766
Media type application/json
object
access_token
required

The access_token of the OAuth or GitHub application.

string
Examples
Example default
{
"access_token": "e72e16c7e42f292c6912e7710c838347ae178b4a"
}

Response

Media type application/json
Authorization

The authorization for an OAuth app, GitHub App, or a Personal Access Token.

object
id
required
integer format: int64
url
required
string format: uri
scopes
required

A list of scopes that this authorization is in.

Array<string>
nullable
token
required
string
token_last_eight
required
string
nullable
hashed_token
required
string
nullable
app
required
object
client_id
required
string
name
required
string
url
required
string format: uri
note
required
string
nullable
note_url
required
string format: uri
nullable
updated_at
required
string format: date-time
created_at
required
string format: date-time
fingerprint
required
string
nullable
user
Simple User

A GitHub user.

object
name
string
nullable
email
string
nullable
login
required
string
id
required
integer format: int64
node_id
required
string
avatar_url
required
string format: uri
gravatar_id
required
string
nullable
url
required
string format: uri
html_url
required
string format: uri
followers_url
required
string format: uri
following_url
required
string
gists_url
required
string
starred_url
required
string
subscriptions_url
required
string format: uri
organizations_url
required
string format: uri
repos_url
required
string format: uri
events_url
required
string
received_events_url
required
string format: uri
type
required
string
site_admin
required
boolean
starred_at
string
user_view_type
string
installation
Scoped Installation
object
permissions
required
App Permissions

The permissions granted to the fine-grained access token.

object
actions

The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts.

string
Allowed values: read write
administration

The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation.

string
Allowed values: read write
artifact_metadata

The level of permission to grant the access token to create and retrieve build artifact metadata records.

string
Allowed values: read write
attestations

The level of permission to create and retrieve the access token for repository attestations.

string
Allowed values: read write
checks

The level of permission to grant the access token for checks on code.

string
Allowed values: read write
code_quality

The level of permission to grant the access token to view and manage code quality data.

string
Allowed values: read write
codespaces

The level of permission to grant the access token to create, edit, delete, and list Codespaces.

string
Allowed values: read write
contents

The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges.

string
Allowed values: read write
dependabot_secrets

The level of permission to grant the access token to manage Dependabot secrets.

string
Allowed values: read write
deployments

The level of permission to grant the access token for deployments and deployment statuses.

string
Allowed values: read write
discussions

The level of permission to grant the access token for discussions and related comments and labels.

string
Allowed values: read write
environments

The level of permission to grant the access token for managing repository environments.

string
Allowed values: read write
issues

The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones.

string
Allowed values: read write
merge_queues

The level of permission to grant the access token to manage the merge queues for a repository.

string
Allowed values: read write
metadata

The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.

string
Allowed values: read write
packages

The level of permission to grant the access token for packages published to GitHub Packages.

string
Allowed values: read write
pages

The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds.

string
Allowed values: read write
pull_requests

The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges.

string
Allowed values: read write
repository_custom_properties

The level of permission to grant the access token to view and edit custom properties for a repository, when allowed by the property.

string
Allowed values: read write
repository_hooks

The level of permission to grant the access token to manage the post-receive hooks for a repository.

string
Allowed values: read write
repository_projects

The level of permission to grant the access token to manage repository projects, columns, and cards.

string
Allowed values: read write admin
secret_scanning_alerts

The level of permission to grant the access token to view and manage secret scanning alerts.

string
Allowed values: read write
secrets

The level of permission to grant the access token to manage repository secrets.

string
Allowed values: read write
security_events

The level of permission to grant the access token to view and manage security events like code scanning alerts.

string
Allowed values: read write
single_file

The level of permission to grant the access token to manage just a single file.

string
Allowed values: read write
statuses

The level of permission to grant the access token for commit statuses.

string
Allowed values: read write
vulnerability_alerts

The level of permission to grant the access token to manage Dependabot alerts.

string
Allowed values: read write
workflows

The level of permission to grant the access token to update GitHub Actions workflow files.

string
Allowed values: write
custom_properties_for_organizations

The level of permission to grant the access token to view and edit custom properties for an organization, when allowed by the property.

string
Allowed values: read write
members

The level of permission to grant the access token for organization teams and members.

string
Allowed values: read write
organization_administration

The level of permission to grant the access token to manage access to an organization.

string
Allowed values: read write
organization_custom_roles

The level of permission to grant the access token for custom repository roles management.

string
Allowed values: read write
organization_custom_org_roles

The level of permission to grant the access token for custom organization roles management.

string
Allowed values: read write
organization_custom_properties

The level of permission to grant the access token for repository custom properties management at the organization level.

string
Allowed values: read write admin
organization_copilot_seat_management

The level of permission to grant the access token for managing access to GitHub Copilot for members of an organization with a Copilot Business subscription. This property is in public preview and is subject to change.

string
Allowed values: read write
organization_copilot_agent_settings

The level of permission to grant the access token to view and manage Copilot cloud agent settings for an organization.

string
Allowed values: read write
organization_announcement_banners

The level of permission to grant the access token to view and manage announcement banners for an organization.

string
Allowed values: read write
organization_events

The level of permission to grant the access token to view events triggered by an activity in an organization.

string
Allowed values: read
organization_hooks

The level of permission to grant the access token to manage the post-receive hooks for an organization.

string
Allowed values: read write
organization_personal_access_tokens

The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization.

string
Allowed values: read write
organization_personal_access_token_requests

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.

string
Allowed values: read write
organization_plan

The level of permission to grant the access token for viewing an organization’s plan.

string
Allowed values: read
organization_projects

The level of permission to grant the access token to manage organization projects and projects public preview (where available).

string
Allowed values: read write admin
organization_packages

The level of permission to grant the access token for organization packages published to GitHub Packages.

string
Allowed values: read write
organization_secrets

The level of permission to grant the access token to manage organization secrets.

string
Allowed values: read write
organization_self_hosted_runners

The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization.

string
Allowed values: read write
organization_user_blocking

The level of permission to grant the access token to view and manage users blocked by the organization.

string
Allowed values: read write
email_addresses

The level of permission to grant the access token to manage the email addresses belonging to a user.

string
Allowed values: read write
followers

The level of permission to grant the access token to manage the followers belonging to a user.

string
Allowed values: read write
git_ssh_keys

The level of permission to grant the access token to manage git SSH keys.

string
Allowed values: read write
gpg_keys

The level of permission to grant the access token to view and manage GPG keys belonging to a user.

string
Allowed values: read write
interaction_limits

The level of permission to grant the access token to view and manage interaction limits on a repository.

string
Allowed values: read write
profile

The level of permission to grant the access token to manage the profile settings belonging to a user.

string
Allowed values: write
starring

The level of permission to grant the access token to list and manage repositories a user is starring.

string
Allowed values: read write
enterprise_custom_properties_for_organizations

The level of permission to grant the access token for organization custom properties management at the enterprise level.

string
Allowed values: read write admin
repository_selection
required

Describe whether all repositories have been selected or there’s a selection involved

string
Allowed values: all selected
single_file_name
required
string
nullable
has_multiple_single_files
boolean
single_file_paths
Array<string>
repositories_url
required
string format: uri
account
required
Simple User

A GitHub user.

object
name
string
nullable
email
string
nullable
login
required
string
id
required
integer format: int64
node_id
required
string
avatar_url
required
string format: uri
gravatar_id
required
string
nullable
url
required
string format: uri
html_url
required
string format: uri
followers_url
required
string format: uri
following_url
required
string
gists_url
required
string
starred_url
required
string
subscriptions_url
required
string format: uri
organizations_url
required
string format: uri
repos_url
required
string format: uri
events_url
required
string
received_events_url
required
string format: uri
type
required
string
site_admin
required
boolean
starred_at
string
user_view_type
string
expires_at
required
string format: date-time
nullable
Examples
Example default
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo",
"user"
],
"token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
"token_last_eight": "Ae178B4a",
"hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
"app": {
"url": "https://example.com",
"name": "my github app",
"client_id": "Iv1.8a61f9b3a7aba766"
},
"note": "optional note",
"note_url": "http://optional/note/url",
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"fingerprint": "jklmnop12345678",
"expires_at": "2011-09-08T17:26:27Z",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
}

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}