Outcome
Compute the nine UK VAT return boxes from posted invoices and bills for a date range, applying effective-dated standard, cash accounting, flat-rate or annual-accounting schemes and returning source-line drill-down.
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.reports.vat_return.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/reports/vat-return
Inspect and test this action. Save the reviewed input as payload.json; supply credential/resource context separately.
Input fields
| Field | Required | Meaning | Schema and constraints |
|---|---|---|---|
from | Optional | from | {"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"} |
to | Optional | to | {"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"} |
Inspect nested fields and the complete input schema.
Effects
- Reads posted invoice and bill tax without changing the ledger. Cash accounting follows payment dates; flat rate applies the configured trade percentage and limited-cost-trader rule.
Interpret the response
Read $.to for the returned vat_return identifier. Empty collections and nullable fields do not discover a target.
Confirm boxes 3 and 5 reconcile to boxes 1 plus 2 and box 3 less box 4, then inspect lines for each contributing document.
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.reports.vat_return.get --data @payload.json --json
topolo actions plan app_topolo_books.reports.vat_return.get --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.reports.vat_return.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.reports.vat_return.get",
"input": {
"from": "2026-01-01",
"to": "2026-12-31"
},
"resourceType": "workspace",
"resourceId": "<exact granted workspace id>",
"detail": true
}
}
Refused response · auth_error
Input · payload.json:
{
"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:
{
"from": "2026-01-01",
"to": "2026-12-31"
}
Captured response · HTTP 200
{
"from": "2026-01-01",
"to": "2026-12-31",
"currency": "GBP",
"schemes": [
{
"id": "vts_4cf4763f8bd44638b0d3770158faec96",
"scheme": "annual",
"tradeSector": null,
"flatRatePercent": null,
"limitedCostTrader": false,
"firstYearDiscountUntil": null,
"from": "2026-01-01",
"to": "2026-12-31"
}
],
"boxes": [
{
"number": 1,
"label": "VAT due on sales and other outputs",
"amountMinor": 0
},
{
"number": 2,
"label": "VAT due on acquisitions from other EC Member States",
"amountMinor": 0
},
{
"number": 3,
"label": "Total VAT due",
"amountMinor": 0
},
{
"number": 4,
"label": "VAT reclaimed on purchases and other inputs",
"amountMinor": 0
},
{
"number": 5,
"label": "Net VAT to pay or reclaim",
"amountMinor": 0
},
{
"number": 6,
"label": "Total value of sales and other outputs excluding VAT",
"amountMinor": 0
},
{
"number": 7,
"label": "Total value of purchases and other inputs excluding VAT",
"amountMinor": 0
},
{
"number": 8,
"label": "Total value of dispatches of goods to EC Member States",
"amountMinor": 0
},
{
"number": 9,
"label": "Total value of acquisitions of goods from EC Member States",
"amountMinor": 0
}
],
"lines": [],
"warnings": []
}
HTTP 200. Confirm boxes 3 and 5 reconcile to boxes 1 plus 2 and box 3 less box 4, then inspect lines for each contributing document.
Verify the result
- Confirm boxes 3 and 5 reconcile to boxes 1 plus 2 and box 3 less box 4, then inspect lines for each contributing document.
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
This action is read-only.
Related actions
- 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.