{"openapi":"3.1.0","info":{"title":"POST /api/v1/fx/revalue","version":"1.0.0","description":"Post FX revaluation"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/fx/revalue":{"post":{"tags":["fx-rates"],"summary":"Post FX revaluation","description":"Revalue open foreign AR/AP and post the adjusting JE.","operationId":"fx_revalue_api_v1_fx_revalue_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/FxRevaluationRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FxRevaluationResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"FxCurrencyExposure":{"properties":{"currency":{"type":"string","title":"Currency"},"receivable_foreign":{"type":"integer","title":"Receivable Foreign","description":"Open AR balance in the foreign currency (cents).","default":0},"payable_foreign":{"type":"integer","title":"Payable Foreign","description":"Open AP balance in the foreign currency (cents).","default":0},"booked_rate":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Booked Rate"},"current_rate":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Current Rate"},"receivable_gain_loss":{"type":"integer","title":"Receivable Gain Loss","description":"AR revaluation gain(+)/loss(-) in base cents.","default":0},"payable_gain_loss":{"type":"integer","title":"Payable Gain Loss","description":"AP revaluation gain(+)/loss(-) in base cents.","default":0},"net_gain_loss":{"type":"integer","title":"Net Gain Loss","description":"Net gain(+)/loss(-) in base cents.","default":0}},"type":"object","required":["currency"],"title":"FxCurrencyExposure","description":"Per-currency open AR/AP exposure and computed gain/loss (cents)."},"FxRevaluationRequest":{"properties":{"as_of_date":{"type":"string","format":"date","title":"As Of Date"},"post":{"type":"boolean","title":"Post","description":"Post the adjusting JE (false = preview only).","default":true}},"type":"object","required":["as_of_date"],"title":"FxRevaluationRequest","description":"Trigger a revaluation as of a date; optionally post the JE."},"FxRevaluationResponse":{"properties":{"as_of_date":{"type":"string","format":"date","title":"As Of Date"},"base_currency":{"type":"string","title":"Base Currency"},"exposures":{"items":{"$ref":"#/components/schemas/FxCurrencyExposure"},"type":"array","title":"Exposures"},"total_gain_loss":{"type":"integer","title":"Total Gain Loss","description":"Net unrealized FX gain(+)/loss(-) in base cents.","default":0},"journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Journal Entry Id","description":"Posted adjusting JE id (null for a preview)."},"posted":{"type":"boolean","title":"Posted","default":false}},"type":"object","required":["as_of_date","base_currency","exposures"],"title":"FxRevaluationResponse","description":"Result/preview of an FX revaluation as of a date."},"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":[]}]}