{"openapi":"3.1.0","info":{"title":"GET /api/v1/credit/lines/{credit_line_id}/schedule","version":"1.0.0","description":"Repayment schedule"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/lines/{credit_line_id}/schedule":{"get":{"tags":["credit"],"summary":"Repayment schedule","description":"Every open loan, earliest due first, with its due date, days to due, what closes it on `as_of`, and its payoff on the due date and 30 and 60 days later (from `as_of` once past due), clamped to `horizon_days`. Priced by the same computation as the payoff quote, so the figures agree. Per-transaction programs only.","operationId":"get_line_schedule","parameters":[{"name":"credit_line_id","in":"path","required":true,"schema":{"type":"string","title":"Credit Line Id"}},{"name":"as_of","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Schedule date. Defaults to today (UTC).","title":"As Of"},"description":"Schedule date. Defaults to today (UTC)."},{"name":"horizon_days","in":"query","required":false,"schema":{"type":"integer","maximum":366,"minimum":1,"description":"How far ahead projections run, in days from as_of.","default":60,"title":"Horizon Days"},"description":"How far ahead projections run, in days from as_of."},{"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_LineScheduleResponse_"}}}},"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"}}}},"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_line_schedule_api_v1_credit_lines__credit_line_id__schedule_get"}}},"components":{"schemas":{"LineScheduleResponse":{"properties":{"credit_line_id":{"type":"string","title":"Credit Line Id"},"as_of":{"type":"string","format":"date","title":"As Of"},"horizon_days":{"type":"integer","title":"Horizon Days"},"loans":{"items":{"$ref":"#/components/schemas/ScheduleLoan"},"type":"array","title":"Loans","description":"Open loans, earliest due first."},"next_statement_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Statement On","description":"The day the next statement issues: the day after the current statement period ends."},"totals":{"$ref":"#/components/schemas/ScheduleTotals"}},"type":"object","required":["credit_line_id","as_of","horizon_days","totals"],"title":"LineScheduleResponse","description":"GET /credit/lines/{id}/schedule."},"LoanStatusEnum":{"type":"string","enum":["active","past_due","paid","written_off"],"title":"LoanStatusEnum","description":"Per-transaction loan state (FRD v2 §10.5 status vocabulary).\n\nThe API status is authoritative; a client must not compute it from\ndates or balances."},"ScheduleLoan":{"properties":{"loan_id":{"type":"string","title":"Loan Id"},"external_settlement_id":{"type":"string","title":"External Settlement Id"},"merchant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Name"},"transaction_date":{"type":"string","format":"date","title":"Transaction Date"},"due_date":{"type":"string","format":"date","title":"Due Date"},"days_to_due":{"type":"integer","title":"Days To Due","description":"Days from as_of to the due date; negative once it has passed."},"status":{"$ref":"#/components/schemas/LoanStatusEnum"},"on_hold":{"type":"boolean","title":"On Hold","description":"True when the loan carries a hold (for example a dispute).","default":false},"principal_outstanding_cents":{"type":"integer","title":"Principal Outstanding Cents"},"fee_outstanding_cents":{"type":"integer","title":"Fee Outstanding Cents"},"interest_accrued_cents":{"type":"integer","title":"Interest Accrued Cents","description":"Interest owed as of as_of: accrued and unpaid, including days the nightly accrual has not posted yet. The three buckets sum to payoff_today_cents."},"payoff_today_cents":{"type":"integer","title":"Payoff Today Cents","description":"What closes this loan on as_of. Equals the loan's line on a payoff quote for as_of."},"projected":{"items":{"$ref":"#/components/schemas/ScheduleProjection"},"type":"array","title":"Projected","description":"Payoff on the due date, 30 days after it and 60 days after it (from as_of for a loan already past due), each clamped to the horizon."}},"type":"object","required":["loan_id","external_settlement_id","transaction_date","due_date","days_to_due","status","principal_outstanding_cents","fee_outstanding_cents","interest_accrued_cents","payoff_today_cents"],"title":"ScheduleLoan","description":"One open loan on the schedule."},"ScheduleProjection":{"properties":{"on":{"type":"string","format":"date","title":"On"},"interest_cents":{"type":"integer","title":"Interest Cents","description":"Interest owed on that date: accrued and unpaid, plus accrual projected to the date."},"total_cents":{"type":"integer","title":"Total Cents","description":"Payoff on that date: principal, fee and interest_cents."}},"type":"object","required":["on","interest_cents","total_cents"],"title":"ScheduleProjection","description":"What one loan would take to close on a later date."},"ScheduleTotals":{"properties":{"due_within_7_days_cents":{"type":"integer","title":"Due Within 7 Days Cents","description":"Payoff, on their due dates, of the loans due from as_of through as_of + 7 days."},"due_within_30_days_cents":{"type":"integer","title":"Due Within 30 Days Cents","description":"The same through as_of + 30 days (includes the 7-day figure)."},"past_due_cents":{"type":"integer","title":"Past Due Cents","description":"Payoff on as_of of the loans whose due date has passed."},"payoff_today_cents":{"type":"integer","title":"Payoff Today Cents","description":"Payoff on as_of of every open loan. Equals the payoff quote's total for as_of."}},"type":"object","required":["due_within_7_days_cents","due_within_30_days_cents","past_due_cents","payoff_today_cents"],"title":"ScheduleTotals"},"SuccessEnvelope_LineScheduleResponse_":{"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/LineScheduleResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[LineScheduleResponse]"},"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":[]}]}