{"openapi":"3.1.0","info":{"title":"GET /api/v1/capital/lines","version":"1.0.0","description":"List the credit lines this business borrows on"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/capital/lines":{"get":{"tags":["capital"],"summary":"List the credit lines this business borrows on","description":"Every line whose merchant is this business, across every lender, with the figures the lender's dashboard shows: limit, balance, available credit, next due date.","operationId":"list_capital_lines","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"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CapitalLinesResponse_"}}}},"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_capital_lines_api_v1_capital_lines_get"}}},"components":{"schemas":{"CapitalLine":{"properties":{"id":{"type":"string","title":"Id"},"program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Id"},"program_display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Display Name"},"operator_business_id":{"type":"string","title":"Operator Business Id"},"status":{"$ref":"#/components/schemas/CreditLineStatusEnum"},"status_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status Reason"},"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"},"total_balance_cents":{"type":"integer","title":"Total Balance Cents","default":0},"available_credit_cents":{"type":"integer","title":"Available Credit Cents"},"utilisation_bps":{"type":"integer","title":"Utilisation Bps"},"past_due_cents":{"type":"integer","title":"Past Due Cents","default":0},"amount_due_cents":{"type":"integer","title":"Amount Due Cents","default":0},"next_due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Due Date"},"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"},"linked_account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Account Name"},"linked_account_mask":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Account Mask"},"autopay_enabled":{"type":"boolean","title":"Autopay Enabled","default":false},"delinquency_stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delinquency Stage"},"as_of":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"As Of"}},"type":"object","required":["id","operator_business_id","status","credit_limit_cents","current_balance_cents","available_credit_cents","utilisation_bps","term_days","rate_bps","disbursement_fee_bps"],"title":"CapitalLine","description":"A line the business borrows on, with its lender's name.\n\nThe figures are the ones the lender's dashboard shows\n(``CreditLineResponse``), computed in one place and never derived here."},"CapitalLinesResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CapitalLine"},"type":"array","title":"Items"}},"type":"object","title":"CapitalLinesResponse"},"CreditLineStatusEnum":{"type":"string","enum":["pending","active","suspended","closed"],"title":"CreditLineStatusEnum","description":"Lifecycle of a credit line itself (distinct from cycle state)."},"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_CapitalLinesResponse_":{"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/CapitalLinesResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CapitalLinesResponse]"},"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":[]}]}