EndpointsCreate an API token

API Tokens

Create an API token

Creates an API token that acts as you, optionally limited to one Workspace and to a ceiling of IAM roles. Requires a signed-in session; an API token cannot create another. The full plaintext token is returned once and never shown again - store it securely.

POST/api_tokens
Authorizationstringheaderrequired

Bearer token for the authenticated caller.

Body

application/json
namestringrequired

Human-readable name for the token

Required string length: 1 - 100

Example: "My CLI token"

expires_atinteger | null

Unix timestamp (seconds) when the token expires. Omit or pass null for no expiry.

Required range: x >= 0

Example: 1742169600

workspace_idstring | null

The only Workspace the token may act in. Omitted or null: every Workspace the person may use.

Required string length: 2 - 53

Example: "ws_j572abc123def4"

rolesstring[] | null

A ceiling of IAM roles: the token may do only what one of these roles includes, and only what the person may. Omitted or null: the rights of the person.

Required array length: 1 - 16 elements

Example: ["roles/viewer"]

Response

application/json

Token created. The token field is shown only once.

idstringrequired

API token ID.

Required string length: 3 - 54

Example: "tok_3k9x2mfq8a1b7c4d5e6f"

namestringrequired

Required string length: 1 - 100

Example: "My CLI token"

prefixstringrequired

The first 12 characters of the token, for recognizing it. Never the secret.

Example: "sk_akua_a3B2"

workspace_idstring | nullrequired

The only Workspace the token may act in. Omitted or null: every Workspace the person may use.

Required string length: 2 - 53

Example: "ws_j572abc123def4"

rolesstring[] | nullrequired

A ceiling of IAM roles: the token may do only what one of these roles includes, and only what the person may. Omitted or null: the rights of the person.

Required array length: 1 - 16 elements

Example: ["roles/viewer"]

created_atintegerrequired

Unix timestamp (seconds)

Required range: x >= 0

last_used_atinteger | nullrequired

Unix timestamp (seconds) of last use, or null if never used

Required range: x >= 0

expires_atinteger | nullrequired

Unix timestamp (seconds) when the token expires, or null if never

Required range: x >= 0

tokenstringrequired

The full token. This is shown only once - store it securely.

Example: "sk_akua_a3B2c4D5e6F7g8H9i0J1k2L3m4N5o6P73jZRME"