Retire an account: nothing may be posted to it again, and everything posted to it stays
const url = 'https://example.com/v1/entities/example/accounts/example/archive';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"reason":"example","expected_version":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/entities/example/accounts/example/archive \ --header 'Content-Type: application/json' \ --data '{ "reason": "example", "expected_version": 1 }'Archive an account. This is the only way an account leaves the chart.
Nothing is deleted and no history moves: every entry already posted to the account stays where it is and
keeps appearing in every report that covers its date. From now on, a leg on the account is refused at
posting time (account_archived). restore undoes this.
account_id accepts the account’s path as well as its id, like everywhere an account is named in the
command surface. A reason is required, and expected_version is the version the caller read.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The entity this path is relative to
The entity this path is relative to
Request Bodyrequired
Section titled “Request Bodyrequired”Retire an account: nothing may be posted to it again, and everything already posted to it stays.
reason is required here, though optional on creation, because this is a decision about the books rather
than structure. An archived account stays visible in every later report, and “why did this stop being
used?” is what a reviewer will ask.
expected_version is the account version the caller was looking at, the same concurrency check a close
uses. If two callers retire an account from two readings of the chart, the second fails with
stale_version rather than acting on a chart it never saw.
object
Why nothing may be posted to this account again
The account version this caller read
Example generated
{ "reason": "example", "expected_version": 1}Responses
Section titled “Responses”Successful Response
The reply to an account command: the account as it now stands, and its audit action.
object
object
object
The account.created / account.archived action’s event sequence
object
Example generated
{ "entity_id": "example", "legal_name": "example", "base_currency": "example", "snapshot_seq": 1, "account": { "id": "example", "path": "example", "type": "example", "code": "example", "tax_code": "example", "is_cash": true, "archived": true, "version": 1, "commodities": [ "example" ], "links": { "additionalProperty": "example" } }, "version": 1, "audit_seq": 1, "links": { "additionalProperty": "example" }}Bad Request
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Unauthorized
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Forbidden
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Not Found
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Conflict
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Precondition Failed
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Unprocessable Content
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Internal Server Error
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}Service Unavailable
object
Example generated
{ "error": { "code": "example", "message": "example", "retryable": true, "details": [ {} ], "request_id": "example", "next_action": {} }}