{"openapi":"3.1.0","info":{"title":"GET /api/v1/credit/lines/{credit_line_id}","version":"1.0.0","description":"Credit line dashboard"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/lines/{credit_line_id}":{"get":{"tags":["credit"],"summary":"Credit line dashboard","description":"Limit, current balance, available credit, utilisation in basis points, start date, term, and linked account. Available credit and utilisation are returned rather than derived so the dashboard card and the statement band cannot disagree.","operationId":"get_credit_line","parameters":[{"name":"credit_line_id","in":"path","required":true,"schema":{"type":"string","title":"Credit Line Id"}},{"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_CreditLineResponse_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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":"get_credit_line_api_v1_credit_lines__credit_line_id__get"}}},"components":{"schemas":{"CardIssuanceStatusEnum":{"type":"string","enum":["requested","active","suspended","terminated","failed"],"title":"CardIssuanceStatusEnum","description":"Lifecycle of a card we issued on a merchant's behalf.\n\nMirrors the issuer's own fund/card states so a reconciliation sweep\ncan compare ours against theirs without a translation table."},"CreditLineResponse":{"properties":{"id":{"type":"string","title":"Id"},"program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Id"},"external_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Line Id"},"external_merchant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Merchant Id"},"merchant_business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Business Id","description":"The borrower's own DayZero business, when the line is linked to one. Underwriting assessments for the line measure it."},"status":{"$ref":"#/components/schemas/CreditLineStatusEnum"},"status_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status Reason","description":"Reason given with the last status change."},"status_changed_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Status Changed On","description":"Date of the last status change (UTC)."},"suspended_via":{"anyOf":[{"type":"string","enum":["collections","operator"]},{"type":"null"}],"title":"Suspended Via","description":"Who holds a suspended line suspended: `collections` (a `suspend_line` stage of the collections ladder, which reinstates the line when the merchant catches up) or `operator` (the console or the API; only an operator reinstates it). Null when the line is not suspended, or for a suspension made before this was recorded that the record could not place, which collections never lifts."},"lending_model":{"$ref":"#/components/schemas/LendingModel","default":"per_transaction"},"credit_limit_cents":{"type":"integer","title":"Credit Limit Cents"},"current_balance_cents":{"type":"integer","title":"Current Balance Cents","description":"Total Balance: everything owed across every open loan, including transactions since the last month-end close (§7.1). Under cycle_draw programs: the sum across closed, unpaid cycles."},"total_balance_cents":{"type":"integer","title":"Total Balance Cents","description":"Same figure as current_balance_cents, by its FRD v2 name.","default":0},"statement_balance_cents":{"type":"integer","title":"Statement Balance Cents","description":"What moved onto the most recent statement at close (§7.1).","default":0},"unbilled_cents":{"type":"integer","title":"Unbilled Cents","description":"Outstanding on loans originated since the last close.","default":0},"past_due_cents":{"type":"integer","title":"Past Due Cents","description":"Outstanding on past-due loans that are not on hold.","default":0},"on_hold_cents":{"type":"integer","title":"On Hold Cents","description":"Outstanding on loans on hold for a dispute or a void. Part of Total Balance; not part of amount due or past due.","default":0},"credit_balance_cents":{"type":"integer","title":"Credit Balance Cents","description":"Carried-forward credit from refunds or overpayments (D-14).","default":0},"available_credit_cents":{"type":"integer","title":"Available Credit Cents","description":"Limit minus Total Balance. Never negative (D-15). Zero whenever the line cannot spend: while it is `pending` (not open yet), `suspended`, or `closed`."},"utilisation_bps":{"type":"integer","title":"Utilisation Bps","description":"Balance over limit, in basis points."},"open_loan_count":{"type":"integer","title":"Open Loan Count","default":0},"term_days":{"type":"integer","title":"Term Days"},"rate_bps":{"type":"integer","title":"Rate Bps"},"disbursement_fee_bps":{"type":"integer","title":"Disbursement Fee Bps"},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date","description":"The signing date: the effective date named in the merchant's Credit Agreement. Not the approval date, the countersign date, or the first draw (D-18)."},"linked_account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Account Name"},"linked_account_mask":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Account Mask"},"merchant_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Email"},"merchant_legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Legal Name","description":"The merchant's legal entity name."},"merchant_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant State","description":"Two-letter US state, DC or territory code."},"merchant_address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Merchant Address","description":"The merchant's registered address."},"autopay_enabled":{"type":"boolean","title":"Autopay Enabled"},"open_cycle_activity_cents":{"type":"integer","title":"Open Cycle Activity Cents","description":"Per-transaction: outstanding on loans created since the last close — part of Total Balance from the moment they post, and not yet on a statement. Cycle-draw: open-cycle settlements.","default":0},"amount_due_cents":{"type":"integer","title":"Amount Due Cents","description":"What remains of the most recent statement's balance, less the part of it on loans on hold.","default":0},"next_due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Due Date","description":"Earliest upcoming due date among loans not on hold, else the earliest past due."},"statement_due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Statement Due Date","description":"Due date of the most recent statement, fixed at close: the earliest loan due date on it on or after the close day, else the close date (D-41)."},"as_of":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"As Of","description":"When these figures were computed. Every balance payload carries one so a client can label stale data (§10.11)."},"delinquency_stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delinquency Stage","description":"Collections stage this line has reached, from the program ladder (D-31). Null when nothing is past due."},"delinquency_days":{"type":"integer","title":"Delinquency Days","description":"Days past due on the oldest past-due loan. 0 when current.","default":0},"card_management":{"type":"string","enum":["dayzero","partner"],"title":"Card Management","description":"Copied from the program: dayzero provisions cards and pushes spend limits; partner registers issuer cards and receives limit-changed events (D-51).","default":"dayzero"},"issuing_provider":{"type":"string","enum":["ramp","mock"],"title":"Issuing Provider","description":"Copied from the program so the cards tab does not list programs.","default":"ramp"},"card":{"anyOf":[{"$ref":"#/components/schemas/IssuedCardResponse"},{"type":"null"}],"description":"The card issued with the line, when `POST /credit/lines` carried `card` and the issuer minted it (a repeat of that call returns it too). Null on every other read."},"card_issue_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Card Issue Error","description":"Why the card asked for on open was not issued (the error code and message, e.g. the issuer's refusal). The line is open regardless; issue the card with `POST /credit/cards`."}},"type":"object","required":["id","status","credit_limit_cents","current_balance_cents","available_credit_cents","utilisation_bps","term_days","rate_bps","disbursement_fee_bps","autopay_enabled"],"title":"CreditLineResponse","description":"Dashboard cards and metadata row (§4).\n\n``available_credit_cents`` and ``utilisation_bps`` are returned rather\nthan derived so the card, the statement band, and the payoff quote\ncannot disagree (§10.2)."},"CreditLineStatusEnum":{"type":"string","enum":["pending","active","suspended","closed"],"title":"CreditLineStatusEnum","description":"Lifecycle of a credit line itself (distinct from cycle state)."},"IssuedCardResponse":{"properties":{"id":{"type":"string","title":"Id"},"credit_line_id":{"type":"string","title":"Credit Line Id"},"provider":{"type":"string","title":"Provider"},"provider_fund_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider Fund Id"},"provider_card_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider Card Id"},"status":{"$ref":"#/components/schemas/CardIssuanceStatusEnum"},"card_type":{"type":"string","title":"Card Type"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"last_four":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Four"},"expiration":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expiration"},"cardholder_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cardholder Name","description":"The name given when a partner registered the card. Null for a card DayZero issued: the issuer holds the cardholder (D-35)."},"spend_limit_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Spend Limit Cents"},"spend_interval":{"type":"string","title":"Spend Interval"},"transaction_limit_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Transaction Limit Cents"},"allowed_mcc_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Mcc Codes"},"blocked_mcc_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Blocked Mcc Codes"},"auto_lock_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Auto Lock Date"},"issued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issued At"},"suspended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Suspended At"},"suspended_via":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suspended Via","description":"Who suspended the card: `borrower_portal` (the merchant, from the hosted portal), `collections` (a delinquency stage) or `operator` (the console or API). Null when the card is not suspended."},"terminated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Terminated At"},"last_synced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Synced At"},"failure_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Failure Reason"},"managed_by":{"type":"string","title":"Managed By","default":"dayzero"}},"type":"object","required":["id","credit_line_id","provider","status","card_type","spend_interval"],"title":"IssuedCardResponse","description":"An issued card, as we hold it.\n\nNo PAN, no CVV, no cardholder PII beyond a display name — those never\ntransit DayZero by design (§5)."},"LendingModel":{"type":"string","enum":["per_transaction","cycle_draw"],"title":"LendingModel","description":"What the unit of borrowing is.\n\n* ``per_transaction`` — every posted card transaction originates its\n  own loan with its own term, due date, fee, and daily accrual after\n  the due date. The monthly statement is a presentation wrapper and\n  the moment accrued interest is applied. This is the Tie model\n  (FRD v2 §10.5, D-01).\n* ``cycle_draw`` — settlements accumulate into a monthly cycle that\n  resolves into one draw at close, carrying one term, one due date,\n  and one interest figure. The credit-card model FRD v1 specified.\n\nA program picks one. Lines inherit it, and every engine branch keys\non it, so a second partner on the other model is a row, not a build."},"SuccessEnvelope_CreditLineResponse_":{"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/CreditLineResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CreditLineResponse]"},"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":[]}]}