Workspace tokens

A workspace token is a bearer credential that acts inside one workspace, within its scopes, for the resource API and the Terraform provider. It is issued through the resource API, which the web app's Tokens page calls. It has no Terraform resource and is not part of an export.

KindEndpointTerraformAddress
workspace-token/api/resources/workspaces/{workspaceId}/tokensnone<name>

See Resource API for the operations, headers and errors every kind shares.

Example

{
  "name": "ci",
  "description": "Plans the platform repository on every pull request",
  "scopes": ["plan"],
  "expiresAt": "2026-12-31T23:59:59Z"
}

Endpoints

OperationEndpointDescription
issue (create)POST /api/resources/workspaces/{workspaceId}/tokensNeeds Idempotency-Key. Returns 201 and the token's value in the Spotlight-Workspace-Token response header.
readGET /api/resources/tokens/{id}Never returns the value.
describe (update)PUT /api/resources/tokens/{id}Changes description only. Needs If-Match.
revoke (delete)DELETE /api/resources/tokens/{id}The token admits nobody from this moment. Needs If-Match.
importGET /api/resources/workspaces/{workspaceId}/tokens/import?address=<name>
listGET /api/resources/workspaces/{workspaceId}/tokensEvery token issued by a person. Tokens minted through a workspace token trust, or for a run, are not listed.

Issuing, describing and revoking need the administer permission, which only a workspace owner or admin has, signed in as a person. No token can issue, describe or revoke a token. Reading, importing and listing need read.

Fields

FieldTypeDefaultDescription
namestringrequiredLowercase words joined by dashes, at most 64 characters. Fixed: an update that changes it is refused.
scopesarray of stringsrequiredAt least one, each once. See scopes. Fixed: an update that changes it is refused.
descriptionstring""At most 255 characters. The only field an update changes.
expiresAtstring or nullnullAn RFC 3339 time when the token stops admitting anyone. Must be in the future. Null never expires. Fixed: an update that changes it is refused.
workspaceIdstringread-onlyThe workspace the token acts in, and the only one.
issuedBystringread-onlyThe person who issued it.
issuedAtstringread-onlyWhen it was issued, as an RFC 3339 time.

Scopes

A token carries one or more of the scopes read, plan, configure, secrets, runners and trusts. See Token scopes for what each grants.

MessageCause
must include read, plan or configure. Secrets, runners and trusts need one of themNone of read, plan or configure is named.
must name each scope onceA scope is named twice.

Each is returned at the path scopes.

What no token can do

  • Administer: issue, describe or revoke tokens, change members or roles, or read the configuration changes.
  • Open a workspace. A workspace token acts only inside its own workspace.

A request a token's scopes do not allow is refused with 403 and a problem naming the missing permission. A resource the token cannot see returns 404.

Value

PropertyValue
Format32 random bytes, base64url, with no prefix.
ReturnedOnce, in the Spotlight-Workspace-Token header of the issuing response. Never again, not even to a retry with the same Idempotency-Key.
KeptAs a SHA-256 hash only.
Sent asAuthorization: Bearer <token>

A token that is revoked, or past expiresAt, is refused with 401.

On this page