Outcome
Lock a draft supplier bill so it can take payments. Repeating the action returns the already-approved bill.
Before you start
- Verify the intended environment, authenticated identity and specifically approved organization context.
- The published application permission is bills: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.bills.approve --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.
- documentId: Exact document.id from invoices.list/get or bills.list/get, as appropriate to this action; the displayed invoice number is distinct.
Request
POST /api/bills/{documentId}/approve
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 |
|---|---|---|---|
documentId | Required | Exact document.id from invoices.list/get or bills.list/get, as appropriate to this action; the displayed invoice number is distinct. | {"type":"string","minLength":1} |
Inspect nested fields and the complete input schema.
Effects
- Locks the draft bill so its financial details cannot be rewritten after approval.
Interpret the response
Read $.document.id for the returned bill identifier. Empty collections and nullable fields do not discover a target.
Call app_topolo_books.bills.get and confirm approved_at is populated.
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.bills.approve --data @payload.json --json
topolo actions plan app_topolo_books.bills.approve --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.bills.approve --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.bills.approve",
"input": {
"documentId": "doc_ed6a61b948484d9c806b03ebfdf279ec"
},
"resourceType": "workspace",
"resourceId": "<exact granted workspace id>",
"confirm": true,
"detail": true
}
}
Refused response · auth_error
Input · payload.json:
{
"documentId": "doc_11bc"
}
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:
{
"documentId": "doc_ed6a61b948484d9c806b03ebfdf279ec"
}
Captured response · HTTP 200
{
"document": {
"id": "doc_ed6a61b948484d9c806b03ebfdf279ec",
"organization_id": "org_documentation-bill_muvnpncj3",
"workspace_id": "ws_documentation-bill_muvnpncj3",
"kind": "bill",
"contact_id": "con_bc225ee51ce54ade8a7ac316eccfae32",
"number": null,
"reference": "FIXTURE-PO",
"issue_date": "2026-09-01",
"due_date": null,
"period_key": "2026-09",
"currency": "GBP",
"exchange_rate": null,
"subtotal_minor": 2500,
"tax_minor": 0,
"total_minor": 2500,
"base_total_minor": 2500,
"paid_minor": 0,
"status": "awaiting_payment",
"notes": null,
"posted_event_id": "je_973c8413e0414d91b0ce72306d6aa1d1",
"source": "manual",
"source_document_id": null,
"created_at": "2026-10-05T19:42:39.488Z",
"updated_at": "2026-10-05T19:42:39.498Z",
"sequence_no": null,
"approved_at": "2026-10-05T19:42:39.498Z",
"sent_at": null,
"amounts_include_tax": 0,
"design_project_id": null,
"design_export_id": null,
"design_rendered_at": null,
"brand_kit_id": null,
"brand_version_id": null,
"written_off_minor": 0
},
"automation": null
}
HTTP 200. Call app_topolo_books.bills.get and confirm approved_at is populated.
Successful response · HTTP 200
Input · payload.json:
{
"documentId": "doc_0812a78c9a6f484ca1114dc19582b02e"
}
Captured response · HTTP 200
{
"document": {
"id": "doc_0812a78c9a6f484ca1114dc19582b02e",
"organization_id": "org_doc-lifecycle-route_muvnp46b12",
"workspace_id": "ws_doc-lifecycle-route_muvnp46b12",
"kind": "bill",
"contact_id": "con_b3da013894b9468593b2db7e2eef7edd",
"number": "SUP-2",
"reference": null,
"issue_date": "2026-03-02",
"due_date": null,
"period_key": "2026-03",
"currency": "USD",
"exchange_rate": null,
"subtotal_minor": 750,
"tax_minor": 0,
"total_minor": 750,
"base_total_minor": 750,
"paid_minor": 0,
"status": "awaiting_payment",
"notes": null,
"posted_event_id": null,
"source": "manual",
"source_document_id": null,
"created_at": "2026-10-05T19:42:14.652Z",
"updated_at": "2026-10-05T19:42:14.655Z",
"sequence_no": null,
"approved_at": "2026-10-05T19:42:14.655Z",
"sent_at": null,
"amounts_include_tax": 0,
"design_project_id": null,
"design_export_id": null,
"design_rendered_at": null,
"brand_kit_id": null,
"brand_version_id": null,
"written_off_minor": 0
},
"automation": null
}
HTTP 200. Call app_topolo_books.bills.get and confirm approved_at is populated.
Refused response · document_not_found
Input · payload.json:
{
"documentId": "doc_84c6e8cdae9c4f1c8df757d41576e61d"
}
Captured response · HTTP 404
{
"error": "document_not_found",
"message": "Bill doc_84c6e8cdae9c4f1c8df757d41576e61d does not exist in this workspace"
}
HTTP 404. SDK error code document_not_found. Use invoices.list/get or bills.list/get in the same workspace and retain document.id. The invoice number is not its id.
Verify the result
- Call app_topolo_books.bills.get and confirm approved_at is populated.
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.document_not_found(HTTP 404): Use invoices.list/get or bills.list/get in the same workspace and retain document.id. The invoice number is not its id.
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
Void the approved bill and enter a replacement if its financial details were wrong.
Related actions
- Record a payment: Record money paid against a bill. The paid total is the sum of the payments, and the document becomes paid once they cover it.
- List bills: List bills newest first. Filter by status, contact or issue date, search the number, reference and notes, and sort by issue date, due date, number, total or status. The response carries the outstanding total for the filtered set.
- Void a bill: Void a bill while keeping its supplier number and history readable. Refused while payments are recorded against 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.