Skip to content

Latest commit

 

History

History
218 lines (138 loc) · 8.05 KB

scopeToken.md

File metadata and controls

218 lines (138 loc) · 8.05 KB
name example route scope type
Create a scoped access token
octokit.apps.scopeToken({ client_id })
POST /applications/{client_id}/token/scoped
apps
API method

Create a scoped access token

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

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

Parameters

name required description
client_idyes

The client ID of your GitHub app.

access_tokenno

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

targetno

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

target_idno

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

repositoriesno

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

repository_idsno

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

permissionsno

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

permissions.actionsno

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

permissions.administrationno

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

permissions.checksno

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

permissions.content_referencesno

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

permissions.contentsno

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

permissions.deploymentsno

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

permissions.environmentsno

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

permissions.issuesno

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

permissions.metadatano

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

permissions.packagesno

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

permissions.pagesno

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

permissions.pull_requestsno

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

permissions.repository_hooksno

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

permissions.repository_projectsno

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

permissions.secret_scanning_alertsno

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

permissions.secretsno

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

permissions.security_eventsno

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

permissions.single_fileno

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

permissions.statusesno

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

permissions.vulnerability_alertsno

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

permissions.workflowsno

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

permissions.membersno

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

permissions.organization_administrationno

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

permissions.organization_hooksno

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

permissions.organization_planno

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

permissions.organization_projectsno

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

permissions.organization_secretsno

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

permissions.organization_self_hosted_runnersno

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

permissions.organization_user_blockingno

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

permissions.team_discussionsno

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

See also: GitHub Developer Guide documentation.