{"openapi":"3.1.0","info":{"title":"GET /api/v1/ledgers","version":"1.0.0","description":"List ledgers"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/ledgers":{"get":{"tags":["ledgers"],"summary":"List ledgers","description":"Retrieve chart of accounts (ledgers) for the business.","operationId":"get_ledgers_api_v1_ledgers_get","parameters":[{"name":"id","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"description":"Filter by specific ledger UUIDs","default":[],"title":"Id"},"description":"Filter by specific ledger UUIDs"},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by ledger name (partial match)","title":"Name"},"description":"Filter by ledger name (partial match)"},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by type: asset, liability, equity, revenue, expense","title":"Type"},"description":"Filter by type: asset, liability, equity, revenue, expense"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status: active, inactive","title":"Status"},"description":"Filter by status: active, inactive"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination","title":"Cursor"},"description":"Cursor for pagination"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"description":"Pagination limit","title":"Limit"},"description":"Pagination limit"},{"name":"direction","in":"query","required":false,"schema":{"type":"string","description":"Pagination direction: 'next' or 'prev'","default":"next","title":"Direction"},"description":"Pagination direction: 'next' or 'prev'"},{"name":"include_total_count","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to include total count (expensive - avoid if possible)","default":false,"title":"Include Total Count"},"description":"Whether to include total count (expensive - avoid if possible)"},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.","title":"Sort By"},"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None."},{"name":"descending","in":"query","required":false,"schema":{"type":"boolean","description":"Sort direction: true for descending (newest/largest first), false for ascending","default":true,"title":"Descending"},"description":"Sort direction: true for descending (newest/largest first), false for ascending"},{"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/LedgerListResponse"}}}},"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":{"CashFlowClassEnum":{"type":"string","enum":["cash","ar","inventory","prepaid","other_current_asset","ppe","intangible","other_lt_asset","intercompany_asset","internal_transfer","ap","cc_payable","accrued","other_current_liability","lt_debt","intercompany_liability","equity_contribution","equity_distribution","retained_earnings","revenue","cogs","opex","non_cash_expense","interest_expense","tax_expense"],"title":"CashFlowClassEnum","description":"Indirect-method cash flow classification for ledgers.\n\nEach chart-of-account row carries one of these in addition to its\nbroader ``type``. The indirect cash flow statement is built by\ngrouping period-over-period balance deltas by this column.\nMirrors ``app.models.ledgers.CashFlowClassEnum`` for API surface."},"CashFlowSectionEnum":{"type":"string","enum":["operating","investing","financing","excluded"],"title":"CashFlowSectionEnum","description":"Cash flow statement section classification for ledgers."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LedgerListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/LedgerResponse"},"type":"array","title":"Items","description":"List of items"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total number of items (null when not calculated for performance)"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Pagination limit"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Cursor for next page"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor","description":"Cursor for previous page"},"has_next":{"type":"boolean","title":"Has Next","description":"Whether there are more items"},"has_prev":{"type":"boolean","title":"Has Prev","description":"Whether there are previous items"}},"type":"object","required":["items","has_next","has_prev"],"title":"LedgerListResponse","description":"Paginated list of ledgers (chart of accounts) with cursor-based navigation."},"LedgerResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Ledger UUID."},"teal_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teal Ledger Id","description":"Linked Teal accounting system ID."},"name":{"type":"string","title":"Name","description":"Account name."},"currency":{"type":"string","title":"Currency","description":"Currency for this account (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"type":{"type":"string","title":"Type","description":"Account type: asset, liability, equity, revenue, expense."},"balance":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Balance","description":"Current balance in cents (may be negative)."},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id","description":"Parent ledger UUID for sub-accounts."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Account description."},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status","description":"Status: 'active' or 'inactive'."},"debit_credit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Debit Credit","description":"Normal balance: 'debit' or 'credit'."},"sort_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sort Code","description":"Sort code for chart ordering."},"sub_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sub Type","description":"Sub-classification for reporting."},"report_cash_flow":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Report Cash Flow","description":"Whether included in cash flow statement."},"cash_flow_section":{"anyOf":[{"$ref":"#/components/schemas/CashFlowSectionEnum"},{"type":"null"}],"description":"Cash flow statement section: 'operating', 'investing', 'financing', or 'excluded'."},"cfs_class":{"anyOf":[{"$ref":"#/components/schemas/CashFlowClassEnum"},{"type":"null"}],"description":"Indirect-method cash flow classification used to populate the Statement of Cash Flows."},"editable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Editable","description":"Whether journal entries can be manually posted to this account."},"financial_account_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Financial Account Type","description":"Template type if created in Templated Mode."},"is_required":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Required","description":"True for system-required accounts that cannot be deleted."},"system_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Key","description":"Immutable key for system/base ledgers (e.g. 'accounts_receivable'). Null for user-created ledgers."},"teal_account_link_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teal Account Link Id","description":"UUID of the TealAccountLink if this ledger is connected to a bank/Plaid source account. Null for unlinked ledgers."},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"Business UUID."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"Creation timestamp."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"Last update timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","type"],"title":"LedgerResponse","description":"Response schema for a ledger (chart of accounts entry).\n\nA ledger represents an account in the chart of accounts. Each ledger\nhas a type (asset, liability, etc.), current balance, and configuration\nfor how it affects financial reports.","example":{"balance":1523450,"business_id":"019ab37c-bus1-7000-8000-000000000001","created_at":"2024-01-10T10:30:00Z","debit_credit":"debit","description":"Primary operating account","editable":true,"financial_account_type":"bank_account","id":"019ab37c-led1-7000-8000-000000000001","is_required":false,"name":"Chase Business Checking","report_cash_flow":true,"sort_code":"1010","status":"active","sub_type":"current_assets","teal_ledger_id":"led_abc123","type":"asset","updated_at":"2024-01-15T14:00:00Z"}},"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":[]}]}