Topolo Docs Topolo Platform
Open workspace

Get opening balances

The conversion date and the opening-balance journal the books start from: each account with its opening debit or credit, the amount that went to the opening-balances account to make it balance, and the totals.

Outcome

The conversion date and the opening-balance journal the books start from: each account with its opening debit or credit, the amount that went to the opening-balances account to make it balance, and the totals.

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.ledger.opening_balances.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/ledger/opening-balances

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

Input fields

Use an empty input object. Credential and resource context are separate.

Inspect nested fields and the complete input schema.

Effects

  • Reads the selected Books ledger result in the credential-scoped organization and applicable canonical workspace. The conversion date and the opening-balance journal the books start from: each account with its opening debit or credit, the amount that went to the opening-balances account to make it balance, and the totals.

Interpret the response

Read $.journal.id for the returned ledger identifier. Empty collections and nullable fields do not discover a target.

Inspect the actual response fields and retained identifiers for the selected organization/workspace. The conversion date and the opening-balance journal the books start from: each account with its opening debit or credit, the amount that went to the opening-balances account to make it balance, and the totals. Use the related published read actions when a returned record or ledger outcome needs further inspection; an HTTP 200 does not establish provider delivery or financial agreement.

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.ledger.opening_balances.get --data @payload.json --json
topolo actions plan app_topolo_books.ledger.opening_balances.get --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.ledger.opening_balances.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.ledger.opening_balances.get",
    "input": {},
    "resourceType": "workspace",
    "resourceId": "<exact granted workspace id>",
    "detail": true
  }
}

Successful response · HTTP 200

Input · payload.json:

{}

Captured response · HTTP 200

{
  "conversionDate": "2025-01-01",
  "postedOn": "2024-12-31",
  "journal": {
    "id": "je_e6ea7db6a9e24dec9091fa4a2af791e7",
    "organization_id": "org_close_muvnpl6v6",
    "workspace_id": "ws_close_muvnpl6v6",
    "sequence": 1,
    "period_key": "2024-12",
    "posted_on": "2024-12-31",
    "event_type": "journal_posted",
    "journal_type": "opening_balance",
    "description": "Opening balances at 2025-01-01",
    "reference": "OPENING",
    "source_app": "topolo-books",
    "source_document_type": null,
    "source_document_id": null,
    "actor_type": "topolo_agent",
    "actor_id": "usr_test",
    "autonomy_level": null,
    "correlation_id": null,
    "idempotency_key": "je_e6ea7db6a9e24dec9091fa4a2af791e7",
    "reverses_event_id": null,
    "reversed_by_event_id": null,
    "total_debit_minor": 5000,
    "total_credit_minor": 5000,
    "line_count": 2,
    "previous_hash": "",
    "hash": "67b416e5be7212d04d836070323e69c07ddfa51a94c9953e46d0f535b740da21",
    "created_at": "2026-10-05T19:42:36.688Z",
    "notes": null
  },
  "lines": [
    {
      "accountId": "acc_17b94eb81de54cfbab0f47a1d0c854d8",
      "code": "1000",
      "name": "Bank account",
      "type": "asset",
      "amountMinor": 5000
    },
    {
      "accountId": "acc_5454c8a48bc34ed38f851cbaf55878bb",
      "code": "3900",
      "name": "Opening balances",
      "type": "equity",
      "amountMinor": -5000
    }
  ],
  "differenceMinor": -5000,
  "totalDebitMinor": 5000,
  "totalCreditMinor": 5000
}

HTTP 200. Inspect the actual response fields and retained identifiers for the selected organization/workspace. The conversion date and the opening-balance journal the books start from: each account with its opening debit or credit, the amount that went to the opening-balances account to make it balance, and the totals. Use the related published read actions when a returned record or ledger outcome needs further inspection; an HTTP 200 does not establish provider delivery or financial agreement.

Refused response · auth_error

Input · payload.json:

{}

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.

Verify the result

  • Inspect the actual response fields and retained identifiers for the selected organization/workspace. The conversion date and the opening-balance journal the books start from: each account with its opening debit or credit, the amount that went to the opening-balances account to make it balance, and the totals.
  • Use the related published read actions when a returned record or ledger outcome needs further inspection; an HTTP 200 does not establish provider delivery or financial agreement.

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

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

  • Get trial balance: Every account holding a balance at the date, each on one side only: debitMinor carries a debit balance, creditMinor a credit balance, and the other is zero. Accounts that net to nothing are left out. totalDebitMinor and totalCreditMinor are the sums of those balances and must agree, which is what balanced reports. These are balances, not turnover: they do not add up everything ever posted to an account, which would count both sides of every entry and count an expense again when a year-end close reverses it.

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.