Topolo Docs Topolo Platform
Open workspace

Mark an invoice manually sent

Record that an approved invoice was sent outside Topolo. This does not send an email and preserves delivery state independently from settlement.

Outcome

Record that an approved invoice was sent outside Topolo. This does not send an email and preserves delivery state independently from settlement.

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.send --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/invoices/{documentId}/send

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

Input fields

FieldRequiredMeaningSchema and constraints
documentIdRequiredExact 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

  • Records the first sent timestamp on an approved invoice without changing its settlement state.

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

Refused response · auth_error

Input · payload.json:

{
  "documentId": "doc_9f2a"
}

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_84c6e8cdae9c4f1c8df757d41576e61d"
}

Captured response · HTTP 200

{
  "document": {
    "id": "doc_84c6e8cdae9c4f1c8df757d41576e61d",
    "organization_id": "org_doc-lifecycle-route_muvnp46b12",
    "workspace_id": "ws_doc-lifecycle-route_muvnp46b12",
    "kind": "invoice",
    "contact_id": "con_b3da013894b9468593b2db7e2eef7edd",
    "number": "INV-000001",
    "reference": null,
    "issue_date": "2026-03-01",
    "due_date": null,
    "period_key": "2026-03",
    "currency": "USD",
    "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": null,
    "source": "manual",
    "source_document_id": null,
    "created_at": "2026-10-05T19:42:14.638Z",
    "updated_at": "2026-10-05T19:42:14.649Z",
    "sequence_no": 1,
    "approved_at": "2026-10-05T19:42:14.645Z",
    "sent_at": "2026-10-05T19:42:14.649Z",
    "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
  }
}

HTTP 200. Call app_topolo_books.invoices.get and confirm sent_at is populated.

Verify the result

  • Call app_topolo_books.invoices.get and confirm sent_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.

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

Delivery history is append-only; a sent marker is not removed.

  • Record a payment: Record money received against an invoice. Any open online checkout is expired before the balance changes, and the document becomes paid once its receipts cover it.
  • 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.