{"openapi":"3.1.0","info":{"title":"POST /api/v1/oauth2/exchange","version":"1.0.0","description":"Exchange Code"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/oauth2/exchange":{"post":{"tags":["oauth"],"summary":"Exchange Code","description":"Exchange a single-use code or refresh token for access + refresh tokens.\n\nCalled from the SPA — no client credentials required.\nThe code was already authenticated when created via POST /oauth2/token.\n\n**Code exchange:** Provide ``code`` from the /token response.\n**Token refresh:** Provide ``refresh_token`` from a previous exchange.","operationId":"exchange_code_api_v1_oauth2_exchange_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_exchange_code_api_v1_oauth2_exchange_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_exchange_code_api_v1_oauth2_exchange_post":{"properties":{"code":{"type":"string","title":"Code","description":"Single-use authorization code"},"refresh_token":{"type":"string","title":"Refresh Token","description":"Refresh token for renewal"}},"type":"object","title":"Body_exchange_code_api_v1_oauth2_exchange_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"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)"}},"type":"object","required":["access_token","expires_in"],"title":"OAuthTokenResponse","description":"Token Response.\n\nReturned after successful token or refresh request."},"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":[]}]}