Write a balanced journal entry: an accrual, a reclassification, an adjustment
const url = 'https://example.com/v1/entities/example/entries';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"legs":[{"account":"example","commodity":"example","amount":"-12.00","memo":"example","tax_code":"example"}],"dt":"example","narration":"example","reason":"example","origin":"example","code":"example","comment":"example","tags":[["example"]],"id":"example"}'};
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/entries \ --header 'Content-Type: application/json' \ --data '{ "legs": [ { "account": "example", "commodity": "example", "amount": "-12.00", "memo": "example", "tax_code": "example" } ], "dt": "example", "narration": "example", "reason": "example", "origin": "example", "code": "example", "comment": "example", "tags": [ [ "example" ] ], "id": "example" }'Post one balanced journal entry that no bank statement line stands behind.
An invoice raised, a payroll accrued, a quarter’s withholding moved from one liability to the next: each is
an economic event on a date with no cash row behind it on that date. The other entry writes either hang an
entry off a statement line or post a converted set as one unit (POST /batches). This one is for a single
entry, and without it a period’s profit could only ever be its cash flow.
The entry takes the ordinary posting path (drafted and sealed in one transaction), so it meets the same
balance rule, the same account, currency and precision rules and the same period lock as a line classified
off a statement. It takes any number of legs from two upward, as a four-leg payroll accrual needs. It
comes back posted and is never edited: POST /entries/{id}/correct restates it and
POST /entries/{id}/reverse withdraws it.
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”Write one balanced entry directly into the books: an accrual, a reclassification, an adjustment.
This is how the books record what a bank statement does not: an invoice raised, a payroll accrued, a quarter’s withholding moved from one liability to the next. Without it a ledger can only record cash, and a period’s profit is not a cash-flow figure.
The entry is posted when it is written; there is no approval step. A posted entry is never edited. It is
corrected with POST /entries/{id}/correct (a mirror that cancels it plus a replacement, in one
transaction) or withdrawn with POST /entries/{id}/reverse.
reason is required and is kept verbatim on the append-only audit action. narration is what the entry
reads as in every report and export; reason is why it was written.
object
Every leg of the entry; they net to zero per commodity
One leg of a manual journal entry: an account, a currency and a signed amount.
Unlike a line booking’s legs, these are the whole entry. No cash leg is supplied for you, because there is no statement line behind this entry. Two legs or more, netting to zero per commodity.
The entry date, YYYY-MM-DD; a date in a closed month is refused
What this entry reads as in the books
Why it is being written; kept in the record
Responses
Section titled “Responses”Successful Response
object
object
object
Signed integer micro-units (millionths) as a base-10 string; never a JSON number.
object
The entry.posted audit action’s event sequence; see /entries/{id}/events
object
Example
{ "entry": { "postings": [ { "amount_micros": "-12000000" } ] }}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": {} }}