Outcome
Send an approved invoice to an external email address through Topolo Notify, with the branded PDF attached and a secure hosted-invoice link. The invoice is marked sent after Notify accepts the email dispatch. Provider delivery is confirmed separately in invoice delivery history.
Before you start
- Verify the intended environment, authenticated identity and specifically approved organization context.
- The published application permission is invoices: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.invoices.deliver --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.
- attemptId: Identifier for a deliberate send attempt, distinct from the invoice id and notification event id.
Request
POST /api/invoices/{documentId}/deliver
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} |
recipientEmail | Required | Actual specifically approved recipient address; an example address does not authorize sending. | {"type":"string","maxLength":320,"format":"email","pattern":"^(?!\.)(?!.\.\.)([A-Za-z0-9_'+\-\.])[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$"} |
recipientName | Optional | recipient Name | {"type":"string","minLength":1,"maxLength":200} |
message | Optional | message | {"type":"string","maxLength":2000} |
resend | Optional | Explicitly request another invoice send attempt; inspect prior dispatch state and deliberately supply a new attemptId. | {"type":"boolean"} |
attemptId | Optional | Identifier for a deliberate send attempt, distinct from the invoice id and notification event id. | {"type":"string","minLength":1,"maxLength":100} |
Inspect nested fields and the complete input schema.
Effects
- Creates or reuses a public invoice share and renders the current branded PDF. It submits a Notify event for the supplied recipient, then reads dispatch state. Notify acceptance and provider acceptance are distinct from delivery to the recipient.
- A sent dispatch records invoice.sent_at; queued returns HTTP 202 and document:null. An already sent identical idempotency key is reused. resend:true requires a deliberate new attemptId and creates another send attempt.
Interpret the response
Read $.document.id for the returned invoice identifier. Empty collections and nullable fields do not discover a target.
Call app_topolo_books.invoices.deliveries.list and confirm the attempt recipient and provider status. Also call invoices.get and confirm sent_at is populated after delivery.status is sent.
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.invoices.deliver --data @payload.json --json
topolo actions plan app_topolo_books.invoices.deliver --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.invoices.deliver --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.invoices.deliver",
"input": {
"documentId": "doc_9ada81eb3f4c4f648fff8d8640edd8cd",
"recipientEmail": "recipient@example.com"
},
"resourceType": "workspace",
"resourceId": "<exact granted workspace id>",
"confirm": true,
"detail": true
}
}
Successful response · HTTP 200
Input · payload.json:
{
"documentId": "doc_9ada81eb3f4c4f648fff8d8640edd8cd",
"recipientEmail": "recipient@example.com"
}
Captured response · HTTP 200
{
"document": {
"id": "doc_9ada81eb3f4c4f648fff8d8640edd8cd",
"organization_id": "org_documentation-delivery_muvnprkx3",
"workspace_id": "ws_documentation-delivery_muvnprkx3",
"kind": "invoice",
"contact_id": "con_2219672edbcb4ef09fae8d9555c048a1",
"number": "INV-000001",
"reference": null,
"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_53ba46239d804a01bd78c8fc2ad67c59",
"source": "manual",
"source_document_id": null,
"created_at": "2026-10-05T19:42:44.978Z",
"updated_at": "2026-10-05T19:42:45.043Z",
"sequence_no": 1,
"approved_at": "2026-10-05T19:42:44.983Z",
"sent_at": "2026-10-05T19:42:45.043Z",
"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
},
"delivery": {
"eventId": "evt_d9a37758-aabb-41c4-8fe6-244385856e4c",
"status": "sent",
"recipientEmail": "recipient@example.com"
}
}
HTTP 200. Call app_topolo_books.invoices.deliveries.list and confirm the attempt recipient and provider status. Also call invoices.get and confirm sent_at is populated after delivery.status is sent.
Refused response · auth_error
Input · payload.json:
{
"documentId": "doc_9f2a",
"recipientEmail": "customer@example.com",
"recipientName": "Customer"
}
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
- Call app_topolo_books.invoices.deliveries.list and confirm the attempt recipient and provider status. Also call invoices.get and confirm sent_at is populated after delivery.status is sent.
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
Delivered email cannot be recalled. Revoke the public invoice page separately if the secure link must stop working.
Related actions
- List invoice delivery attempts: List every Topolo Notify email attempt for one invoice, newest first, including recipient, Notify dispatch status, Nexus delivery receipt status, receipt timestamp and failure detail.
- Get an invoice: Read one invoice with its lines and the payments against it.
- Revoke public invoice page: Immediately disable the invoice public page and its PDF endpoint without changing the accounting record.
- List invoices: List invoices 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.
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.