Issue a new API token
POST /auth/tokens
POST
/auth/tokens
Creates a Personal Access Token bound to the caller. The token value is returned in the response once and only once — it is hashed in the database and cannot be recovered later. Lose it, revoke and re-issue.
Token creation is restricted to cookie-authenticated callers, so a stolen token cannot mint further tokens.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
name
required
string
Example
CI deploy bot expires_at
string format: date-time
scopes
Capability codes this token may exercise. Empty array means the token can do whatever the user can do. (Token scopes are recorded but not yet enforced.)
Array<string>
Responses
Section titled “ Responses ”Token issued. The plaintext token is in the token field of the response.
object
id
required
string format: uuid
name
required
string
scopes
required
Array<string>
created_at
required
string format: date-time
expires_at
string format: date-time
last_used_at
string format: date-time
token
required
The plaintext token. Save it — it is never returned again.
string
Example
aa_pat_K7eHs0bdQ9XR8h0g7y4mR0aZ2lY1pX5NMalformed request
object
error
required
Human-readable error summary
string
Example
the request could not be completedAuthentication required, missing, or invalid
object
error
required
Human-readable error summary
string
Example
the request could not be completedExample
{ "error": "authentication required: sign in and retry with a valid session or API token"}