{"openapi":"3.1.0","info":{"title":"GET /api/v1/personal/insights","version":"1.0.0","description":"Personal financial health score, pace alerts & merchant insights"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/personal/insights":{"get":{"tags":["personal"],"summary":"Personal financial health score, pace alerts & merchant insights","description":"Household financial health score (0-100), emergency runway, budget pace alerts, month-over-month movers, top merchants, and 3-month auto-budget suggestions.","operationId":"get_personal_insights","parameters":[{"name":"month","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Target month in YYYY-MM format (defaults to current month).","title":"Month"},"description":"Target month in YYYY-MM format (defaults to current month)."},{"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_PersonalInsightsResponse_"}}}},"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_personal_insights_api_v1_personal_insights_get"}}},"components":{"schemas":{"AutoBudgetSuggestion":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"category_name":{"type":"string","title":"Category Name"},"suggested_limit_cents":{"type":"integer","title":"Suggested Limit Cents"},"three_month_avg_cents":{"type":"integer","title":"Three Month Avg Cents"},"current_limit_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Current Limit Cents"}},"type":"object","required":["ledger_id","category_name","suggested_limit_cents","three_month_avg_cents"],"title":"AutoBudgetSuggestion","description":"3-month average spending suggestion for 1-click budget setup."},"BudgetPaceAlert":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"category_name":{"type":"string","title":"Category Name"},"spent_cents":{"type":"integer","title":"Spent Cents"},"budget_cents":{"type":"integer","title":"Budget Cents"},"pct_of_budget":{"type":"number","title":"Pct Of Budget"},"month_elapsed_pct":{"type":"number","title":"Month Elapsed Pct"},"projected_month_end_cents":{"type":"integer","title":"Projected Month End Cents"},"projected_overrun_cents":{"type":"integer","title":"Projected Overrun Cents"},"severity":{"type":"string","enum":["warning","over"],"title":"Severity"}},"type":"object","required":["ledger_id","category_name","spent_cents","budget_cents","pct_of_budget","month_elapsed_pct","projected_month_end_cents","projected_overrun_cents","severity"],"title":"BudgetPaceAlert","description":"Category pacing ahead of month elapsed percentage."},"CategoryMoverItem":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"category_name":{"type":"string","title":"Category Name"},"current_cents":{"type":"integer","title":"Current Cents"},"previous_cents":{"type":"integer","title":"Previous Cents"},"three_month_avg_cents":{"type":"integer","title":"Three Month Avg Cents"},"delta_cents":{"type":"integer","title":"Delta Cents"},"delta_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Delta Pct"}},"type":"object","required":["ledger_id","category_name","current_cents","previous_cents","three_month_avg_cents","delta_cents"],"title":"CategoryMoverItem","description":"Month-over-month and 3-month average category spending change."},"HealthScorePillar":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"score":{"type":"integer","title":"Score"},"weight_pct":{"type":"integer","title":"Weight Pct"},"value_label":{"type":"string","title":"Value Label"},"target_label":{"type":"string","title":"Target Label"},"status":{"type":"string","enum":["strong","fair","attention"],"title":"Status"}},"type":"object","required":["key","label","score","weight_pct","value_label","target_label","status"],"title":"HealthScorePillar","description":"One scored component of the Household Financial Health Score."},"PersonalInsightsResponse":{"properties":{"month":{"type":"string","title":"Month"},"health_score":{"type":"integer","title":"Health Score"},"health_grade":{"type":"string","title":"Health Grade"},"emergency_runway_months":{"type":"number","title":"Emergency Runway Months"},"liquid_cash_cents":{"type":"integer","title":"Liquid Cash Cents"},"avg_monthly_spending_cents":{"type":"integer","title":"Avg Monthly Spending Cents"},"savings_rate_pct":{"type":"number","title":"Savings Rate Pct"},"debt_to_asset_ratio_pct":{"type":"number","title":"Debt To Asset Ratio Pct"},"recurring_annualized_cents":{"type":"integer","title":"Recurring Annualized Cents"},"recurring_share_of_income_pct":{"type":"number","title":"Recurring Share Of Income Pct"},"month_elapsed_pct":{"type":"number","title":"Month Elapsed Pct"},"pillars":{"items":{"$ref":"#/components/schemas/HealthScorePillar"},"type":"array","title":"Pillars"},"pace_alerts":{"items":{"$ref":"#/components/schemas/BudgetPaceAlert"},"type":"array","title":"Pace Alerts"},"category_movers":{"items":{"$ref":"#/components/schemas/CategoryMoverItem"},"type":"array","title":"Category Movers"},"top_merchants":{"items":{"$ref":"#/components/schemas/TopMerchantItem"},"type":"array","title":"Top Merchants"},"auto_budget_suggestions":{"items":{"$ref":"#/components/schemas/AutoBudgetSuggestion"},"type":"array","title":"Auto Budget Suggestions"},"next_actions":{"items":{"$ref":"#/components/schemas/PersonalNextAction"},"type":"array","title":"Next Actions"}},"type":"object","required":["month","health_score","health_grade","emergency_runway_months","liquid_cash_cents","avg_monthly_spending_cents","savings_rate_pct","debt_to_asset_ratio_pct","recurring_annualized_cents","recurring_share_of_income_pct","month_elapsed_pct","pillars","pace_alerts","category_movers","top_merchants","auto_budget_suggestions","next_actions"],"title":"PersonalInsightsResponse","description":"Financial Health Score, emergency runway, pace alerts, movers & merchants."},"PersonalNextAction":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"detail":{"type":"string","title":"Detail"},"impact_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Impact Label"},"priority":{"type":"string","enum":["high","medium","low"],"title":"Priority"}},"type":"object","required":["id","title","detail","priority"],"title":"PersonalNextAction","description":"Prioritized ledger-grounded recommendation."},"SuccessEnvelope_PersonalInsightsResponse_":{"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/PersonalInsightsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[PersonalInsightsResponse]"},"TopMerchantItem":{"properties":{"merchant":{"type":"string","title":"Merchant"},"total_cents":{"type":"integer","title":"Total Cents"},"transaction_count":{"type":"integer","title":"Transaction Count"},"share_pct":{"type":"number","title":"Share Pct"}},"type":"object","required":["merchant","total_cents","transaction_count","share_pct"],"title":"TopMerchantItem","description":"Highest-spend merchant/counterparty in the selected month."},"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":[]}]}