Create Token
POST
/auth/tokens
const url = 'https://example.com/auth/tokens';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"expires_in_days":1,"name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/auth/tokens \ --header 'Content-Type: application/json' \ --data '{ "expires_in_days": 1, "name": "example" }'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.
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Successful Response
Media typeapplication/json
PersonalAccessTokenCreated
Returned only at creation time — the only point the raw token is visible.
object
Examplegenerated
{ "created_at": "2026-04-15T12:00:00Z", "expires_at": "2026-04-15T12:00:00Z", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "last_used_at": "2026-04-15T12:00:00Z", "name": "example", "token": "example"}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}