{"openapi":"3.1.0","info":{"title":"GET /api/v1/contracts/cash-flow-forecast","version":"1.0.0","description":"Weekly cash-inflow forecast"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/contracts/cash-flow-forecast":{"get":{"tags":["contracts"],"summary":"Weekly cash-inflow forecast","description":"Forward-looking weekly cash-inflow forecast projected from each live contract's order-line billing rules, bucketed into calendar weeks from the current week.","operationId":"contract_cash_flow_forecast_api_v1_contracts_cash_flow_forecast_get","parameters":[{"name":"weeks","in":"query","required":false,"schema":{"type":"integer","maximum":52,"minimum":1,"description":"Number of weeks to project.","default":13,"title":"Weeks"},"description":"Number of weeks to project."},{"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_CashFlowForecastResponse_"}}}},"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":{"CashFlowForecastContract":{"properties":{"contract_id":{"type":"string","title":"Contract Id"},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Number"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"inflow_cents":{"type":"integer","title":"Inflow Cents","default":0}},"type":"object","required":["contract_id"],"title":"CashFlowForecastContract","description":"One contract's expected inflow within a forecast week."},"CashFlowForecastResponse":{"properties":{"weeks":{"items":{"$ref":"#/components/schemas/CashFlowForecastWeek"},"type":"array","title":"Weeks"},"total_expected_cents":{"type":"integer","title":"Total Expected Cents","default":0},"weeks_count":{"type":"integer","title":"Weeks Count","default":0}},"type":"object","title":"CashFlowForecastResponse","description":"Forward-looking weekly cash-inflow forecast projected from contracts.\n\nInflows are projected from each live contract's order-line billing rules (see\n``project_line_billings``) and bucketed into ``weeks`` calendar weeks starting\nfrom the current week. Historical (past-dated) billings fall outside the window."},"CashFlowForecastWeek":{"properties":{"week_start":{"type":"string","format":"date","title":"Week Start"},"week_end":{"type":"string","format":"date","title":"Week End"},"expected_inflow_cents":{"type":"integer","title":"Expected Inflow Cents","default":0},"contracts":{"items":{"$ref":"#/components/schemas/CashFlowForecastContract"},"type":"array","title":"Contracts"}},"type":"object","required":["week_start","week_end"],"title":"CashFlowForecastWeek","description":"Expected cash inflow for a single ISO week, with per-contract detail."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_CashFlowForecastResponse_":{"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/CashFlowForecastResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashFlowForecastResponse]"},"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":[]}]}