{"openapi":"3.1.0","info":{"title":"GET /api/v1/businesses/{business_id}/cash-flow-statement/periodic","version":"1.0.0","description":"Get cash flow statements for multiple periods"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/{business_id}/cash-flow-statement/periodic":{"get":{"tags":["businesses"],"summary":"Get cash flow statements for multiple periods","description":"Batch endpoint returning a cash flow statement for each period in the requested date range. Avoids N round-trips for monthly/quarterly views. All amounts in cents.","operationId":"get_cash_flow_statements_periodic_api_v1_businesses__business_id__cash_flow_statement_periodic_get","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"grouping","in":"query","required":false,"schema":{"type":"string","pattern":"^(monthly|quarterly)$","description":"Period grouping: 'monthly' or 'quarterly'","default":"monthly","title":"Grouping"},"description":"Period grouping: 'monthly' or 'quarterly'"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude line items with zero cash impact","default":false,"title":"Hide Zero Rows"},"description":"Exclude line items with zero cash impact"},{"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_GetCashFlowStatementsPeriodicResponse_"}}}},"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":{"CashFlowLineItem":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id","description":"Stable identifier for this row"},"ledger_name":{"type":"string","title":"Ledger Name","description":"Human label shown to the reader"},"teal_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teal Ledger Id","description":"Teal ledger ID if this row corresponds to a single externally linked account; null for synthetic indirect-method rows."},"change":{"type":"integer","title":"Change","description":"Signed amount for this row in cents"},"cfs_class":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cfs Class","description":"Source ``cfs_class`` aggregation key for this row (e.g. 'ar', 'ppe'); null for opener / subtotal rows."}},"type":"object","required":["ledger_id","ledger_name","change"],"title":"CashFlowLineItem","description":"A single line on the Statement of Cash Flows.\n\nEach line has a stable string identifier (``ledger_id``) so the\nfrontend can key React components and treat synthetic rows\nconsistently with real-ledger rows. For indirect-method rows the\nid has the shape ``\"indirect:<key>\"`` (e.g. ``\"indirect:net_income\"``,\n``\"indirect:ar\"``, ``\"indirect:da\"``); for ledger-level rows it's\nthe ledger UUID. ``ledger_name`` is the human-readable label."},"CashFlowPeriodicPeriod":{"properties":{"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"}},"additionalProperties":true,"type":"object","required":["start_date","end_date"],"title":"CashFlowPeriodicPeriod","description":"Date range for one periodic cash-flow statement."},"CashFlowSection":{"properties":{"name":{"type":"string","title":"Name","description":"Section name"},"line_items":{"items":{"$ref":"#/components/schemas/CashFlowLineItem"},"type":"array","title":"Line Items","description":"Line items in this section"},"total":{"type":"integer","title":"Total","description":"Net cash flow for this section (cents)","default":0}},"type":"object","required":["name"],"title":"CashFlowSection","description":"Operating / Investing / Financing section of the statement."},"CashFlowStatement":{"properties":{"business_id":{"type":"string","title":"Business Id","description":"Business ID"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name","description":"Business name"},"start_date":{"type":"string","format":"date","title":"Start Date","description":"Report start date"},"end_date":{"type":"string","format":"date","title":"End Date","description":"Report end date"},"generated_at":{"type":"string","format":"date-time","title":"Generated At","description":"When the report was generated"},"method":{"type":"string","const":"indirect","title":"Method","description":"Construction method. The indirect method is canonical.","default":"indirect"},"net_income":{"type":"integer","title":"Net Income","description":"Net Income (accrual) for the period in cents. Also appears as the first line item of ``operating_activities``."},"operating_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section A — operating activities"},"investing_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section B — investing activities"},"financing_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section C — financing activities"},"net_cash_from_operating":{"type":"integer","title":"Net Cash From Operating","description":"Subtotal of Section A (cents)"},"net_cash_from_investing":{"type":"integer","title":"Net Cash From Investing","description":"Subtotal of Section B (cents)"},"net_cash_from_financing":{"type":"integer","title":"Net Cash From Financing","description":"Subtotal of Section C (cents)"},"net_change_in_cash":{"type":"integer","title":"Net Change In Cash","description":"Sum of Sections A+B+C (cents)"},"beginning_cash":{"type":"integer","title":"Beginning Cash","description":"Σ beginning natural balance for cfs_class='cash' (cents)"},"ending_cash":{"type":"integer","title":"Ending Cash","description":"Beginning cash + Net change in cash (cents)"},"supplemental_disclosures":{"$ref":"#/components/schemas/SupplementalDisclosures","description":"ASC 230 supplemental disclosures"},"validation_results":{"items":{"$ref":"#/components/schemas/CashFlowValidationResult"},"type":"array","title":"Validation Results","description":"Outcome of §5 validation rules"},"validation_passed":{"type":"boolean","title":"Validation Passed","description":"True iff every §5 validation rule passed","default":true},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings","description":"Non-fatal accuracy warnings. Validation failures are duplicated here so legacy callers that ignore ``validation_results`` still see the diagnostic."}},"type":"object","required":["business_id","start_date","end_date","net_income","operating_activities","investing_activities","financing_activities","net_cash_from_operating","net_cash_from_investing","net_cash_from_financing","net_change_in_cash","beginning_cash","ending_cash"],"title":"CashFlowStatement","description":"Indirect-method Statement of Cash Flows for one period.\n\nSection A (Operating) walks Net Income through non-cash add-backs\nand working-capital changes to Net Cash from Operating Activities.\nSections B (Investing) and C (Financing) carry the corresponding\nbalance deltas on long-term assets, debt, and equity. Section D\n(Reconciliation) is exposed as ``net_change_in_cash`` /\n``beginning_cash`` / ``ending_cash``.\n\nThe §5 validation results are attached so callers can render a\nPASS/FAIL banner without re-deriving the checks."},"CashFlowValidationResult":{"properties":{"rule":{"type":"string","title":"Rule","description":"Stable rule identifier"},"passed":{"type":"boolean","title":"Passed","description":"Whether the rule was satisfied"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Human-readable detail when the rule failed"}},"type":"object","required":["rule","passed"],"title":"CashFlowValidationResult","description":"Outcome of one §5 validation rule applied to a generated statement.\n\nA rule passes when its condition holds within the spec's tolerance\n(typically $1 / 100 cents). Failed rules carry a human-readable\nmessage that explains the gap and any remediation. The full list of\nrules is reported on every statement -- a \"PASS\" report shows them\nall green, a \"FAIL\" shows the failing ones with detail."},"GetCashFlowStatementsPeriodicResponse":{"properties":{"grouping":{"type":"string","enum":["monthly","quarterly"],"title":"Grouping"},"periods":{"items":{"$ref":"#/components/schemas/CashFlowPeriodicPeriod"},"type":"array","title":"Periods"},"statements":{"items":{"$ref":"#/components/schemas/CashFlowStatement"},"type":"array","title":"Statements"}},"additionalProperties":true,"type":"object","required":["grouping","periods","statements"],"title":"GetCashFlowStatementsPeriodicResponse","description":"Response for ``get_cash_flow_statements_periodic``."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IndirectReconciliationItem":{"properties":{"label":{"type":"string","title":"Label","description":"Description of the adjustment"},"amount":{"type":"integer","title":"Amount","description":"Adjustment amount (cents)"}},"type":"object","required":["label","amount"],"title":"IndirectReconciliationItem","description":"Legacy memo line preserved for backwards-compat with callers that\nconsumed the ASC 230 indirect reconciliation as a separate list.\n\nUnder the indirect method this content lives on\n``operating_activities.line_items`` directly; the supplemental memo\nre-emits the same data so existing UI/AI consumers keep working."},"NonCashActivity":{"properties":{"description":{"type":"string","title":"Description","description":"Description of the activity"},"amount":{"type":"integer","title":"Amount","description":"Amount of the activity (cents)"},"category":{"type":"string","pattern":"^(investing|financing)$","title":"Category","description":"'investing' or 'financing'"}},"type":"object","required":["description","amount","category"],"title":"NonCashActivity","description":"A non-cash investing or financing activity (ASC 230 disclosure)."},"SuccessEnvelope_GetCashFlowStatementsPeriodicResponse_":{"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/GetCashFlowStatementsPeriodicResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetCashFlowStatementsPeriodicResponse]"},"SupplementalDisclosures":{"properties":{"cash_paid_for_interest":{"type":"integer","title":"Cash Paid For Interest","description":"Cash paid for interest during the period (cents)","default":0},"cash_paid_for_income_taxes":{"type":"integer","title":"Cash Paid For Income Taxes","description":"Cash paid for income taxes during the period (cents)","default":0},"indirect_reconciliation":{"items":{"$ref":"#/components/schemas/IndirectReconciliationItem"},"type":"array","title":"Indirect Reconciliation","description":"Mirror of the operating-section line items as a flat label/amount list; preserved for backwards compatibility with consumers built against the prior schema."},"non_cash_activities":{"items":{"$ref":"#/components/schemas/NonCashActivity"},"type":"array","title":"Non Cash Activities","description":"Significant non-cash investing and financing activities"}},"type":"object","title":"SupplementalDisclosures","description":"ASC 230 supplemental disclosures.\n\nEven under the indirect method, businesses must disclose cash paid\nfor interest and income taxes, plus significant non-cash investing\nand financing activities. We surface those here."},"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":[]}]}