{"openapi":"3.1.0","info":{"title":"POST /api/v1/payment-suggestions/bulk-accept","version":"1.0.0","description":"Bulk accept payment suggestions"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/payment-suggestions/bulk-accept":{"post":{"tags":["automation-review"],"summary":"Bulk accept payment suggestions","description":"Accept many pending invoice (deposit -> invoice) or bill (payment -> bill) match suggestions at once: the `suggestion_ids` you name, or every pending suggestion at or above `min_confidence` (default 0.85), optionally for one customer / vendor (`party_id`) and a bank-transaction date range. Each accept is isolated, so a bad row never loses the rest (`results` lists every one). The batch is one `payment_match` automation run: undo it with `POST /automation-runs/{run_id}/undo`. `dry_run` lists what would be accepted.","operationId":"bulk_accept_payment_suggestions","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/BulkAcceptPaymentSuggestionsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BulkAcceptPaymentSuggestionsResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"bulk_accept_payment_suggestions_api_v1_payment_suggestions_bulk_accept_post"}}},"components":{"schemas":{"BulkAcceptPaymentSuggestionsRequest":{"properties":{"kind":{"type":"string","enum":["invoice","bill"],"title":"Kind","description":"invoice = deposits matched to invoices, bill = payments to bills"},"suggestion_ids":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":200},{"type":"null"}],"title":"Suggestion Ids","description":"Accept exactly these suggestions (the filter is then ignored)"},"min_confidence":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.5},{"type":"null"}],"title":"Min Confidence","description":"Filter: lowest confidence to accept (default 0.85)"},"party_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Party Id","description":"Filter: one customer (invoice) or vendor (bill)"},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date","description":"Filter: earliest bank-transaction date"},"end_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date","description":"Filter: latest bank-transaction date"},"limit":{"type":"integer","maximum":200.0,"minimum":1.0,"title":"Limit","default":200},"dry_run":{"type":"boolean","title":"Dry Run","description":"List what would be accepted; change nothing","default":false},"plan_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Hash","description":"plan_hash of the dry run; refused if the suggestions moved since"}},"type":"object","required":["kind"],"title":"BulkAcceptPaymentSuggestionsRequest","description":"Accept many pending payment suggestions: named ids, or a filter."},"BulkAcceptPaymentSuggestionsResponse":{"properties":{"kind":{"type":"string","title":"Kind"},"dry_run":{"type":"boolean","title":"Dry Run","default":false},"accepted":{"type":"integer","title":"Accepted","default":0},"would_accept":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Would Accept"},"amount_total_cents":{"type":"integer","title":"Amount Total Cents","default":0},"has_more":{"type":"boolean","title":"Has More","description":"The filter matched more rows than limit","default":false},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id","description":"Automation run; undo with POST /automation-runs/{run_id}/undo"},"suggestions":{"items":{"$ref":"#/components/schemas/PaymentSuggestionBulkRow"},"type":"array","title":"Suggestions","description":"Dry-run plan (first 25)"},"results":{"items":{"$ref":"#/components/schemas/PaymentSuggestionBulkRow"},"type":"array","title":"Results","description":"Per-row outcome (first 100)"},"failed":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Failed"},"plan_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Hash","description":"Digest of the dry-run plan; pass it to apply"}},"additionalProperties":true,"type":"object","required":["kind"],"title":"BulkAcceptPaymentSuggestionsResponse","description":"What a bulk accept did (or, on a dry run, would do)."},"PaymentSuggestionBulkRow":{"properties":{"suggestion_id":{"type":"string","title":"Suggestion Id"},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Number"},"amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Cents"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"status":{"anyOf":[{"type":"string","enum":["accepted","failed"]},{"type":"null"}],"title":"Status"},"payment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["suggestion_id"],"title":"PaymentSuggestionBulkRow","description":"One suggestion a bulk accept planned or tried."},"SuccessEnvelope_BulkAcceptPaymentSuggestionsResponse_":{"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/BulkAcceptPaymentSuggestionsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BulkAcceptPaymentSuggestionsResponse]"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}