Close a period (unrealized FX revaluation)
close_periodRuns the month-end (period-end) close for an organisation: remeasures every open foreign-currency monetary balance (per-bank cash accounts whose currency differs from the home/reporting currency) to the period-end closing rate, and books the difference to 6750 Unrealized FX Gain/Loss — distinct from 6700 realized FX. Each revaluation entry SELF-REVERSES on the first day of the next period, so the next period opens at the original basis. This WRITES financial data. IDEMPOTENT: closing the same period_end twice is REFUSED (it fails rather than double-booking). VALIDATED: a period_end in the future (including the still-running current month) is REFUSED — closing is irreversible (no reopen flow), so only completed months can close; a period_end at or below the current closing watermark is REFUSED as already closed. SOFT CHECK (same as the web close): when unrecorded opening balances would be locked behind this close, the call returns closed: false with opening_balance_warnings and writes NOTHING — surface the warnings to the user and re-call with force: true to close anyway (the check itself fails open on provider outages). A home-currency-only org, or one with no open foreign balances, closes with revalued_account_count 0 and writes no entries. Accounts can be excluded individually via the per-account FX revaluation toggle. Returns the period_end, how many balances were revalued, and the classified_event ids of the revaluation entries (not their reversals).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Set true to close even when the pre-close soft check flagged unrecorded opening balances (after surfacing the warnings to the user). | |
| org_id | No | Optional. Defaults to the organisation the authenticated API key is bound to, so you normally omit it and never need to ask the user for their organisation UUID. If provided, it must match the key’s org or the request is rejected. | 0e91146d-511c-469f-bdee-5c867b26ae0d |
| actor_id | No | Optional. Defaults to the organisation entity (correct for an org-scoped key). If provided, it must be an entity belonging to this organisation — arbitrary UUIDs are rejected, so the audit trail cannot be attributed to someone else. | |
| period_end | Yes | The period-end date to close, ISO 8601 (YYYY-MM-DD). A period is a calendar month, so this MUST be a month-end (the last day of a month, e.g. 2026-06-30); a mid-month date is rejected. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| closed | Yes | ||
| entry_ids | No | ||
| period_end | Yes | ||
| revalued_account_count | No | ||
| opening_balance_warnings | No |