Skip to content

Close the books through a date: check, snapshot, lock and audit, in one transaction

POST
/v1/entities/{entity_id}/close
curl --request POST \
--url https://example.com/v1/entities/example/close \
--header 'Content-Type: application/json' \
--data '{ "through": "example", "reason": "example", "expected_version": 1, "overrides": [ { "check": "example", "reason": "example" } ] }'

Close a period on the acting principal’s own authority, with the checks applied.

Everything happens in one transaction. The checks are evaluated, and a blocking one refuses unless an override names it. The verification snapshot is computed and stored, the lock advances, and one audit action records what was evaluated, what was waived and the snapshot’s hash. A refusal leaves nothing behind: no snapshot, no partial record, and the idempotency key is not used up.

There are two distinct refusals. 409 close_not_eligible names every blocking check and what is outstanding in it. A 422 says an override named a check that is not blocking at all.

entity_id
required
Entity Id

The entity this path is relative to

string

The entity this path is relative to

Media typeapplication/json
ClosePeriodSubmission

Shut the books through a date.

A date, a reason, the lock version you believe is current and, only where a check is blocking, an override naming that check and saying why. Nothing else: the verification snapshot is computed by the server, because a caller that could supply one could supply a hash of a state that never existed.

expected_version guards against two agents closing the same books from different readings of them; the second fails with stale_version and writes nothing. Retrying the same intent is a different matter, handled by Idempotency-Key.

object
through
required
Through

Close through this date, inclusive (YYYY-MM-DD)

string
reason
required
Reason

Why the period is being closed; kept verbatim in the record

string
>= 1 characters
expected_version
required
Expected Version

The period lock version this close expects to advance

integer
>= 1
overrides
Overrides

One per blocking check being closed over

Array<object>
CloseOverride

Close over one named blocking check: the check, and why. There is no id to pre-create and no wildcard.

An override is matched against the checks as the server has just evaluated them, so it can only name a failure that is real at this moment. A blanket bypass cannot be expressed. Each override is stored on the close record with the check’s status and outstanding count as they stood, the acting principal and this reason.

object
check
required
Check

The check key this override answers, e.g. ‘statement_coverage’

string
>= 1 characters
reason
required
Reason

Why this period is being closed with that check unsatisfied

string
>= 1 characters

Example generated

{
"through": "example",
"reason": "example",
"expected_version": 1,
"overrides": [
{
"check": "example",
"reason": "example"
}
]
}

Successful Response

Media typeapplication/json
ClosePeriodResponse
object
entity_id
required
Entity Id
string
legal_name
required
Legal Name
string
base_currency
required
Base Currency
string
snapshot_seq
required
Snapshot Seq
integer
close_id
required
Close Id
string
kind
required
Kind
string
lock
required
PeriodLock
object
through
required
Any of:
string
version
required
Version

Pass this back as expected_version on the next close or reopen

integer
close_id
required
Any of:
string
snapshot
required
CloseSnapshot

The verification snapshot the close was recorded against. Computed by the server, never supplied.

object
id
required
Id
string
snapshot_seq
required
Snapshot Seq
integer
state_hash
required
State Hash
string
through
required
Through
string
checks
required
Checks

The checks this close ran, exactly as GET /close-checks reports them

object
key
additional properties
any
audit_seq
required
Audit Seq
integer
links
required
Links
object
key
additional properties
string

Example generated

{
"entity_id": "example",
"legal_name": "example",
"base_currency": "example",
"snapshot_seq": 1,
"close_id": "example",
"kind": "example",
"lock": {
"through": "example",
"version": 1,
"close_id": "example"
},
"snapshot": {
"id": "example",
"snapshot_seq": 1,
"state_hash": "example",
"through": "example"
},
"checks": {},
"audit_seq": 1,
"links": {
"additionalProperty": "example"
}
}

Bad Request

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Unauthorized

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Forbidden

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Not Found

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Conflict

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Precondition Failed

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Unprocessable Content

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Internal Server Error

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Service Unavailable

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}