{"openapi":"3.1.0","info":{"title":"GET /api/v1/credit/adverse-actions","version":"1.0.0","description":"List adverse actions"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/adverse-actions":{"get":{"tags":["credit"],"summary":"List adverse actions","description":"Adverse actions, soonest due first, with their reasons, due date and notice status. Filter by `status`, `due_before` (on or before) and `credit_line_id`.","operationId":"credit_list_adverse_actions","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["pending","sent","waived","not_required"],"type":"string"},{"type":"null"}],"description":"One status.","title":"Status"},"description":"One status."},{"name":"due_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Due on or before this date.","title":"Due Before"},"description":"Due on or before this date."},{"name":"credit_line_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"One line.","title":"Credit Line Id"},"description":"One line."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Adverse-action notices per page (1-500).","default":50,"title":"Limit"},"description":"Adverse-action notices per page (1-500)."},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`next_cursor` from the last page.","title":"Cursor"},"description":"`next_cursor` from the last page."},{"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"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CreditAdverseActionPage_"}}}},"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":"credit_list_adverse_actions_api_v1_credit_adverse_actions_get"}}},"components":{"schemas":{"CreditAdverseActionPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CreditAdverseActionResponse"},"type":"array","title":"Items","description":"The records."},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Pass back as `cursor`. Null on the last page."},"has_next":{"type":"boolean","title":"Has Next","description":"More pages follow.","default":false},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"The page size."}},"type":"object","title":"CreditAdverseActionPage","description":"A page of adverse actions, soonest due first."},"CreditAdverseActionResponse":{"properties":{"id":{"type":"string","title":"Id","description":"The record."},"credit_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Line Id","description":"The line; null for a declined application."},"program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Id","description":"Its program."},"subject_type":{"type":"string","title":"Subject Type","description":"`assessment`, `limit_review`, `limit_change_request` or `line_status`."},"subject_id":{"type":"string","title":"Subject Id","description":"What it was about."},"action":{"type":"string","title":"Action","description":"`declined`, `limit_decreased`, `line_suspended` or `line_closed`."},"action_on":{"type":"string","format":"date","title":"Action On","description":"The date of the action (UTC)."},"due_on":{"type":"string","format":"date","title":"Due On","description":"When the notice is due."},"reason_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason Code","description":"The status change's reason code, when one."},"reasons":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Reasons","description":"The principal reasons, each with a `sentence`."},"detail":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Detail","description":"Limits before and after, the status, and so on."},"status":{"type":"string","title":"Status","description":"`pending`, `sent`, `waived` or `not_required`."},"resolution_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolution Reason","description":"Why it was waived or found not required."},"resolved_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolved By User Id","description":"Who decided."},"resolved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resolved At","description":"When."},"template_jurisdiction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Jurisdiction","description":"The template used to send it."},"template_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Version","description":"Its version."},"pdf_sha256":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pdf Sha256","description":"SHA-256 of the notice as sent."},"sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sent At","description":"When it was sent."},"channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel","description":"`email`."},"recipient":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recipient","description":"Where it went."},"notice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notice Id","description":"The borrower notice that carried it."},"days_until_due":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days Until Due","description":"Days from today (UTC) to `due_on`; negative overdue."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When recorded."},"send_blocked_reason":{"anyOf":[{"type":"string","enum":["no_credit_line","no_merchant_email"]},{"type":"null"}],"title":"Send Blocked Reason","description":"On a pending notice in the list: why `send` would be refused (`CREDIT_614`). `no_credit_line`: a declined application has no line, so no merchant email; deliver it yourself and waive it. `no_merchant_email`: set the line's `merchant_email` first. Null when it can be sent, and on any other response."}},"type":"object","required":["id","subject_type","subject_id","action","action_on","due_on","status"],"title":"CreditAdverseActionResponse","description":"One adverse action and its notice."},"SuccessEnvelope_CreditAdverseActionPage_":{"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/CreditAdverseActionPage"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CreditAdverseActionPage]"},"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":[]}]}