{"openapi":"3.1.0","info":{"title":"GET /api/v1/personal/debt-plan","version":"1.0.0","description":"Debt payoff optimizer (Avalanche vs. Snowball)"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/personal/debt-plan":{"get":{"tags":["personal"],"summary":"Debt payoff optimizer (Avalanche vs. Snowball)","description":"Compares Avalanche (highest APR) and Snowball (smallest balance) payoff schedules and interest saved across live liability accounts.","operationId":"get_debt_payoff_plan","parameters":[{"name":"extra_monthly_cents","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Extra monthly payment in cents above minimums.","default":0,"title":"Extra Monthly Cents"},"description":"Extra monthly payment in cents above minimums."},{"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_DebtPayoffPlanResponse_"}}}},"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_debt_payoff_plan_api_v1_personal_debt_plan_get"}}},"components":{"schemas":{"DebtAccountPlanItem":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"name":{"type":"string","title":"Name"},"group":{"type":"string","title":"Group"},"balance_cents":{"type":"integer","title":"Balance Cents"},"apr_pct":{"type":"number","title":"Apr Pct"},"min_payment_cents":{"type":"integer","title":"Min Payment Cents"},"avalanche_order":{"type":"integer","title":"Avalanche Order"},"snowball_order":{"type":"integer","title":"Snowball Order"},"avalanche_payoff_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Avalanche Payoff Months"},"snowball_payoff_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Snowball Payoff Months"}},"type":"object","required":["ledger_id","name","group","balance_cents","apr_pct","min_payment_cents","avalanche_order","snowball_order"],"title":"DebtAccountPlanItem","description":"Single liability ledger with balance, APR, min payment & payoff order."},"DebtPayoffPlanResponse":{"properties":{"as_of_date":{"type":"string","format":"date","title":"As Of Date"},"total_debt_cents":{"type":"integer","title":"Total Debt Cents"},"weighted_avg_apr_pct":{"type":"number","title":"Weighted Avg Apr Pct"},"total_min_payment_cents":{"type":"integer","title":"Total Min Payment Cents"},"extra_monthly_cents":{"type":"integer","title":"Extra Monthly Cents"},"recommended_strategy":{"type":"string","enum":["avalanche","snowball"],"title":"Recommended Strategy"},"avalanche_interest_saved_vs_snowball_cents":{"type":"integer","title":"Avalanche Interest Saved Vs Snowball Cents"},"extra_payment_interest_saved_cents":{"type":"integer","title":"Extra Payment Interest Saved Cents"},"extra_payment_months_saved":{"type":"integer","title":"Extra Payment Months Saved"},"avalanche":{"$ref":"#/components/schemas/DebtStrategySummary"},"snowball":{"$ref":"#/components/schemas/DebtStrategySummary"},"minimum_only":{"$ref":"#/components/schemas/DebtStrategySummary"},"accounts":{"items":{"$ref":"#/components/schemas/DebtAccountPlanItem"},"type":"array","title":"Accounts"},"timeline":{"items":{"$ref":"#/components/schemas/DebtTimelinePoint"},"type":"array","title":"Timeline"}},"type":"object","required":["as_of_date","total_debt_cents","weighted_avg_apr_pct","total_min_payment_cents","extra_monthly_cents","recommended_strategy","avalanche_interest_saved_vs_snowball_cents","extra_payment_interest_saved_cents","extra_payment_months_saved","avalanche","snowball","minimum_only","accounts","timeline"],"title":"DebtPayoffPlanResponse","description":"Avalanche vs. Snowball amortization comparison across live liabilities."},"DebtStrategySummary":{"properties":{"strategy":{"type":"string","enum":["avalanche","snowball","minimum_only"],"title":"Strategy"},"payoff_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Payoff Months"},"debt_free_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Debt Free Date"},"total_interest_cents":{"type":"integer","title":"Total Interest Cents"},"total_paid_cents":{"type":"integer","title":"Total Paid Cents"},"capped":{"type":"boolean","title":"Capped","default":false}},"type":"object","required":["strategy","total_interest_cents","total_paid_cents"],"title":"DebtStrategySummary","description":"Aggregate payoff metrics for one debt strategy."},"DebtTimelinePoint":{"properties":{"month_offset":{"type":"integer","title":"Month Offset"},"month_label":{"type":"string","title":"Month Label"},"avalanche_remaining_cents":{"type":"integer","title":"Avalanche Remaining Cents"},"snowball_remaining_cents":{"type":"integer","title":"Snowball Remaining Cents"},"minimum_only_remaining_cents":{"type":"integer","title":"Minimum Only Remaining Cents"}},"type":"object","required":["month_offset","month_label","avalanche_remaining_cents","snowball_remaining_cents","minimum_only_remaining_cents"],"title":"DebtTimelinePoint","description":"Combined remaining debt balance at a given month offset."},"SuccessEnvelope_DebtPayoffPlanResponse_":{"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/DebtPayoffPlanResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DebtPayoffPlanResponse]"},"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":[]}]}