Create an API token
POST
/api/v1/api_tokens
const url = 'https://example.com/api/v1/api_tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', '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/api/v1/api_tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expires_in_days": 1, "name": "example" }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
expires_in_days
integer | null format: int64
name
required
string
Example generated
{ "expires_in_days": 1, "name": "example"}Responses
Section titled “Responses”Token created
Media typeapplication/json
object
created_at
required
string format: date-time
expires_at
string | null format: date-time
id
required
string format: uuid
last_used_at
string | null format: date-time
name
required
string
token
required
string
token_prefix
required
string
Example generated
{ "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", "token_prefix": "example"}Authentication required
Media typeapplication/json
object
error
required
string
Example generated
{ "error": "example"}OAuth credentials cannot create API tokens
Media typeapplication/json
object
error
required
string
Example generated
{ "error": "example"}Validation failed
Media typeapplication/json
object
error
required
string
Example generated
{ "error": "example"}