Outcome
Reverse the year-end close so adjustments can be posted, then close the year again. Refused with fiscal_year_not_closed when there is no close to reverse.
Before you start
- Verify the intended environment, authenticated identity and specifically approved organization context.
- The published application permission is periods: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.periods.year_ends.reopen --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/periods/year-ends/{fiscalYear}/reopen
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 |
|---|---|---|---|
fiscalYear | Required | Fiscal year label interpreted with the workspace fiscal-year start month. | {"anyOf":[{"type":"integer","minimum":1900,"maximum":2999},{"type":"string","pattern":"^\d{4}$"}]} |
overrideSoftLock | Optional | Explicit override of a soft accounting lock; inspect the lock and obtain authority before posting. | {"type":"boolean"} |
Inspect nested fields and the complete input schema.
Effects
- Posts the reversal of the year-end close journal, dated the same last day of the year. Retained earnings give the profit back to the income and expense accounts until the year is closed again.
Interpret the response
This reports the numeric fiscalYear label and retained reopen evidence. Read year-end state and any retained journal identifiers separately.
Call app_topolo_books.periods.year_ends.list and confirm the year shows status open.
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.periods.year_ends.reopen --data @payload.json --json
topolo actions plan app_topolo_books.periods.year_ends.reopen --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.periods.year_ends.reopen --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.periods.year_ends.reopen",
"input": {
"fiscalYear": "2025"
},
"resourceType": "workspace",
"resourceId": "<exact granted workspace id>",
"confirm": true,
"detail": true
}
}
Successful response · HTTP 201
Input · payload.json:
{
"fiscalYear": "2025"
}
Captured response · HTTP 201
{
"fiscalYear": 2025,
"reversal": {
"id": "je_ea66a9d1a6f14a64a52fe9a9deecd514",
"organization_id": "org_close_muvnpl6v6",
"workspace_id": "ws_close_muvnpl6v6",
"sequence": 4,
"period_key": "2025-12",
"posted_on": "2025-12-31",
"event_type": "journal_reversed",
"journal_type": "year_end_close",
"description": "Year end 2025 reopened",
"reference": "YE-2025",
"source_app": "topolo-books",
"source_document_type": null,
"source_document_id": null,
"actor_type": "topolo_agent",
"actor_id": "usr_test",
"autonomy_level": null,
"correlation_id": null,
"idempotency_key": "reverse:je_b7909cfc3f46474096150c7efa9ee3d4",
"reverses_event_id": "je_b7909cfc3f46474096150c7efa9ee3d4",
"reversed_by_event_id": null,
"total_debit_minor": 900,
"total_credit_minor": 900,
"line_count": 2,
"previous_hash": "b483d489485c8912ffcf674b047e42f14df3e7662bfdae03896f6e8b4b8c4341",
"hash": "e500aef6014062ede348bebe294589b0683e0930efb2a111589bdd3b7ed5c030",
"created_at": "2026-10-05T19:42:36.722Z",
"notes": null
},
"reversed": "je_b7909cfc3f46474096150c7efa9ee3d4"
}
HTTP 201. Call app_topolo_books.periods.year_ends.list and confirm the year shows status open.
Refused response · auth_error
Input · payload.json:
{
"fiscalYear": "2026"
}
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.periods.year_ends.list and confirm the year shows status open.
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
Close the year again once the adjustments are posted.
Related actions
- Post a journal: Post a balanced manual journal to the ledger. Optionally schedule its exact reversal for the first day of a later month with autoReverseOn. Refused with unbalanced_journal, period_locked, account_not_found or account_archived; an idempotencyKey replays the same event. Every line is signed base-currency minor units: positive debit, negative credit.
- Close a fiscal year: Post the year-end close: every income and expense balance still open through the last day of the year moves to retained earnings in one journal dated that day. Refused with fiscal_year_in_progress before the year has ended and nothing_to_close when no balance remains. A year already closed returns the standing close (alreadyClosed true) rather than a second one.
- List accounting periods: List the monthly accounting periods and their lock status, optionally for one fiscal year.
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.