Skip to content

POST /token

The POST /token endpoint vends short-lived GitHub installation tokens validated against Buildkite OIDC tokens. The endpoint operates in two modes: default mode (automatic pipeline repository detection) and profile mode (custom permission scopes and multi-repository access).

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 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": ["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 (e.g., ["contents:read", "packages:write"])
tokenstringGitHub installation token (format: ghs_...)
expirystringISO 8601 timestamp when token expires
Status codeCondition
401 UnauthorizedMissing or invalid JWT
413 Request Entity Too LargeRequest body exceeds 20 KB
500 Internal Server ErrorToken vending failure, profile not found, or GitHub API error