{"openapi":"3.1.0","info":{"title":"GET /api/v1/businesses/{business_id}/income-statement","version":"1.0.0","description":"Get income statement (sectioned)"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/{business_id}/income-statement":{"get":{"tags":["businesses"],"summary":"Get income statement (sectioned)","description":"Income statement grouped by section. Each section contains ledger line items with period values as top-level keys.","operationId":"get_income_statement_api_v1_businesses__business_id__income_statement_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","minLength":1,"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","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude line items with all-zero values","default":false,"title":"Hide Zero Rows"},"description":"Exclude line items with all-zero values"},{"name":"period_granularity","in":"query","required":false,"schema":{"type":"string","description":"Period grouping: monthly, quarterly, or yearly","default":"monthly","title":"Period Granularity"},"description":"Period grouping: monthly, quarterly, or yearly"},{"name":"tag_ids","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"description":"Filter by tag UUIDs — only line entries tagged with at least one of these tags are included","default":[],"title":"Tag Ids"},"description":"Filter by tag UUIDs — only line entries tagged with at least one of these tags are included"},{"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_GetIncomeStatementResponse_"}}}},"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":{"GetIncomeStatementResponse":{"items":{"$ref":"#/components/schemas/IncomeStatementSectionBlock"},"type":"array","title":"GetIncomeStatementResponse","description":"Sectioned income statement (list of section blocks)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IncomeStatementRow":{"properties":{"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"},"ledger_name":{"type":"string","title":"Ledger Name"},"total":{"type":"integer","title":"Total"}},"additionalProperties":true,"type":"object","required":["ledger_name","total"],"title":"IncomeStatementRow","description":"Ledger row within an income-statement section; period keys are dynamic."},"IncomeStatementSectionBlock":{"properties":{"section":{"type":"string","title":"Section"},"rows":{"items":{"$ref":"#/components/schemas/IncomeStatementRow"},"type":"array","title":"Rows"},"total_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Amount"}},"additionalProperties":true,"type":"object","required":["section","rows"],"title":"IncomeStatementSectionBlock","description":"Revenue / expense section with period-valued rows."},"SuccessEnvelope_GetIncomeStatementResponse_":{"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/GetIncomeStatementResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetIncomeStatementResponse]"},"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":[]}]}