{"openapi":"3.1.0","info":{"title":"POST /api/v1/businesses/{business_id}/cfo-portal/debt-schedule/parse-contract","version":"1.0.0","description":"Parse debt contract into a draft payment schedule"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/parse-contract":{"post":{"tags":["cfo-portal"],"summary":"Parse debt contract into a draft payment schedule","description":"Parse an uploaded lending contract into structured terms and schedule.\n\n**Request Body:**\n- `s3_key`: S3 key of an uploaded contract document (required).","operationId":"cfo_portal_parse_debt_contract_api_v1_businesses__business_id__cfo_portal_debt_schedule_parse_contract_post","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business 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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DebtContractParseRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseDebtContractResponse"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"DebtContractParseRequest":{"properties":{"s3_key":{"type":"string","maxLength":1024,"minLength":1,"title":"S3 Key","description":"S3 key of the uploaded debt contract document."}},"type":"object","required":["s3_key"],"title":"DebtContractParseRequest","description":"Request payload for parsing a lending/debt contract file."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ParseDebtContractResponse":{"properties":{"contract":{"$ref":"#/components/schemas/ParsedDebtContract"},"payment_schedule":{"items":{"$ref":"#/components/schemas/ParsedDebtScheduleRow"},"type":"array","title":"Payment Schedule"}},"type":"object","required":["contract"],"title":"ParseDebtContractResponse","description":"Draft contract terms + projected payout table from a parsed PDF."},"ParsedDebtContract":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"lender":{"type":"string","maxLength":255,"minLength":1,"title":"Lender"},"debt_type":{"type":"string","title":"Debt Type","description":"DebtTypeEnum value: term_loan, line_of_credit, mortgage, equipment_loan, sba_loan, convertible_note, revenue_based, other."},"original_principal_cents":{"type":"integer","minimum":0.0,"title":"Original Principal Cents"},"current_balance_cents":{"type":"integer","minimum":0.0,"title":"Current Balance Cents"},"interest_rate_bps":{"type":"integer","minimum":0.0,"title":"Interest Rate Bps","description":"Annual interest rate in basis points (e.g. 500 = 5.00%). Set to 0 for revenue-based financing.","default":0},"term_months":{"type":"integer","minimum":0.0,"title":"Term Months","description":"Loan term in months. For revenue-based financing this is an estimate of months to cap based on assumed revenue.","default":0},"start_date":{"type":"string","title":"Start Date","description":"Contract start date as ISO-8601 YYYY-MM-DD."},"maturity_date":{"type":"string","title":"Maturity Date","description":"Maturity/expected payoff date as ISO-8601 YYYY-MM-DD. For RBF this is an estimate based on the share rate."},"payment_frequency":{"type":"string","title":"Payment Frequency","description":"PaymentFrequencyEnum value: monthly, quarterly, semi_annual, annual, bullet, or revenue_share.","default":"monthly"},"payment_amount_cents":{"type":"integer","minimum":0.0,"title":"Payment Amount Cents","description":"Scheduled payment per period (fixed) or 0 for RBF.","default":0},"revenue_share_bps":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Revenue Share Bps","description":"Revenue-share rate in basis points; only set for ``revenue_based`` debt."},"total_repayment_cap_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Total Repayment Cap Cents","description":"Total dollar cap on cumulative repayments; only set for ``revenue_based`` debt."},"summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Summary","description":"One-paragraph human summary of the contract."},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"Parsing confidence in [0, 1] reported by the LLM.","default":0.0}},"type":"object","required":["name","lender","debt_type","original_principal_cents","current_balance_cents","start_date","maturity_date"],"title":"ParsedDebtContract","description":"Structured debt-contract terms extracted from a parsed contract.\n\nField names and units match ``DebtInstrument`` so the approve\nendpoint can persist this payload directly. Revenue-based fields\n(``revenue_share_bps`` and ``total_repayment_cap_cents``) are only\npopulated when ``debt_type`` is ``revenue_based``."},"ParsedDebtScheduleRow":{"properties":{"payment_date":{"type":"string","title":"Payment Date","description":"ISO-8601 YYYY-MM-DD."},"amount_cents":{"type":"integer","minimum":0.0,"title":"Amount Cents"},"principal_cents":{"type":"integer","minimum":0.0,"title":"Principal Cents"},"interest_cents":{"type":"integer","minimum":0.0,"title":"Interest Cents"},"remaining_balance_cents":{"type":"integer","minimum":0.0,"title":"Remaining Balance Cents"}},"type":"object","required":["payment_date","amount_cents","principal_cents","interest_cents","remaining_balance_cents"],"title":"ParsedDebtScheduleRow","description":"A single row of a projected payout table."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}