Skip to content

Create an entity: its database file, its schema, its commodities and its opening chart

POST
/v1/entities
curl --request POST \
--url https://example.com/v1/entities \
--header 'Content-Type: application/json' \
--data '{ "entity_id": "acme-holdings", "legal_name": "example", "legal_form": "example", "country": "example", "base_currency": "example", "base_precision": 1, "commodities": [ { "code": "example", "precision": 1 } ], "starter_chart": false, "tax_regime": {}, "reason": "example" }'

Create a new set of books and serve them from this process immediately.

The reply is one EntitySummary, the same object GET /v1/entities lists and GET /v1/entities/{entity_id} returns, so the caller can follow links.capabilities straight into the new book.

Creating an entity that is already served is not an update. The id is its permanent address and the books behind it are somebody’s accounts, so a second creation is refused rather than merged. A retry of the same creation (same credential, same Idempotency-Key, same body) replays the original 201, so it is safe to retry over a connection that dropped after the books were written.

Media typeapplication/json
EntityCreationSubmission

Create one entity: its database file, its schema, its commodities and its opening chart.

Everything here is supplied by the caller, because every part of it is permanent or nearly so. The id is the entity’s address in every URL and the name of the file it lives in, so it is a plain slug with no second spelling.

base_precision is explicit, as initialize_entity requires: defaulting to two decimals would silently hold a zero-decimal currency to hundredths, and every later amount would be wrong by a factor of a hundred without anything reporting it.

starter_chart defaults to false. A book about to be imported or authored wants its own chart, and accounts added by a default would have to be noticed and archived. Either way, the equity account an opening balance lands in is created by initialize_entity; without it an entity cannot take an opening balance at all.

object
entity_id
required
Entity Id

The entity’s permanent address: 1-63 characters of lower-case letters, digits and hyphens

string
legal_name
required
Legal Name

The registered name, as it appears on the statements

string
legal_form
required
Legal Form

E.g. Ltd, Inc, B.V., S.L.

string
country
required
Country

ISO country code

string
base_currency
required
Base Currency

The currency this entity’s statements are presented in

string
base_precision
required
Base Precision

Decimal places for the base currency; 2 for USD, 0 for JPY

integer
<= 6
commodities
Commodities

Further commodities beyond the base currency

Array<object>
CommodityDeclaration
object
code
required
Code

The commodity’s code, e.g. USD

string
precision
required
Precision

Decimal places this commodity is held to; 2 for USD, 0 for JPY

integer
<= 6
starter_chart
Starter Chart

Add the generic starter chart (cash, receivables, payables, general expenses, sales) as well as the retained-earnings equity account

boolean
tax_regime
Any of:
object
key
additional properties
any
reason
Any of:
string

Successful Response

Media typeapplication/json
EntitySummary
object
entity_id
required
Entity Id
string
legal_name
required
Legal Name
string
legal_form
required
Legal Form
string
country
required
Country
string
base_currency
required
Base Currency
string
commodities
required
Commodities
Array<string>
lock_through
required
Any of:
string
lock_version
required
Lock Version
integer
lock_close_id
required
Any of:
string
live_close_eligible
required
Live Close Eligible
boolean
links
required
Links
object
key
additional properties
string

Example generated

{
"entity_id": "example",
"legal_name": "example",
"legal_form": "example",
"country": "example",
"base_currency": "example",
"commodities": [
"example"
],
"lock_through": "example",
"lock_version": 1,
"lock_close_id": "example",
"live_close_eligible": true,
"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": {}
}
}