Topolo Docs Topolo Platform
Open workspace

Create recurring journal

Create a balanced monthly, quarterly or yearly journal schedule. The hourly worker posts each occurrence exactly once and atomically advances the next date.

Outcome

Create a balanced monthly, quarterly or yearly journal schedule. The hourly worker posts each occurrence exactly once and atomically advances the next date.

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.recurring.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/journals/recurring

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

Input fields

FieldRequiredMeaningSchema and constraints
nameRequiredname{"type":"string","minLength":1,"maxLength":160}
descriptionRequireddescription{"type":"string","minLength":1,"maxLength":500}
referenceOptionalreference{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}
notesOptionalnotes{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]}
cadenceRequiredcadence{"type":"string","enum":["monthly","quarterly","yearly"]}
startOnRequiredstart On{"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"}
endOnOptionalend On{"anyOf":[{"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"},{"type":"null"}]}
linesRequiredComplete 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.{"minItems":2,"maxItems":500,"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string","minLength":1},"amountMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"documentCurrency":{"type":"string","pattern":"^[A-Z]{3}$"},"documentAmountMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"fxRate":{"type":"string","pattern":"^\d+(\.\d+)?$"},"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"}]}},"required":["accountId","amountMinor"],"additionalProperties":false}}

Inspect nested fields and the complete input schema.

Effects

  • Stores a balanced journal template and activates its schedule. Each due occurrence is posted exactly once and advances the schedule in the same ledger transaction.

Interpret the response

Read $.schedule.id for the returned recurring_journal identifier. Empty collections and nullable fields do not discover a target.

Call app_topolo_books.journals.recurring.get and confirm the cadence, next run date and lines.

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.recurring.create --data @payload.json --json
topolo actions plan app_topolo_books.journals.recurring.create --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.journals.recurring.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.recurring.create",
    "input": {
      "name": "Monthly depreciation",
      "description": "Depreciation",
      "cadence": "monthly",
      "startOn": "2026-10-01",
      "lines": [
        {
          "accountId": "acc_fac144f663f147b5b74d1745218fef8a",
          "amountMinor": 10000
        },
        {
          "accountId": "acc_09a4c91f30bc4e8fba47a5c2b3e67aeb",
          "amountMinor": -10000
        }
      ]
    },
    "resourceType": "workspace",
    "resourceId": "<exact granted workspace id>",
    "confirm": true,
    "detail": true
  }
}

Refused response · auth_error

Input · payload.json:

{
  "name": "Monthly depreciation",
  "description": "Post monthly depreciation",
  "cadence": "monthly",
  "startOn": "2026-10-31",
  "lines": [
    {
      "accountId": "acc_depreciation",
      "amountMinor": 10000
    },
    {
      "accountId": "acc_accumulated_depreciation",
      "amountMinor": -10000
    }
  ]
}

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:

{
  "name": "Monthly depreciation",
  "description": "Depreciation",
  "cadence": "monthly",
  "startOn": "2026-10-01",
  "lines": [
    {
      "accountId": "acc_fac144f663f147b5b74d1745218fef8a",
      "amountMinor": 10000
    },
    {
      "accountId": "acc_09a4c91f30bc4e8fba47a5c2b3e67aeb",
      "amountMinor": -10000
    }
  ]
}

Captured response · HTTP 201

{
  "schedule": {
    "id": "rj_4dcb0b74fa31495aa4a5d8739d8f3979",
    "organization_id": "org_recurring-route_muvnp2vt22",
    "workspace_id": "ws_recurring-route_muvnp2vt22",
    "name": "Monthly depreciation",
    "description": "Depreciation",
    "reference": null,
    "cadence": "monthly",
    "interval_months": 1,
    "start_on": "2026-10-01",
    "end_on": null,
    "next_run_on": "2026-10-01",
    "status": "active",
    "last_run_on": null,
    "last_event_id": null,
    "run_count": 0,
    "attempts": 0,
    "last_error": null,
    "created_at": "2026-10-05T19:42:12.967Z",
    "updated_at": "2026-10-05T19:42:12.967Z",
    "notes": null
  },
  "lines": [
    {
      "id": "rjl_48b8f1913ad14622a1a71f618f89e709",
      "organization_id": "org_recurring-route_muvnp2vt22",
      "workspace_id": "ws_recurring-route_muvnp2vt22",
      "schedule_id": "rj_4dcb0b74fa31495aa4a5d8739d8f3979",
      "line_no": 1,
      "account_id": "acc_fac144f663f147b5b74d1745218fef8a",
      "amount_minor": 10000,
      "document_currency": null,
      "document_amount_minor": null,
      "fx_rate": null,
      "tax_rate_id": null,
      "contact_id": null,
      "dimensions": null,
      "memo": null
    },
    {
      "id": "rjl_ff8b9195a40a4fd18f7c570b6fdd0c78",
      "organization_id": "org_recurring-route_muvnp2vt22",
      "workspace_id": "ws_recurring-route_muvnp2vt22",
      "schedule_id": "rj_4dcb0b74fa31495aa4a5d8739d8f3979",
      "line_no": 2,
      "account_id": "acc_09a4c91f30bc4e8fba47a5c2b3e67aeb",
      "amount_minor": -10000,
      "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.recurring.get and confirm the cadence, next run date and lines.

Verify the result

  • Call app_topolo_books.journals.recurring.get and confirm the cadence, next run date and lines.

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

Cancel the schedule. Occurrences already posted remain immutable.

  • Get recurring journal: Read one recurring journal schedule and all of its template lines.
  • Pause recurring journal: Pause an active schedule without changing its next run date.
  • 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.
  • Cancel recurring journal: Permanently cancel an active or paused schedule. Posted occurrences remain in the ledger.

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.