{"openapi":"3.1.0","info":{"title":"POST /api/v1/advisory-firms/{firm_id}/settlements","version":"1.0.0","description":"Record an intercompany settlement (netting entry)"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/advisory-firms/{firm_id}/settlements":{"post":{"tags":["intercompany-cleanup"],"summary":"Record an intercompany settlement (netting entry)","description":"Books a netting journal entry in each entity (debit due-to / credit due-from) after the repayment transfer has been matched, and marks the pair's open eliminations as posted. Refuses to net more than both gross balances support.","operationId":"record_settlement_api_v1_advisory_firms__firm_id__settlements_post","parameters":[{"name":"firm_id","in":"path","required":true,"schema":{"type":"string","title":"Firm Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordSettlementRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_RecordSettlementResponse_"}}}},"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 - Invalid data format","content":{"application/json":{"example":{"detail":[{"loc":["body","field"],"msg":"field required","type":"value_error.missing"}]}}}}}}}},"components":{"schemas":{"RecordSettlementRequest":{"properties":{"payer_business_id":{"type":"string","title":"Payer Business Id"},"payee_business_id":{"type":"string","title":"Payee Business Id"},"amount_cents":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount Cents"},"settlement_date":{"type":"string","format":"date","title":"Settlement Date"},"memo":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Memo"}},"type":"object","required":["payer_business_id","payee_business_id","amount_cents","settlement_date"],"title":"RecordSettlementRequest"},"RecordSettlementResponse":{"properties":{"journal_entry_ids":{"additionalProperties":{"type":"string"},"type":"object","title":"Journal Entry Ids","description":"Netting JE per business id"},"eliminations_posted":{"type":"integer","title":"Eliminations Posted"},"amount_cents":{"type":"integer","title":"Amount Cents"}},"type":"object","required":["eliminations_posted","amount_cents"],"title":"RecordSettlementResponse"},"SuccessEnvelope_RecordSettlementResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/RecordSettlementResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[RecordSettlementResponse]"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}