Skip to content

Create Token

POST
/auth/tokens
curl --request POST \
--url https://example.com/auth/tokens \
--header 'Content-Type: application/json' \
--data '{ "expires_in_days": 1, "name": "example", "scope": "read" }'

Create a long-lived personal access token.

The raw token is returned only in this response — it is never stored or shown again. Store it securely.

Media typeapplication/json
PersonalAccessTokenCreate
object
expires_in_days
Any of:
integer
>= 1 <= 3650
name
required
Name
string
>= 1 characters <= 128 characters
scope
Scope
string
default: write
Allowed values: read write

Successful Response

Media typeapplication/json
PersonalAccessTokenCreated

Returned only at creation time — the only point the raw token is visible.

object
created_at
required
Created At
string format: date-time
expires_at
required
Any of:
string format: date-time
id
required
Id
string format: uuid
last_used_at
required
Any of:
string format: date-time
name
required
Name
string
scope
required
Scope
string
Allowed values: read write
token
required
Token
string
Example
{
"scope": "read"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}