API reference
Drafts
Entries being written that have not reached the ledger yet.
- GET
/v1/draftsList draft entries - POST
/v1/draftsStart a draft entry - GET
/v1/drafts/{draft_id}Get a draft entry - PATCH
/v1/drafts/{draft_id}Change a draft entry - DELETE
/v1/drafts/{draft_id}Discard a draft entry - POST
/v1/drafts/{draft_id}/postPost a draft entry into the books
Guides: Write and correct journal entries
List draft entries
GET/v1/drafts
client.drafts.list()
Entries being written, oldest first. None of them is in the books.
Parameters
| Name | Type | Description |
|---|---|---|
limitQuery | integer | Page size, 1–200. |
cursorQuery | string or null | The |
Response
200DraftPage
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/drafts" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Start a draft entry
POST/v1/drafts· Idempotent
client.drafts.create()
Start a draft entry. It may be unbalanced; it is checked when it posts.
Request body
Response
201DraftOut
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X POST "https://api.ledgerit.ai/v1/drafts" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"description":"…","entry_date":"2026-09-30"}'Get a draft entry
GET/v1/drafts/{draft_id}
client.drafts.get()
One draft, with its lines and whether it would post as it stands.
Parameters
| Name | Type | Description |
|---|---|---|
draft_idPath · Required | string | An id that starts with |
Response
200DraftOut
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/drafts/{draft_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Change a draft entry
PATCH/v1/drafts/{draft_id}· Idempotent
client.drafts.update()
Change a draft. lines, when sent, replaces all of them. Refused with
draft_changed when someone else changed it since row_version.
Parameters
| Name | Type | Description |
|---|---|---|
draft_idPath · Required | string | An id that starts with |
Request body
Response
200DraftOut
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X PATCH "https://api.ledgerit.ai/v1/drafts/{draft_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"row_version":0}'Discard a draft entry
DELETE/v1/drafts/{draft_id}
client.drafts.discard()
Throw a draft away. It was never in the books, so nothing is reversed.
Parameters
| Name | Type | Description |
|---|---|---|
draft_idPath · Required | string | An id that starts with |
row_versionQuery | integer or null | The version you read; a stale one is refused. |
Response
204No content
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X DELETE "https://api.ledgerit.ai/v1/drafts/{draft_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Post a draft entry into the books
POST/v1/drafts/{draft_id}/post· Idempotent
client.drafts.post()
Post a draft into the books, with every rule an entry is held to, and remove the draft. Posting it again returns the same entry.
Parameters
| Name | Type | Description |
|---|---|---|
draft_idPath · Required | string | An id that starts with |
Request body
Response
201EntryOut
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X POST "https://api.ledgerit.ai/v1/drafts/{draft_id}/post" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"row_version":0}'Objects
The objects these operations take and return.
DraftPage
| Name | Type | Description |
|---|---|---|
dataRequired | array of DraftOut | |
has_moreRequired | boolean | |
next_cursorRequired | string or null |
NewDraft
| Name | Type | Description |
|---|---|---|
descriptionRequired | string | |
entry_dateRequired | string (date) | |
lines | array of NewDraftLine | |
memo | string or null |
DraftOut
| Name | Type | Description |
|---|---|---|
balancedRequired | boolean | Whether it would post as it stands: two lines or more, and equal sides. |
created_atRequired | string (date-time) | |
creditsRequired | string | |
debitsRequired | string | |
descriptionRequired | string | |
entry_dateRequired | string (date) | |
idRequired | string | An id that starts with |
linesRequired | array of DraftLineOut | |
memoRequired | string or null | |
row_versionRequired | integer | Send it back with a change or a post; a stale one is refused with draft_changed. |
updated_atRequired | string (date-time) |
DraftChange
| Name | Type | Description |
|---|---|---|
description | string or null | |
entry_date | string (date) or null | |
lines | array of NewDraftLine or null | |
memo | string or null | |
row_versionRequired | integer | The version you read; a stale one is refused. |
DraftVersion
| Name | Type | Description |
|---|---|---|
row_versionRequired | integer | The version you read; a stale one is refused. |
EntryOut
| Name | Type | Description |
|---|---|---|
amountRequired | string | |
created_at | string (date-time) or null | When the entry was posted. |
descriptionRequired | string | |
documents | array of DocumentOut | The receipts and invoices attached to the transactions the entry was posted from, oldest first. Empty for an entry with no transaction behind it. |
entry_dateRequired | string (date) | |
entry_kindRequired | string | What produced the entry: manual, system, adjusting, opening, closing or reversal. |
entry_noRequired | integer | |
idRequired | string | An id that starts with |
imported | EntryImportOut or null | Where the entry's transactions were imported from and who brought them in. Null for an entry with no imported transaction behind it. |
linesRequired | array of LineOut | |
memoRequired | string or null | |
origins | array of EntryOriginOut | What the entry was posted from. Empty for an entry written by hand, an opening or closing entry, and a reversal. |
period | string or null | The accounting period the entry is in, as |
replaced_by_entry_id | string or null | An id that starts with |
replaced_by_entry_no | integer or null | That replacement's number, as people cite it. |
replaces_entry_idRequired | string or null | An id that starts with |
replaces_entry_no | integer or null | The number of the entry this one replaced, as people cite it. |
reversed_by_entry_id | string or null | An id that starts with |
reversed_by_entry_no | integer or null | That reversal's number, as people cite it. |
reverses_entry_idRequired | string or null | An id that starts with |
reverses_entry_no | integer or null | The number of the entry a reversal undoes, as people cite it. |
sourceRequired | string | |
statusRequired | string | One of posted, reversed |
NewDraftLine
A draft's line. It may leave out a dimension its account requires:
that is asked for when the draft posts (dimension_required). A value
that is not of the dimension named is refused now (dimension_invalid).
A foreign amount is kept as given and held to the line's amount when the
draft posts (foreign_amount_mismatch); a currency LedgerIt does not
know is refused now.
| Name | Type | Description |
|---|---|---|
account_idRequired | string | An id that starts with |
amountRequired | number | string | |
dimensions | array of LineDimensionIn | At most one value per dimension, kept with the line and posted with it. |
directionRequired | string | One of debit, credit |
foreign | ForeignIn or null | For a line that moved in another currency: that currency, the amount in it and the rate. |
memo | string or null | |
party_id | string or null | An id that starts with |
DraftLineOut
| Name | Type | Description |
|---|---|---|
account_codeRequired | string | |
account_idRequired | string | An id that starts with |
account_nameRequired | string | |
amountRequired | string | |
dimensions | array of LineDimensionOut | The line's value for each dimension it names, by key. |
directionRequired | string | One of debit, credit |
foreign | ForeignOut or null | What the line moved in, when not the books' own currency. Kept as given: whether |
line_noRequired | integer | |
memoRequired | string or null | |
party_id | string or null | An id that starts with |
DocumentOut
| Name | Type | Description |
|---|---|---|
content_typeRequired | string or null | |
created_atRequired | string (date-time) | |
idRequired | string | An id that starts with |
kindRequired | string | |
sourceRequired | string | |
storedRequired | boolean | |
urlRequired | string or null |
EntryImportOut
Where the transactions behind an entry were brought in from, and by whom: the answer to "imported from where?".
| Name | Type | Description |
|---|---|---|
actor_avatar_url | string or null | That member's profile picture, when they have one. |
actor_email | string or null | That member's email, while they are still in the books. |
actor_id | string or null | An id that starts with |
actor_kindRequired | string |
user, system, model |
actor_name | string or null | That member's name, when known. |
label | string or null | The import's own name: an uploaded file's name. |
sourceRequired | string | The connector it came from, such as |
LineOut
| Name | Type | Description |
|---|---|---|
account_codeRequired | string | |
account_idRequired | string | An id that starts with |
account_nameRequired | string | |
amountRequired | string | |
dimensions | array of LineDimensionOut | The line's value for each dimension it names, by key. |
directionRequired | string | One of debit, credit |
foreign | ForeignOut or null | What the line moved in, when not the books' own currency. |
idRequired | string | An id that starts with |
memoRequired | string or null | |
party_id | string or null | An id that starts with |
party_logo_url | string or null | The party's logo, square PNG; null for none. |
party_name | string or null | The party's name. |
EntryOriginOut
What an entry was posted from: the step back from the books toward the evidence.
| Name | Type | Description |
|---|---|---|
descriptionRequired | string | |
idRequired | string | The transaction's id, or the schedule's. |
kindRequired | string |
transaction, schedule |
LineDimensionIn
| Name | Type | Description |
|---|---|---|
dimension_idRequired | string | An id that starts with |
value_idRequired | string | A value of that dimension. |
ForeignIn
| Name | Type | Description |
|---|---|---|
amountRequired | number | string | The amount in that currency, unsigned like |
currencyRequired | string | The currency the line moved in, ISO 4217. |
rateRequired | number | string | One unit of it in the books' currency, as booked. |
LineDimensionOut
| Name | Type | Description |
|---|---|---|
dimension_idRequired | string | An id that starts with |
dimension_keyRequired | string | The dimension's key, e.g. |
dimension_nameRequired | string | |
value_codeRequired | string | |
value_idRequired | string | An id that starts with |
value_nameRequired | string |
ForeignOut
| Name | Type | Description |
|---|---|---|
amountRequired | string | |
currencyRequired | string | |
rateRequired | string or null | The rate it was booked at; null on a revaluation line. |