{"openapi":"3.1.0","info":{"title":"POST /api/v1/tokens","version":"1.0.0","description":"Create token"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/tokens":{"post":{"tags":["api-tokens"],"summary":"Create token","description":"Create a new API token","operationId":"create_token_api_v1_tokens_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APITokenCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Token Api V1 Tokens Post","$ref":"#/components/schemas/APITokenCreateResponse"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"APITokenCreate":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Token name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Optional description"},"expires_in_days":{"anyOf":[{"type":"integer","maximum":365.0,"minimum":1.0},{"type":"null"}],"title":"Expires In Days","description":"Expiration in days (1-365, default: 365)","default":365}},"type":"object","required":["name"],"title":"APITokenCreate","description":"Request schema for creating a new API token."},"APITokenCreateResponse":{"properties":{"token":{"type":"string","title":"Token","description":"The JWT token - save it now, you won't see it again!"},"token_info":{"$ref":"#/components/schemas/APITokenResponse","description":"Token metadata"}},"type":"object","required":["token","token_info"],"title":"APITokenCreateResponse","description":"Response schema when creating a new token (includes the JWT)."},"APITokenResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Token record ID"},"jti":{"type":"string","title":"Jti","description":"Unique token identifier (JWT ID)"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Human-readable token name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Optional token description"},"token_prefix":{"type":"string","title":"Token Prefix","description":"First characters of the token for display (e.g. dz_abc...)"},"token_type":{"type":"string","title":"Token Type","description":"Token type (always 'api')","default":"api"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the token was created"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At","description":"Last time the token was used for authentication"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At","description":"When the token expires (null = never)"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"When the token was revoked (null = active)"},"revocation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revocation Reason","description":"Reason the token was revoked"}},"type":"object","required":["id","jti","token_prefix","created_at"],"title":"APITokenResponse","description":"Response schema for API token metadata (without the actual JWT)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}