{"openapi":"3.1.0","info":{"title":"POST /api/v1/invoices/match","version":"1.0.0","description":"Trigger payment matching"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/invoices/match":{"post":{"tags":["invoices"],"summary":"Trigger payment matching","description":"Run the payment matching engine to find likely bank transactions for open invoices. When auto_match is true, high-confidence matches (>= 0.85) are auto-linked; otherwise all matches are surfaced as suggestions.","operationId":"trigger_matching_api_v1_invoices_match_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":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/MatchTriggerRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchTriggerResponse"}}}},"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"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"MatchTriggerRequest":{"properties":{"min_confidence":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Min Confidence","description":"Minimum confidence threshold.  Defaults to 0.50 (the 'suggest' threshold)."},"auto_match":{"type":"boolean","title":"Auto Match","description":"If true, automatically accept high-confidence matches (>= 0.85)","default":false},"invoice_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Invoice Ids","description":"Limit matching to specific invoices (by UUID).  If omitted, scans all open / partially_paid invoices."}},"type":"object","title":"MatchTriggerRequest","description":"Request schema for triggering the invoice payment matching engine.\n\nWhen called with no parameters, scans all unallocated income\ntransactions against all open invoices for the business.\n\nWhen ``auto_match`` is ``false`` (the default), every match is stored\nas a pending suggestion for manual review.  When ``true``, high-confidence\nmatches (>= 0.85) are linked automatically as ``InvoicePayment`` records.","example":{"auto_match":false,"min_confidence":0.5}},"MatchTriggerResponse":{"properties":{"suggestions_created":{"type":"integer","title":"Suggestions Created","description":"Number of new suggestions persisted."},"auto_linked":{"type":"integer","title":"Auto Linked","description":"Number of high-confidence matches auto-linked."},"total_candidates":{"type":"integer","title":"Total Candidates","description":"Total candidates evaluated by the engine."}},"type":"object","required":["suggestions_created","auto_linked","total_candidates"],"title":"MatchTriggerResponse","description":"Response from triggering the matching engine."},"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":[]}]}