Topolo Docs Topolo Platform
Open workspace

Apply a chart-of-accounts template

Seed a template's accounts and its jurisdiction tax-rate pack into the workspace. Existing account codes and effective-dated tax codes are skipped, so applying twice is safe; no transactions are created.

Outcome

Seed a template's accounts and its jurisdiction tax-rate pack into the workspace. Existing account codes and effective-dated tax codes are skipped, so applying twice is safe; no transactions are created.

Before you start

  • Verify the intended environment, authenticated identity and specifically approved organization context.
  • The published application permission is accounts:write. Discover the exact granted canonical Books workspace and bind it separately from action input.
  • Approve the actual mutation, accounting inputs and any provider/recipient effects before CLI --confirm or MCP confirm:true. Fixture identifiers and simulated provider responses authorize no live operation.

Discover the target

topolo whoami --json
topolo actions get app_topolo_books.coa.templates.apply --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.
  • templateId: Exact chart template identifier from coa.templates.list; inspect the template before applying it.

Request

POST /api/coa/templates/{templateId}/apply

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

Input fields

FieldRequiredMeaningSchema and constraints
templateIdRequiredExact chart template identifier from coa.templates.list; inspect the template before applying it.{"type":"string","minLength":1}

Inspect nested fields and the complete input schema.

Effects

  • Creates the template's accounts and matching jurisdiction tax-rate pack. Existing account codes and effective-dated tax codes are left alone, so applying twice is safe, and no transactions are created.

Interpret the response

Read $.settings.workspace_id for the returned workspace identifier. Empty collections and nullable fields do not discover a target.

Call app_topolo_books.accounts.list and app_topolo_books.tax.rates.list, then confirm the created counts.

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.coa.templates.apply --data @payload.json --json
topolo actions plan app_topolo_books.coa.templates.apply --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.coa.templates.apply --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --confirm --detail --json

MCP tool and arguments for the first successful example:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_books.coa.templates.apply",
    "input": {
      "templateId": "uk_ltd"
    },
    "resourceType": "workspace",
    "resourceId": "<exact granted workspace id>",
    "confirm": true,
    "detail": true
  }
}

Refused response · auth_error

Input · payload.json:

{
  "templateId": "uk_ltd"
}

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:

{
  "templateId": "uk_ltd"
}

Captured response · HTTP 200

{
  "template": "uk_ltd",
  "created": 42,
  "skipped": 0,
  "taxRates": {
    "created": 15,
    "skipped": 0
  },
  "settings": {
    "workspace_id": "ws_route_muvnp2sb19",
    "organization_id": "org_route_muvnp2sb19",
    "base_currency": "GBP",
    "fiscal_year_start_month": 4,
    "lock_date": null,
    "coa_template": "uk_ltd",
    "created_at": "2026-10-05T19:42:12.832Z",
    "updated_at": "2026-10-05T19:42:12.833Z",
    "invoice_business_name": null,
    "invoice_legal_name": null,
    "invoice_email": null,
    "invoice_phone": null,
    "invoice_website": null,
    "invoice_registration_number": null,
    "invoice_tax_number": null,
    "invoice_address_line1": null,
    "invoice_address_line2": null,
    "invoice_city": null,
    "invoice_region": null,
    "invoice_postal_code": null,
    "invoice_country": null,
    "invoice_payment_instructions": null,
    "invoice_footer": null,
    "invoice_template": "modern",
    "conversion_date": null,
    "invoice_bank_account_name": null,
    "invoice_bank_name": null,
    "invoice_bank_account_number": null,
    "invoice_bank_routing_number": null,
    "invoice_bank_sort_code": null,
    "invoice_bank_iban": null,
    "invoice_bank_swift_bic": null,
    "invoice_bank_currency": null,
    "invoice_auto_create_public_page": 0,
    "invoice_auto_create_payment_link": 0,
    "invoice_payment_merchant_id": null,
    "invoice_payment_provider_account_id": null
  }
}

HTTP 200. Call app_topolo_books.accounts.list and app_topolo_books.tax.rates.list, then confirm the created counts.

Successful response · HTTP 200

Input · payload.json:

{
  "templateId": "generic"
}

Captured response · HTTP 200

{
  "template": "generic",
  "created": 36,
  "skipped": 0,
  "taxRates": {
    "created": 0,
    "skipped": 0
  },
  "settings": {
    "workspace_id": "ws_money_muvnp2uk20",
    "organization_id": "org_money_muvnp2uk20",
    "base_currency": "USD",
    "fiscal_year_start_month": 1,
    "lock_date": null,
    "coa_template": "generic",
    "created_at": "2026-10-05T19:42:12.910Z",
    "updated_at": "2026-10-05T19:42:12.910Z",
    "invoice_business_name": null,
    "invoice_legal_name": null,
    "invoice_email": null,
    "invoice_phone": null,
    "invoice_website": null,
    "invoice_registration_number": null,
    "invoice_tax_number": null,
    "invoice_address_line1": null,
    "invoice_address_line2": null,
    "invoice_city": null,
    "invoice_region": null,
    "invoice_postal_code": null,
    "invoice_country": null,
    "invoice_payment_instructions": null,
    "invoice_footer": null,
    "invoice_template": "modern",
    "conversion_date": null,
    "invoice_bank_account_name": null,
    "invoice_bank_name": null,
    "invoice_bank_account_number": null,
    "invoice_bank_routing_number": null,
    "invoice_bank_sort_code": null,
    "invoice_bank_iban": null,
    "invoice_bank_swift_bic": null,
    "invoice_bank_currency": null,
    "invoice_auto_create_public_page": 0,
    "invoice_auto_create_payment_link": 0,
    "invoice_payment_merchant_id": null,
    "invoice_payment_provider_account_id": null
  }
}

HTTP 200. Call app_topolo_books.accounts.list and app_topolo_books.tax.rates.list, then confirm the created counts.

Successful response · HTTP 200

Input · payload.json:

{
  "templateId": "uk_ltd"
}

Captured response · HTTP 200

{
  "template": "uk_ltd",
  "created": 42,
  "skipped": 0,
  "taxRates": {
    "created": 15,
    "skipped": 0
  },
  "settings": {
    "workspace_id": "ws_auto-route_muvnp2v321",
    "organization_id": "org_auto-route_muvnp2v321",
    "base_currency": "GBP",
    "fiscal_year_start_month": 4,
    "lock_date": null,
    "coa_template": "uk_ltd",
    "created_at": "2026-10-05T19:42:12.930Z",
    "updated_at": "2026-10-05T19:42:12.931Z",
    "invoice_business_name": null,
    "invoice_legal_name": null,
    "invoice_email": null,
    "invoice_phone": null,
    "invoice_website": null,
    "invoice_registration_number": null,
    "invoice_tax_number": null,
    "invoice_address_line1": null,
    "invoice_address_line2": null,
    "invoice_city": null,
    "invoice_region": null,
    "invoice_postal_code": null,
    "invoice_country": null,
    "invoice_payment_instructions": null,
    "invoice_footer": null,
    "invoice_template": "modern",
    "conversion_date": null,
    "invoice_bank_account_name": null,
    "invoice_bank_name": null,
    "invoice_bank_account_number": null,
    "invoice_bank_routing_number": null,
    "invoice_bank_sort_code": null,
    "invoice_bank_iban": null,
    "invoice_bank_swift_bic": null,
    "invoice_bank_currency": null,
    "invoice_auto_create_public_page": 0,
    "invoice_auto_create_payment_link": 0,
    "invoice_payment_merchant_id": null,
    "invoice_payment_provider_account_id": null
  }
}

HTTP 200. Call app_topolo_books.accounts.list and app_topolo_books.tax.rates.list, then confirm the created counts.

Successful response · HTTP 200

Input · payload.json:

{
  "templateId": "uk_ltd"
}

Captured response · HTTP 200

{
  "template": "uk_ltd",
  "created": 42,
  "skipped": 0,
  "taxRates": {
    "created": 15,
    "skipped": 0
  },
  "settings": {
    "workspace_id": "ws_recurring-route_muvnp2vt22",
    "organization_id": "org_recurring-route_muvnp2vt22",
    "base_currency": "GBP",
    "fiscal_year_start_month": 4,
    "lock_date": null,
    "coa_template": "uk_ltd",
    "created_at": "2026-10-05T19:42:12.955Z",
    "updated_at": "2026-10-05T19:42:12.956Z",
    "invoice_business_name": null,
    "invoice_legal_name": null,
    "invoice_email": null,
    "invoice_phone": null,
    "invoice_website": null,
    "invoice_registration_number": null,
    "invoice_tax_number": null,
    "invoice_address_line1": null,
    "invoice_address_line2": null,
    "invoice_city": null,
    "invoice_region": null,
    "invoice_postal_code": null,
    "invoice_country": null,
    "invoice_payment_instructions": null,
    "invoice_footer": null,
    "invoice_template": "modern",
    "conversion_date": null,
    "invoice_bank_account_name": null,
    "invoice_bank_name": null,
    "invoice_bank_account_number": null,
    "invoice_bank_routing_number": null,
    "invoice_bank_sort_code": null,
    "invoice_bank_iban": null,
    "invoice_bank_swift_bic": null,
    "invoice_bank_currency": null,
    "invoice_auto_create_public_page": 0,
    "invoice_auto_create_payment_link": 0,
    "invoice_payment_merchant_id": null,
    "invoice_payment_provider_account_id": null
  }
}

HTTP 200. Call app_topolo_books.accounts.list and app_topolo_books.tax.rates.list, then confirm the created counts.

Successful response · HTTP 200

Input · payload.json:

{
  "templateId": "us_llc"
}

Captured response · HTTP 200

{
  "template": "us_llc",
  "created": 42,
  "skipped": 0,
  "taxRates": {
    "created": 0,
    "skipped": 0
  },
  "settings": {
    "workspace_id": "ws_e2e_muvnp7qn2",
    "organization_id": "org_e2e_muvnp7qn2",
    "base_currency": "USD",
    "fiscal_year_start_month": 1,
    "lock_date": null,
    "coa_template": "us_llc",
    "created_at": "2026-10-05T19:42:19.263Z",
    "updated_at": "2026-10-05T19:42:19.264Z",
    "invoice_business_name": null,
    "invoice_legal_name": null,
    "invoice_email": null,
    "invoice_phone": null,
    "invoice_website": null,
    "invoice_registration_number": null,
    "invoice_tax_number": null,
    "invoice_address_line1": null,
    "invoice_address_line2": null,
    "invoice_city": null,
    "invoice_region": null,
    "invoice_postal_code": null,
    "invoice_country": null,
    "invoice_payment_instructions": null,
    "invoice_footer": null,
    "invoice_template": "modern",
    "conversion_date": null,
    "invoice_bank_account_name": null,
    "invoice_bank_name": null,
    "invoice_bank_account_number": null,
    "invoice_bank_routing_number": null,
    "invoice_bank_sort_code": null,
    "invoice_bank_iban": null,
    "invoice_bank_swift_bic": null,
    "invoice_bank_currency": null,
    "invoice_auto_create_public_page": 0,
    "invoice_auto_create_payment_link": 0,
    "invoice_payment_merchant_id": null,
    "invoice_payment_provider_account_id": null
  }
}

HTTP 200. Call app_topolo_books.accounts.list and app_topolo_books.tax.rates.list, then confirm the created counts.

Verify the result

  • Call app_topolo_books.accounts.list and app_topolo_books.tax.rates.list, then confirm the created counts.

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.

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

Archive each account the apply created. Accounts are never deleted, so history keeps resolving.

  • List accounts: List the chart of accounts. Filter by type or archived state, search across code, name and description, and sort by code, name, type, subtype or status.
  • Post a journal: Post a balanced manual journal to the ledger. Optionally schedule its exact reversal for the first day of a later month with autoReverseOn. Refused with unbalanced_journal, period_locked, account_not_found or account_archived; an idempotencyKey replays the same event. Every line is signed base-currency minor units: positive debit, negative credit.
  • Archive account: Archive an account so nothing new posts to it. Accounts are never deleted; system accounts cannot be archived.

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.