SET API · SET Close
Approve and lock a period
POST/v1/close/periods/{period}/approve
Approves a prepared period and locks it: nothing in the month changes afterwards. The lock writes snapshotHash, which covers the month's matches and the prior period's hash. No body is read.
Path parameters
periodstringrequired- The month as
YYYY-MM(UTC), already prepared.
Headers
Idempotency-Keystring- Any unique string. What a repeat of this call answers is in the notes. See Idempotency.
Notes
- SET Close is switched on per deployment; when it is off, every
/v1/closecall answers 403close_offafter the key is checked.GET /v1/capabilitiesshows it asfeatures.close. - Needs a key with both the
approveand thereadscopes; a key missing either answers 403scope_missing. Platform and business keys can both call it. - The second approver must be a different key from the one that prepared the period, and not a key rotated from or to it: otherwise 409
same_approver. Issue a second key withPOST /v1/api_keys. - Every earlier period since the start period must be locked first: otherwise 409
prior_period_open. - A period not yet prepared answers 409
period_not_prepared; a locked period answers 409period_locked, including for a repeat of the same request. - An exception that arrived since prepare answers 409
open_exceptionsand puts the period back toopen. - Both keys belong to the same business: this is two-key approval, not an independent attestation.
- Writes a
close.period.lockedevent carrying the hashes and counts. - The example was made with a sandbox key (
sandbox: true). - This example is a recorded run of SET's own code (wallet release
e9b03447) with a sandbox key; ids and times are that run's.
Errors
403 close_off404 not_found409 period_not_ended409 before_start_period409 period_locked409 period_not_prepared409 same_approver409 prior_period_open409 period_changed403 scope_missing