Create token

POST /api/v1/tokens

Create a new API token

Operation ID: create_token_api_v1_tokens_post · View as markdown · OpenAPI slice

Authentication

Bearer token authentication. Pass your DayZero API token in the Authorization header and the target business UUID in x-business-id.

Request body

name string required

Token name

description string

Optional description

expires_in_days integer

Expiration in days (1-365, default: 365)

Responses

201 Successful Response

token string required

The JWT token - save it now, you won't see it again!

token_info APITokenResponse requiredAPITokenResponse

Token metadata

11 fields
id string required

Token record ID

jti string required

Unique token identifier (JWT ID)

name string

Human-readable token name

description string

Optional token description

token_prefix string required

First characters of the token for display (e.g. dz_abc...)

token_type string

Token type (always 'api')

created_at string · date-time required

When the token was created

last_used_at string · date-time

Last time the token was used for authentication

expires_at string · date-time

When the token expires (null = never)

revoked_at string · date-time

When the token was revoked (null = active)

revocation_reason string

Reason the token was revoked

400 Bad Request - Invalid input

401 Unauthorized - Authentication required

403 Forbidden - Insufficient permissions

422 Validation Error

detail array · ValidationError ValidationError
5 fields
loc array · string | integer required
msg string required
type string required
input object
ctx object