{"openapi":"3.1.0","info":{"title":"POST /api/v1/oauth2/token","version":"1.0.0","description":"Get Token"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/oauth2/token":{"post":{"tags":["oauth"],"summary":"Get Token","description":"Issue OAuth access + refresh tokens for a user.\n\nReturns standard ``access_token`` / ``refresh_token`` as Bearer\ncredentials for all subsequent API calls.\n\nSEC-031: the grant names a user by email and proves nothing about that\nperson, so it never issues tokens for a DayZero superuser (403\n``AUTH_093``) or an inactive account, and the route answers 404 unless\nenabled (``OAUTH_TOKEN_ENDPOINT_ENABLED``; by default only when\n``OAUTH_CLIENT_SECRET`` is configured).","operationId":"get_token","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_get_token_api_v1_oauth2_token_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_token_api_v1_oauth2_token_post"}}},"components":{"schemas":{"Body_get_token_api_v1_oauth2_token_post":{"properties":{"user_email":{"type":"string","title":"User Email","description":"User's email address"},"client_id":{"type":"string","title":"Client Id","description":"OAuth client identifier"},"timestamp":{"type":"string","title":"Timestamp","description":"Unix epoch seconds for HMAC freshness"},"nonce":{"type":"string","title":"Nonce","description":"Single-use nonce for replay protection"},"signature":{"type":"string","title":"Signature","description":"HMAC-SHA256 hex signature"}},"type":"object","required":["user_email","client_id","timestamp","nonce","signature"],"title":"Body_get_token_api_v1_oauth2_token_post"},"OAuthTokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token","description":"The access token (JWT)"},"token_type":{"type":"string","title":"Token Type","description":"Token type (always 'Bearer')","default":"Bearer"},"expires_in":{"type":"integer","title":"Expires In","description":"Access token lifetime in seconds"},"refresh_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refresh Token","description":"Refresh token for obtaining new access tokens"},"scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope","description":"Granted scope (may differ from requested)"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"MCP grants bound to one business: that business's id. Absent when the grant reaches every business the user can."},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name","description":"MCP grants bound to one business: that business's name"}},"type":"object","required":["access_token","expires_in"],"title":"OAuthTokenResponse","description":"Token Response.\n\nReturned after successful token or refresh request."},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}