POST /tokens endpoint creates a new token in your workspace. You define the token’s name, the scopes it can access, and an optional expiration date. On success, the response includes the raw secret token value — this is the only time Tooken returns the secret, so you must store it securely immediately after creation.
Required scope: tokens:write
Request body
A human-readable label for the token. Maximum 100 characters. Must be unique within your workspace — if a token with the same name already exists, the request returns
409 conflict.An array of permission scopes to grant to the token. At least one scope is required. Available scopes include
tokens:read, tokens:write, and tokens:revoke. Granting only the scopes your use case needs is strongly recommended.An ISO 8601 datetime string specifying when the token should expire (for example,
2027-01-15T09:00:00Z). If you omit this field, the token never expires. Tokens past their expires_at time automatically transition to expired status and can no longer authenticate requests.Request
Response
A successful request returns201 Created with the full token object, including the secret value.
The unique identifier for the newly created token. Format:
tok_a1b2c3d4e5f6g7h8i9j0k1l2.The raw secret token value. Use this as your
Authorization: Bearer credential. This field is only present on creation — Tooken does not store or return the plaintext secret again after this response.The name you assigned to the token.
The list of scopes granted to the token.
The initial status of the token. Always
active on creation.ISO 8601 datetime when the token was created.
ISO 8601 datetime when the token expires, or
null if no expiration was set.Always
null on a newly created token.The email address of the workspace member whose API key was used to create this token.
Example response
The
token field in the response is the only time Tooken returns the plaintext secret. Copy it immediately and store it in a secrets manager or environment variable. Once this response is gone, the secret cannot be retrieved — you would need to revoke the token and create a new one.