{"openapi":"3.1.0","info":{"title":"GET /api/v1/books/daily-brief","version":"1.0.0","description":"Books AI Daily Brief"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/books/daily-brief":{"get":{"tags":["daily-brief"],"summary":"Books AI Daily Brief","description":"Aggregated home-screen payload for the Books shell. Returns six tiles: categorization, AP drafts, anomalies, close score, burn/runway, and AI spend. Each tile is computed independently and degrades gracefully if its upstream data isn't ready.","operationId":"get_daily_brief_api_v1_books_daily_brief_get","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_GetDailyBriefResponse_"}}}},"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"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"DailyBriefAiSpendTile":{"properties":{"status":{"$ref":"#/components/schemas/JsonValue"},"current_month_cents":{"type":"integer","title":"Current Month Cents","default":0},"avg_monthly_cents":{"type":"integer","title":"Avg Monthly Cents","default":0},"top_vendors":{"items":{"$ref":"#/components/schemas/DailyBriefAiVendor"},"type":"array","title":"Top Vendors","default":[]}},"additionalProperties":true,"type":"object","required":["status"],"title":"DailyBriefAiSpendTile","description":"Spend with known AI vendors (current month + trailing average)."},"DailyBriefAiVendor":{"properties":{"name":{"type":"string","title":"Name"},"total_cents":{"type":"integer","title":"Total Cents"}},"additionalProperties":true,"type":"object","required":["name","total_cents"],"title":"DailyBriefAiVendor","description":"One AI vendor's spend total under the AI-spend tile."},"DailyBriefAnomaliesTile":{"properties":{"status":{"$ref":"#/components/schemas/JsonValue"},"count":{"type":"integer","title":"Count"},"by_severity":{"$ref":"#/components/schemas/JsonValue"},"top":{"items":{"$ref":"#/components/schemas/DailyBriefAnomalyRow"},"type":"array","title":"Top"},"last_scanned":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Scanned"}},"additionalProperties":true,"type":"object","required":["status","count","by_severity","top"],"title":"DailyBriefAnomaliesTile","description":"Frontend type ``DailyBriefAnomaliesTile``."},"DailyBriefAnomalyRow":{"properties":{"fingerprint":{"type":"string","title":"Fingerprint"},"anomaly_type":{"type":"string","title":"Anomaly Type"},"severity":{"$ref":"#/components/schemas/JsonValue"},"description":{"type":"string","title":"Description"},"recommended_action":{"anyOf":[{"$ref":"#/components/schemas/DailyBriefRecommendedAction"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["fingerprint","anomaly_type","severity","description"],"title":"DailyBriefAnomalyRow","description":"Frontend type ``DailyBriefAnomalyRow``."},"DailyBriefApDraftRow":{"properties":{"bill_id":{"type":"string","title":"Bill Id"},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"amount_cents":{"type":"integer","title":"Amount Cents"},"description":{"type":"string","title":"Description"},"due_on":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Due On"}},"additionalProperties":true,"type":"object","required":["bill_id","amount_cents","description"],"title":"DailyBriefApDraftRow","description":"Frontend type ``DailyBriefApDraftRow``."},"DailyBriefApDraftsTile":{"properties":{"status":{"$ref":"#/components/schemas/JsonValue"},"count":{"type":"integer","title":"Count"},"total_cents":{"type":"integer","title":"Total Cents"},"top":{"items":{"$ref":"#/components/schemas/DailyBriefApDraftRow"},"type":"array","title":"Top"}},"additionalProperties":true,"type":"object","required":["status","count","total_cents","top"],"title":"DailyBriefApDraftsTile","description":"Frontend type ``DailyBriefApDraftsTile``."},"DailyBriefBurnMonth":{"properties":{"label":{"type":"string","title":"Label"},"net_change_cents":{"type":"integer","title":"Net Change Cents"}},"additionalProperties":true,"type":"object","required":["label","net_change_cents"],"title":"DailyBriefBurnMonth","description":"One trailing month under the burn/runway tile.\n\n``net_change_cents`` is that month's NET CASH FROM OPERATING ACTIVITIES,\nnot the total change in cash — financing and investing movements (a\nfundraise, a sweep into treasury) are not burn. The field name predates\nthat distinction and is kept for wire compatibility."},"DailyBriefBurnRunwayTile":{"properties":{"status":{"$ref":"#/components/schemas/JsonValue"},"avg_monthly_burn_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Avg Monthly Burn Cents"},"cash_on_hand_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cash On Hand Cents"},"runway_months":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Runway Months"},"months":{"items":{"$ref":"#/components/schemas/DailyBriefBurnMonth"},"type":"array","title":"Months","default":[]}},"additionalProperties":true,"type":"object","required":["status"],"title":"DailyBriefBurnRunwayTile","description":"Avg monthly operating burn, cash on hand, and estimated runway.\n\n``cash_on_hand_cents`` counts investment/brokerage balances alongside\nbank cash — every liquid dollar, which is what runway is measured\nagainst."},"DailyBriefCategorizationTile":{"properties":{"status":{"$ref":"#/components/schemas/JsonValue"},"auto_categorized_today":{"type":"number","title":"Auto Categorized Today"},"sent_to_review_today":{"type":"number","title":"Sent To Review Today"},"top_rule":{"anyOf":[{"$ref":"#/components/schemas/DailyBriefTopRule"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["status","auto_categorized_today","sent_to_review_today"],"title":"DailyBriefCategorizationTile","description":"Frontend type ``DailyBriefCategorizationTile``."},"DailyBriefCloseScoreTile":{"properties":{"status":{"$ref":"#/components/schemas/JsonValue"},"current":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Current"},"previous":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Previous"},"delta":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Delta"},"color":{"$ref":"#/components/schemas/JsonValue"},"blockers_count":{"type":"number","title":"Blockers Count"},"period_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Id"},"period_display":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Display"}},"additionalProperties":true,"type":"object","required":["status","color","blockers_count"],"title":"DailyBriefCloseScoreTile","description":"Frontend type ``DailyBriefCloseScoreTile``."},"DailyBriefOutstandingTile":{"properties":{"status":{"$ref":"#/components/schemas/JsonValue"},"count":{"type":"integer","title":"Count","default":0},"total_cents":{"type":"integer","title":"Total Cents","default":0},"overdue_count":{"type":"integer","title":"Overdue Count","default":0},"overdue_cents":{"type":"integer","title":"Overdue Cents","default":0}},"additionalProperties":true,"type":"object","required":["status"],"title":"DailyBriefOutstandingTile","description":"Open receivables or payables, with the overdue slice broken out.\n\nUsed for both AR and AP: the shape is identical, only the direction of\nthe money differs."},"DailyBriefRecommendedAction":{"properties":{"action":{"type":"string","title":"Action"},"label":{"type":"string","title":"Label"},"savings_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Savings Cents"},"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Params"}},"additionalProperties":true,"type":"object","required":["action","label"],"title":"DailyBriefRecommendedAction","description":"Recommended action payload on an anomaly row."},"DailyBriefTopRule":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"match_count":{"type":"number","title":"Match Count"}},"additionalProperties":true,"type":"object","required":["id","name","match_count"],"title":"DailyBriefTopRule","description":"Top firing bank rule nested under the categorization tile."},"GetDailyBriefResponse":{"properties":{"as_of":{"type":"string","title":"As Of"},"business_id":{"type":"string","title":"Business Id"},"categorization":{"$ref":"#/components/schemas/DailyBriefCategorizationTile"},"ap_drafts":{"$ref":"#/components/schemas/DailyBriefApDraftsTile"},"anomalies":{"$ref":"#/components/schemas/DailyBriefAnomaliesTile"},"close_score":{"$ref":"#/components/schemas/DailyBriefCloseScoreTile"},"burn_runway":{"anyOf":[{"$ref":"#/components/schemas/DailyBriefBurnRunwayTile"},{"type":"null"}]},"ar_outstanding":{"anyOf":[{"$ref":"#/components/schemas/DailyBriefOutstandingTile"},{"type":"null"}]},"ap_outstanding":{"anyOf":[{"$ref":"#/components/schemas/DailyBriefOutstandingTile"},{"type":"null"}]},"ai_spend":{"anyOf":[{"$ref":"#/components/schemas/DailyBriefAiSpendTile"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["as_of","business_id","categorization","ap_drafts","anomalies","close_score"],"title":"GetDailyBriefResponse","description":"Response for ``get_daily_brief``."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JsonValue":{},"SuccessEnvelope_GetDailyBriefResponse_":{"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/GetDailyBriefResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetDailyBriefResponse]"},"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":[]}]}