Skip to content

POST /token/{profile}

The POST /token/{profile} (and legacy POST /token) endpoints vend short-lived GitHub installation tokens validated against Buildkite OIDC tokens.

The profile parameter selects the pipeline profile that will be used when creating the token using permissions defined by the specified pipeline profile.

The reserved profile name default is always available. The default profile can be requested via POST /token/default or POST /token. Permissions for the default profile can be changed but match rules cannot be added.

This endpoint returns GitHub installation tokens in JSON format. Use /token when you need token metadata, are making direct API calls, or want more flexible response handling.

For Git credential helper integration, use the POST /git-credentials endpoint instead, which returns tokens in Git’s credential helper format.

HeaderRequiredDescription
AuthorizationYesBearer token containing Buildkite OIDC JWT
Content-TypeYesMust be application/json

The optional {profile} path parameter specifies which pipeline profile to use:

  • /token (no parameter): Uses pipeline default permissions
  • /token/default: Same as /token (explicitly requests default permissions)
  • /token/{profile-name}: Uses the named pipeline profile

Profile names are used directly in the path. The API does not use prefixes (prefixes like pipeline: are part of the plugin interface only).

Examples:

  • POST /token → default pipeline permissions
  • POST /token/pr-commenter → “pr-commenter” pipeline profile
  • POST /token/release → “release” pipeline profile

If the profile does not exist or the pipeline doesn’t match the profile’s access rules, the request returns an error.

The request body is expected to be empty.

When a token is successfully vended, the response is a JSON object:

{
"organizationSlug": "my-org",
"profile": "org:default",
"repositoryUrl": "https://github.com/owner/repository",
"repositories": ["owner/repository"],
"permissions": ["metadata:read", "contents:read"],
"token": "ghs_...",
"expiry": "2025-12-21T10:00:00Z"
}
FieldTypeDescription
organizationSlugstringBuildkite organization from JWT claims
profilestringProfile identifier that was used
repositoryUrlstringThe requested repository URL: this will always be empty
repositoriesarrayList of repository names the token has access to (format: owner/repo)
permissionsarrayPermissions granted. Always includes metadata:read plus configured permissions.
tokenstringGitHub installation token (format: ghs_...)
expirystringISO 8601 timestamp when token expires
Status codeCondition
401 UnauthorizedMissing or invalid JWT
403 ForbiddenPipeline doesn’t match profile’s access rules
404 Not FoundProfile does not exist or failed validation
413 Request Entity Too LargeRequest body exceeds 20 KB
500 Internal Server ErrorToken vending failure, Buildkite API error, or GitHub API error