{"openapi":"3.1.0","info":{"title":"GET /api/v1/credit/notifications","version":"1.0.0","description":"List in-app notifications across lines"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/notifications":{"get":{"tags":["credit"],"summary":"List in-app notifications across lines","description":"Every line's in-app notifications on the business, newest first, cursor-paged. Narrow with `program_id` or `credit_line_id`; `unread_count` is the unread total in that scope.","operationId":"list_credit_notifications","parameters":[{"name":"program_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Only this program's lines.","title":"Program Id"},"description":"Only this program's lines."},{"name":"credit_line_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Only this line.","title":"Credit Line Id"},"description":"Only this line."},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Only these kinds, comma-separated: due_soon, past_due, loan_paid, statement_issued, limit_changed, collections. An unknown one is `400` `CREDIT_816`.","title":"Kind"},"description":"Only these kinds, comma-separated: due_soon, past_due, loan_paid, statement_issued, limit_changed, collections. An unknown one is `400` `CREDIT_816`."},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Only notifications created at or after this time (UTC).","title":"Since"},"description":"Only notifications created at or after this time (UTC)."},{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean","description":"Only notifications neither read nor dismissed.","default":false,"title":"Unread Only"},"description":"Only notifications neither read nor dismissed."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Page size.","default":50,"title":"Limit"},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`next_cursor` from the previous page.","title":"Cursor"},"description":"`next_cursor` from the previous 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_CreditNotificationPage_"}}}},"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":"list_credit_notifications_api_v1_credit_notifications_get"}}},"components":{"schemas":{"CreditNotificationPage":{"properties":{"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Pass back as `cursor` for the next page. Null on the last."},"has_next":{"type":"boolean","title":"Has Next","description":"Another page follows. Looked up one row past the page, so a full last page is not reported as more.","default":false},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"The page size the list was read with."},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Row count; present only with `include_total_count=true`."},"items":{"items":{"$ref":"#/components/schemas/CreditNotificationResponse"},"type":"array","title":"Items","description":"Notifications, newest first."},"unread_count":{"type":"integer","title":"Unread Count","description":"Unread, undismissed notifications in the list's scope (the line, or with `credit_line_id`/`program_id` that one), whatever `kind`, `since` and `unread_only` say. For a badge.","default":0}},"type":"object","title":"CreditNotificationPage","description":"A page of notifications, newest first."},"CreditNotificationResponse":{"properties":{"id":{"type":"string","title":"Id","description":"The notification's id."},"credit_line_id":{"type":"string","title":"Credit Line Id","description":"The line it is about."},"external_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Line Id","description":"The line's `external_line_id`, as opened."},"program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Id","description":"The line's program."},"event_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Id","description":"The credit event that triggered it (e.g. `credit.loan.due_soon`). Null for a collections notification."},"kind":{"type":"string","title":"Kind","description":"due_soon, past_due, loan_paid, statement_issued, limit_changed or collections: the same kinds as the notice emails."},"severity":{"type":"string","enum":["info","warning","critical"],"title":"Severity","description":"info (a statement, a loan paid, a limit raised), warning (a payment due soon, a statement due the day it is issued, a limit lowered) or critical (a payment past due, a collections stage)."},"title":{"type":"string","title":"Title","description":"A short headline in the merchant's words."},"body":{"type":"string","title":"Body","description":"The full message, plain text, in the lender's name and with amounts and dates written out: the same words as the notice email."},"action":{"anyOf":[{"type":"string","enum":["pay","view_statement","view_transactions","view_credit_line"]},{"type":"null"}],"title":"Action","description":"What the merchant can do about it: pay, view_statement (open `cycle_id`), view_transactions (open `loan_id`), or view_credit_line."},"amount_due_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Due Cents","description":"The amount the notification is about: outstanding on the loan (due_soon, past_due), the statement balance (statement_issued), or the amount past due (collections). Null otherwise."},"due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Due Date","description":"The loan's due date (due_soon, past_due), the statement's due date (statement_issued), or the oldest past-due date (collections)."},"cycle_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cycle Id","description":"The statement it is about (`GET .../statements/{cycle_id}`)."},"loan_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Loan Id","description":"The loan it is about."},"detail":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Detail","description":"Every figure it quotes, as the notice email's `detail`; `due_on_issue` is true on a statement due the day it was issued."},"dedup_key":{"type":"string","title":"Dedup Key","description":"Stable key of the decision: `event:<event id>`, or `collections:<line>:<stage>:<entered on>`. The notice email for the same decision has the same key."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When it was decided (UTC)."},"read_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Read At","description":"When the partner marked it read. Null: unread."},"dismissed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Dismissed At","description":"When the partner dismissed it. Null: not dismissed."}},"type":"object","required":["id","credit_line_id","kind","severity","title","body","dedup_key","created_at"],"title":"CreditNotificationResponse","description":"One in-app notification for a merchant."},"SuccessEnvelope_CreditNotificationPage_":{"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/CreditNotificationPage"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CreditNotificationPage]"},"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":[]}]}