{"openapi":"3.1.0","info":{"title":"POST /api/v1/credit/card-settlements","version":"1.0.0","description":"Ingest cleared card settlements"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/card-settlements":{"post":{"tags":["credit"],"summary":"Ingest cleared card settlements","description":"Push settled card transactions. Settlements only, never authorisations. Idempotent on the settlement ID, so re-pushing a batch reports duplicates rather than double-counting. A negative amount is a refund.","operationId":"ingest_card_settlements_api_v1_credit_card_settlements_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/CardSettlementIngestRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CardSettlementIngestResponse_"}}}},"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":{"CardSettlementIngestItem":{"properties":{"external_settlement_id":{"type":"string","maxLength":128,"title":"External Settlement Id","description":"Issuer settlement ID. The idempotency key."},"settled_on":{"type":"string","format":"date","title":"Settled On","description":"Clearing date. Assigns the settlement to a cycle (§10.5)."},"amount_cents":{"type":"integer","title":"Amount Cents","description":"Signed: positive is a purchase, negative a refund."},"merchant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Name"},"card_last_four":{"anyOf":[{"type":"string","maxLength":4},{"type":"null"}],"title":"Card Last Four"},"merchant_category_code":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"title":"Merchant Category Code"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"additionalProperties":false,"type":"object","required":["external_settlement_id","settled_on","amount_cents"],"title":"CardSettlementIngestItem","description":"One cleared card transaction.\n\nSettlements only, never authorisations (§13.1). A negative amount is\nan ad-platform refund (§10.7)."},"CardSettlementIngestRequest":{"properties":{"credit_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Line Id","description":"Target line. Omit when using external_line_id."},"external_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Line Id"},"settlements":{"items":{"$ref":"#/components/schemas/CardSettlementIngestItem"},"type":"array","maxItems":1000,"minItems":1,"title":"Settlements"}},"additionalProperties":false,"type":"object","required":["settlements"],"title":"CardSettlementIngestRequest","description":"Push a batch of settlements (§14, call 3)."},"CardSettlementIngestResponse":{"properties":{"credit_line_id":{"type":"string","title":"Credit Line Id"},"accepted":{"type":"integer","title":"Accepted"},"duplicates":{"type":"integer","title":"Duplicates"},"rejected":{"type":"integer","title":"Rejected"},"results":{"items":{"$ref":"#/components/schemas/SettlementAcknowledgement"},"type":"array","title":"Results"}},"type":"object","required":["credit_line_id","accepted","duplicates","rejected","results"],"title":"CardSettlementIngestResponse","description":"Acknowledgement and cycle assignment, idempotent on settlement ID."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SettlementAcknowledgement":{"properties":{"external_settlement_id":{"type":"string","title":"External Settlement Id"},"settlement_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Settlement Id"},"cycle_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cycle Id"},"cycle_period_start":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Cycle Period Start"},"status":{"type":"string","enum":["accepted","duplicate","rejected"],"title":"Status"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["external_settlement_id","status"],"title":"SettlementAcknowledgement","description":"Per-settlement result of an ingest."},"SuccessEnvelope_CardSettlementIngestResponse_":{"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/CardSettlementIngestResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CardSettlementIngestResponse]"},"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":[]}]}