Outcome
Save an incomplete or balanced journal, including an optional automatic reversal date, as an editable draft without posting it to the ledger.
Before you start
- Verify the intended environment, authenticated identity and specifically approved organization context.
- The published application permission is journals: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.journals.drafts.create --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
POST /api/journal-drafts
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 |
|---|---|---|---|
postedOn | Optional | posted On | {"anyOf":[{"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"},{"type":"null"}]} |
description | Optional | description | {"type":"string","maxLength":500} |
reference | Optional | reference | {"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]} |
notes | Optional | notes | {"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]} |
autoReverseOn | Optional | auto Reverse On | {"anyOf":[{"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"},{"type":"null"}]} |
overrideSoftLock | Optional | Explicit override of a soft accounting lock; inspect the lock and obtain authority before posting. | {"type":"boolean"} |
lines | Optional | Complete structured lines in the published nested schema. Journal lines use signed minor units and must balance; invoice/bill lines have their own pricing and tax shape. | {"maxItems":500,"type":"array","items":{"type":"object","properties":{"accountId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"amountMinor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"documentCurrency":{"anyOf":[{"type":"string","pattern":"^[A-Z]{3}$"},{"type":"null"}]},"documentAmountMinor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"fxRate":{"anyOf":[{"type":"string","pattern":"^\d+(\.\d+)?$"},{"type":"null"}]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"contactId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dimensions":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"memo":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}},"additionalProperties":false}} |
Inspect nested fields and the complete input schema.
Effects
- Creates an editable draft only. The ledger sequence, hash chain, balances and reports are unchanged.
Interpret the response
Read $.draft.id for the returned journal_draft identifier. Empty collections and nullable fields do not discover a target.
Call app_topolo_books.journals.drafts.get with the returned draft id.
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.journals.drafts.create --data @payload.json --json
topolo actions plan app_topolo_books.journals.drafts.create --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.journals.drafts.create --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.journals.drafts.create",
"input": {
"notes": "Fixture evidence"
},
"resourceType": "workspace",
"resourceId": "<exact granted workspace id>",
"confirm": true,
"detail": true
}
}
Refused response · auth_error
Input · payload.json:
{
"postedOn": "2026-09-06",
"description": "Month-end accrual",
"lines": []
}
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 201
Input · payload.json:
{
"notes": "Fixture evidence"
}
Captured response · HTTP 201
{
"draft": {
"id": "jd_52ec4f8955f3410e931b83667f29a3c0",
"organization_id": "org_documentation-attachment_muvnpnbr2",
"workspace_id": "ws_documentation-attachment_muvnpnbr2",
"posted_on": null,
"description": "",
"reference": null,
"auto_reverse_on": null,
"override_soft_lock": 0,
"created_by": "usr_test",
"created_at": "2026-10-05T19:42:39.449Z",
"updated_at": "2026-10-05T19:42:39.449Z",
"notes": "Fixture evidence"
},
"lines": []
}
HTTP 201. Call app_topolo_books.journals.drafts.get with the returned draft id.
Successful response · HTTP 201
Input · payload.json:
{
"postedOn": "2026-09-06",
"description": "Accrued professional fees",
"notes": "Signed engagement letter and calculation attached.",
"lines": [
{
"accountId": "acc_8eff11bcd18140ecb674b9f57ed84906",
"amountMinor": 25000
},
{
"accountId": "acc_ecddad9adb094b8f8ae7cb16b30b9c5f",
"amountMinor": -25000
}
]
}
Captured response · HTTP 201
{
"draft": {
"id": "jd_ef8abf153ae14b6491d2a0374121e096",
"organization_id": "org_journal-evidence_muvnpwo91",
"workspace_id": "ws_journal-evidence_muvnpwo91",
"posted_on": "2026-09-06",
"description": "Accrued professional fees",
"reference": null,
"auto_reverse_on": null,
"override_soft_lock": 0,
"created_by": "usr_evidence",
"created_at": "2026-10-05T19:42:51.571Z",
"updated_at": "2026-10-05T19:42:51.571Z",
"notes": "Signed engagement letter and calculation attached."
},
"lines": [
{
"id": "jdl_45d254b147ba4056b590e13fbb549f6e",
"organization_id": "org_journal-evidence_muvnpwo91",
"workspace_id": "ws_journal-evidence_muvnpwo91",
"draft_id": "jd_ef8abf153ae14b6491d2a0374121e096",
"line_no": 1,
"account_id": "acc_8eff11bcd18140ecb674b9f57ed84906",
"amount_minor": 25000,
"document_currency": null,
"document_amount_minor": null,
"fx_rate": null,
"tax_rate_id": null,
"contact_id": null,
"dimensions": null,
"memo": null
},
{
"id": "jdl_dcaf7899f4614f69901314a248fdfc39",
"organization_id": "org_journal-evidence_muvnpwo91",
"workspace_id": "ws_journal-evidence_muvnpwo91",
"draft_id": "jd_ef8abf153ae14b6491d2a0374121e096",
"line_no": 2,
"account_id": "acc_ecddad9adb094b8f8ae7cb16b30b9c5f",
"amount_minor": -25000,
"document_currency": null,
"document_amount_minor": null,
"fx_rate": null,
"tax_rate_id": null,
"contact_id": null,
"dimensions": null,
"memo": null
}
]
}
HTTP 201. Call app_topolo_books.journals.drafts.get with the returned draft id.
Successful response · HTTP 201
Input · payload.json:
{
"notes": "Temporary working paper"
}
Captured response · HTTP 201
{
"draft": {
"id": "jd_9a337c24f65c4d7ea15e66e30ce5ee52",
"organization_id": "org_journal-evidence_muvnpwpn3",
"workspace_id": "ws_journal-evidence_muvnpwpn3",
"posted_on": null,
"description": "",
"reference": null,
"auto_reverse_on": null,
"override_soft_lock": 0,
"created_by": "usr_evidence",
"created_at": "2026-10-05T19:42:51.618Z",
"updated_at": "2026-10-05T19:42:51.618Z",
"notes": "Temporary working paper"
},
"lines": []
}
HTTP 201. Call app_topolo_books.journals.drafts.get with the returned draft id.
Successful response · HTTP 201
Input · payload.json:
{
"description": "Accrual",
"lines": []
}
Captured response · HTTP 201
{
"draft": {
"id": "jd_ad62470177ad4161ba97a15e8e431989",
"organization_id": "org_journal-draft_muvnpsmk5",
"workspace_id": "ws_journal-draft_muvnpsmk5",
"posted_on": null,
"description": "Accrual",
"reference": null,
"auto_reverse_on": null,
"override_soft_lock": 0,
"created_by": "usr_drafts",
"created_at": "2026-10-05T19:42:46.324Z",
"updated_at": "2026-10-05T19:42:46.324Z",
"notes": null
},
"lines": []
}
HTTP 201. Call app_topolo_books.journals.drafts.get with the returned draft id.
Successful response · HTTP 201
Input · payload.json:
{}
Captured response · HTTP 201
{
"draft": {
"id": "jd_07c8138638154c9bb12e56184a8235a4",
"organization_id": "org_journal-draft_muvnpsnd6",
"workspace_id": "ws_journal-draft_muvnpsnd6",
"posted_on": null,
"description": "",
"reference": null,
"auto_reverse_on": null,
"override_soft_lock": 0,
"created_by": "usr_drafts",
"created_at": "2026-10-05T19:42:46.353Z",
"updated_at": "2026-10-05T19:42:46.353Z",
"notes": null
},
"lines": []
}
HTTP 201. Call app_topolo_books.journals.drafts.get with the returned draft id.
Verify the result
- Call app_topolo_books.journals.drafts.get with the returned draft id.
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
Discard the draft.
Related actions
- Get journal draft: Read one editable journal draft with its ordered lines.
- Update journal draft: Replace supplied fields, optional automatic reversal date or lines on an editable journal draft. Posted journals remain immutable.
- Post journal draft: Validate and post a complete balanced draft through the journal serializer, atomically schedule its optional automatic reversal, then remove the draft. A stable draft idempotency key prevents a retry creating a duplicate event.
- List journals: List posted journal events, filtered by date range or period, searched across description, reference and journal type, and sorted by sequence, posted date, description or amount. Newest first unless you say otherwise.
- Delete journal draft: Discard one unposted journal draft. No ledger event or balance is changed.
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.