Topolo Docs Topolo Platform
Open workspace

Export a ledger dataset

Rows of one ledger dataset: chart_of_accounts, tax_rates, periods, journals (from/to), trial_balance (asOf), profit_and_loss, cash_flow (from/to) or balance_sheet (asOf). Flat rows with account codes and names, decimal amounts in the base currency, the columns exports.datasets.list documents. The whole set, never paged.

Outcome

Rows of one ledger dataset: chart_of_accounts, tax_rates, periods, journals (from/to), trial_balance (asOf), profit_and_loss, cash_flow (from/to) or balance_sheet (asOf). Flat rows with account codes and names, decimal amounts in the base currency, the columns exports.datasets.list documents. The whole set, never paged.

Before you start

  • Verify the intended environment, authenticated identity and specifically approved organization context.
  • The published application permission is ledger:read. Discover the exact granted canonical Books workspace and bind it separately from action input.

Discover the target

topolo whoami --json
topolo actions get app_topolo_books.exports.ledger.get --detail --json
topolo resources topolo-books --json
topolo workspaces list topolo-books --json
  • Set BOOKS_WORKSPACE_ID to the exact granted workspace returned by discovery.

Request

GET /api/exports/ledger/{dataset}

Inspect and test this action. Save the reviewed input as payload.json; supply credential/resource context separately.

Input fields

FieldRequiredMeaningSchema and constraints
datasetRequireddataset{"type":"string","pattern":"^[a-z_]+$"}
fromOptionalfrom{"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"}
toOptionalto{"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"}
asOfOptionalas Of{"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"}

Inspect nested fields and the complete input schema.

Effects

  • Reads the whole dataset without changing anything. Large workspaces return many rows; there is no paging by design, an export is the complete set.

Interpret the response

Read $.dataset for the returned export_dataset identifier. Empty collections and nullable fields do not discover a target.

No verification needed for a read. A journals export re-imports through app_topolo_books.journals.import; a chart export through app_topolo_books.accounts.import with format generic.

Inspect the success schema. CLI/MCP add their own transport envelope; CLI --detail requests the full result.

Worked examples

Actual Books route handlers and the exported Worker were exercised against five local SQLite D1 concern databases with all committed migrations, the real posting Durable Object and local R2. Route captures use synthetic verified Auth; Worker captures use synthetic Auth transports. Nexus, Brand, Notify, Pay, Mercury and Xero responses are explicitly simulated at the provider transport boundary. Captures prove local request/response behavior and canonical SDK projection, not live bank access, payment movement, email delivery, provider eligibility, tax compliance, encrypted custody, scheduled execution, deployment or production completion. Fixture identities, credentials, addresses and records authorize no live operation.

Run a reviewed request

Save the input from the selected worked example as payload.json. Validate and inspect the plan before calling the action; refused examples demonstrate errors and are not instructions to execute.

CLI:

topolo actions validate app_topolo_books.exports.ledger.get --data @payload.json --json
topolo actions plan app_topolo_books.exports.ledger.get --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.exports.ledger.get --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --detail --json

MCP tool and arguments for the first successful example:

{
  "tool": "topolo_read_action",
  "arguments": {
    "actionId": "app_topolo_books.exports.ledger.get",
    "input": {
      "dataset": "chart_of_accounts"
    },
    "resourceType": "workspace",
    "resourceId": "<exact granted workspace id>",
    "detail": true
  }
}

Refused response · auth_error

Input · payload.json:

{
  "dataset": "journals",
  "from": "2026-04-01",
  "to": "2026-06-30"
}

Captured response · HTTP 401

{
  "error": "API key validation failed"
}

HTTP 401. SDK error code auth_error. Authenticate in the intended organization again. Verify whoami and the exact Books application/workspace binding before retrying; do not switch identity to work around a refusal.

Successful response · HTTP 200

Input · payload.json:

{
  "dataset": "chart_of_accounts"
}

Captured response · HTTP 200

{
  "dataset": "chart_of_accounts",
  "title": "Chart of accounts",
  "generatedAt": "2026-10-05T19:42:40.948Z",
  "currency": "USD",
  "parameters": {},
  "columns": [
    {
      "key": "code",
      "title": "Code",
      "type": "string",
      "description": "Account code"
    },
    {
      "key": "name",
      "title": "Name",
      "type": "string",
      "description": "Account name"
    },
    {
      "key": "type",
      "title": "Type",
      "type": "string",
      "description": "asset, liability, equity, income or expense"
    },
    {
      "key": "subtype",
      "title": "Subtype",
      "type": "string",
      "description": "Finer classification used by the statements"
    },
    {
      "key": "description",
      "title": "Description",
      "type": "string",
      "description": "Free text"
    },
    {
      "key": "status",
      "title": "Status",
      "type": "string",
      "description": "active or archived"
    },
    {
      "key": "system_key",
      "title": "System role",
      "type": "string",
      "description": "The ledger role the account plays, if any"
    },
    {
      "key": "parent_code",
      "title": "Parent code",
      "type": "string",
      "description": "Code of the parent account, if any"
    }
  ],
  "rows": [
    {
      "code": "1000",
      "name": "Bank account",
      "type": "asset",
      "subtype": "bank",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "1050",
      "name": "Cash on hand",
      "type": "asset",
      "subtype": "cash",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "1100",
      "name": "Accounts receivable",
      "type": "asset",
      "subtype": "receivable",
      "description": null,
      "status": "active",
      "system_key": "accounts_receivable",
      "parent_code": null
    },
    {
      "code": "1150",
      "name": "Undeposited funds",
      "type": "asset",
      "subtype": "cash",
      "description": null,
      "status": "active",
      "system_key": "undeposited_funds",
      "parent_code": null
    },
    {
      "code": "1200",
      "name": "Prepayments",
      "type": "asset",
      "subtype": "prepayment",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "1300",
      "name": "Inventory",
      "type": "asset",
      "subtype": "inventory",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "1500",
      "name": "Fixed assets",
      "type": "asset",
      "subtype": "fixed_asset",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "1550",
      "name": "Accumulated depreciation",
      "type": "asset",
      "subtype": "accumulated_depreciation",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "2050",
      "name": "Credit card",
      "type": "liability",
      "subtype": "credit_card",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "2100",
      "name": "Accounts payable",
      "type": "liability",
      "subtype": "payable",
      "description": null,
      "status": "active",
      "system_key": "accounts_payable",
      "parent_code": null
    },
    {
      "code": "2200",
      "name": "Tax control",
      "type": "liability",
      "subtype": "tax",
      "description": null,
      "status": "active",
      "system_key": "tax_control",
      "parent_code": null
    },
    {
      "code": "2210",
      "name": "Payroll tax payable",
      "type": "liability",
      "subtype": "tax",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "2230",
      "name": "Federal income tax payable",
      "type": "liability",
      "subtype": "tax",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "2240",
      "name": "State income tax payable",
      "type": "liability",
      "subtype": "tax",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "2300",
      "name": "Accruals",
      "type": "liability",
      "subtype": "accrual",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "2400",
      "name": "Deferred revenue",
      "type": "liability",
      "subtype": "deferred_revenue",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "2500",
      "name": "Loans",
      "type": "liability",
      "subtype": "loan",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "3000",
      "name": "Members' equity",
      "type": "equity",
      "subtype": "owner_capital",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "3100",
      "name": "Distributions",
      "type": "equity",
      "subtype": "distribution",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "3200",
      "name": "Retained earnings",
      "type": "equity",
      "subtype": "retained_earnings",
      "description": null,
      "status": "active",
      "system_key": "retained_earnings",
      "parent_code": null
    },
    {
      "code": "3900",
      "name": "Opening balances",
      "type": "equity",
      "subtype": "opening_balances",
      "description": null,
      "status": "active",
      "system_key": "opening_balances",
      "parent_code": null
    },
    {
      "code": "4000",
      "name": "Sales",
      "type": "income",
      "subtype": "revenue",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "4100",
      "name": "Other income",
      "type": "income",
      "subtype": "other_income",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "4900",
      "name": "Foreign exchange gain / loss",
      "type": "income",
      "subtype": "other_income",
      "description": null,
      "status": "active",
      "system_key": "fx_gain_loss",
      "parent_code": null
    },
    {
      "code": "5000",
      "name": "Cost of sales",
      "type": "expense",
      "subtype": "cost_of_sales",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "5200",
      "name": "Payment processing fees",
      "type": "expense",
      "subtype": "cost_of_sales",
      "description": null,
      "status": "active",
      "system_key": "payment_processing_fees",
      "parent_code": null
    },
    {
      "code": "6000",
      "name": "Advertising and marketing",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6100",
      "name": "Bank fees",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6200",
      "name": "Software and subscriptions",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6300",
      "name": "Office and supplies",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6400",
      "name": "Professional fees",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6500",
      "name": "Rent",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6600",
      "name": "Travel",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6700",
      "name": "Insurance",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "6800",
      "name": "Utilities",
      "type": "expense",
      "subtype": "operating",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "7000",
      "name": "Wages and salaries",
      "type": "expense",
      "subtype": "payroll",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "7100",
      "name": "Payroll taxes",
      "type": "expense",
      "subtype": "payroll",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "7200",
      "name": "Employee benefits",
      "type": "expense",
      "subtype": "payroll",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "8000",
      "name": "Depreciation",
      "type": "expense",
      "subtype": "depreciation",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "8100",
      "name": "Interest expense",
      "type": "expense",
      "subtype": "interest",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "8200",
      "name": "Income tax expense",
      "type": "expense",
      "subtype": "tax",
      "description": null,
      "status": "active",
      "system_key": null,
      "parent_code": null
    },
    {
      "code": "8900",
      "name": "Rounding",
      "type": "expense",
      "subtype": "other_expense",
      "description": null,
      "status": "active",
      "system_key": "rounding",
      "parent_code": null
    }
  ],
  "rowCount": 42
}

HTTP 200. No verification needed for a read. A journals export re-imports through app_topolo_books.journals.import; a chart export through app_topolo_books.accounts.import with format generic.

Refused response · forbidden

Input · payload.json:

{
  "dataset": "chart_of_accounts"
}

Captured response · HTTP 403

{
  "error": "forbidden"
}

HTTP 403. SDK error code forbidden. The credential lacks permission or the resource is outside its scope. Compare the published action permission and discovered workspace binding; obtain the appropriate authorization before another call.

Refused response · dataset_not_found

Input · payload.json:

{
  "dataset": "nope"
}

Captured response · HTTP 404

{
  "error": "dataset_not_found",
  "message": "No ledger dataset named nope",
  "details": {
    "datasets": [
      "chart_of_accounts",
      "tax_rates",
      "periods",
      "journals",
      "trial_balance",
      "profit_and_loss",
      "balance_sheet",
      "cash_flow"
    ]
  }
}

HTTP 404. SDK error code dataset_not_found. Discover exports.datasets.list and use the exact dataset key and declared date parameters; a route-family name is not a dataset.

Verify the result

  • No verification needed for a read. A journals export re-imports through app_topolo_books.journals.import; a chart export through app_topolo_books.accounts.import with format generic.

Errors and recovery

  • auth_error (HTTP 401): Authenticate in the intended organization again. Verify whoami and the exact Books application/workspace binding before retrying; do not switch identity to work around a refusal.
  • forbidden (HTTP 403): The credential lacks permission or the resource is outside its scope. Compare the published action permission and discovered workspace binding; obtain the appropriate authorization before another call.
  • dataset_not_found (HTTP 404): Discover exports.datasets.list and use the exact dataset key and declared date parameters; a route-family name is not a dataset.

These are observed local refusals. Shared authentication, schema validation and resource authorization can also refuse before the route. Preserve the actual error, details and request id.

Recovery boundary

Repeat a read in the same authorized context; no state is changed.

  • List export datasets: Describe every dataset Books can export: its key, the route family and permission that serves it, the date parameters it takes, and every column with its type and meaning. The chart and journal datasets use the column names the importers read, so an export re-imports.

Evidence

Actual Books route handlers and the exported Worker were exercised against five local SQLite D1 concern databases with all committed migrations, the real posting Durable Object and local R2. Route captures use synthetic verified Auth; Worker captures use synthetic Auth transports. Nexus, Brand, Notify, Pay, Mercury and Xero responses are explicitly simulated at the provider transport boundary. Captures prove local request/response behavior and canonical SDK projection, not live bank access, payment movement, email delivery, provider eligibility, tax compliance, encrypted custody, scheduled execution, deployment or production completion. Fixture identities, credentials, addresses and records authorize no live operation.