A double-entry ledger. Every entry is balanced, append-only, and enforced by the database as well as the application. Amounts are exchanged as exact decimal strings, never as JSON numbers.
Amounts are strings
A JSON number is a double, so 12.10 is already 12.099999999999999 before the server sees it. Amounts are sent as exact decimal strings and stored as integer minor units.
Retries are safe
Send an Idempotency-Key on any write. The same key with the same body replays the stored response; with a different body it is a 409.
Errors are machine-readable
Failures are RFC 9457 problem documents. Branch on type; the figures you need are extension members, so nothing has to be parsed out of prose.
3 operations
/api/v1/healthPublicLiveness and database readiness
Runs a trivial query against the database. A 503 body reports whether DATABASE_URL is configured and the driver error code, so the cause is visible without reading logs.
200503
/api/v1/webhooks/dispatchPublicDrain the delivery queue
Triggered by the scheduler, authenticated with CRON_SECRET. Documented because an operator needs to know it exists, not because clients should call it.
200401
/api/v1/metricsPublicPrometheus metrics
Text exposition format. obol_ledger_residual_minor is the one worth alerting on: it has exactly one correct value, zero, in every currency.
200
4 operations
/api/v1/accountsPublicList every account with its current balance
200429
/api/v1/accountsBearer tokenOpen an account
201400401409429
/api/v1/accounts/{accountId}PublicFetch one account
200404429
/api/v1/accounts/{accountId}/statementPublicPaginated statement with a running balance
200400404429
11 operations
/api/v1/entriesPublicList journal entries, newest first
200400429
/api/v1/entriesBearer tokenRecord a balanced journal entry
Postings must sum to zero. The entry is written in a single database transaction and a deferred constraint verifies the balance at COMMIT.
200201400401409422429
/api/v1/entries/{entryId}PublicFetch one entry with its postings
200404429
/api/v1/transfersBearer tokenMove money between two accounts
Sugar for a two-legged journal entry; identical guarantees.
200201400401409422429
/api/v1/entries/{entryId}/postBearer tokenSettle a pending entry
Moves the entry from pending to posted: its amounts stop being reserved and start counting toward the posted balance. The overdraft rule is re-checked, because funds available at authorisation may be gone by settlement.
200401404409422429
/api/v1/entries/{entryId}/archiveBearer tokenCancel a pending entry before it settles
Releases the reservation; nothing moves. Distinct from a reversal, which cancels money that did move by posting an opposite entry — here there is nothing to mirror.
200401404409429
/api/v1/entries/{entryId}/documentsPublicWhat an entry is supported by
200404429
/api/v1/entries/{entryId}/documentsBearer tokenAttach a supplier invoice, customs declaration or receipt
multipart/form-data with file, kind (one of invoice, receipt, customs_declaration, bill_of_lading, delivery_note, contract, other) and an optional note. The type is decided from the content: PDF, PNG, JPEG, WebP or plain XML, and nothing else — a file that is not one of those is a 415, over 4 MiB a 413. The same file is stored once per tenant, and attaching it twice to one entry returns the attachment it already has, so a retried upload is safe.
201400401404413415422429
/api/v1/entries/{entryId}/documents/{linkId}Bearer tokenTake an attachment off an entry
The file and the record that it was attached both stay; the attachment is marked removed.
204401404429
/api/v1/documents/{documentId}/contentPublicDownload a document exactly as it was uploaded
Served with the type decided at upload and nosniff. XML is always sent as an attachment; ?download=1 sends anything as one.
200404429
/api/v1/entries/{entryId}/reverseBearer tokenUndo an entry by posting its mirror image
A POST that creates a new entry rather than a DELETE that removes one, because that is what happens: the original stays on the record and a second entry cancels it. An entry can be reversed at most once.
201401404409422429
8 operations
/api/v1/bank-accountsPublicAccounts a bank statement can be reconciled against
Monetary asset and liability accounts that are not customer or supplier ledgers: bank accounts, cards, loans. Each with how many statement lines it has and how many are still unmatched.
200429
/api/v1/bank-accounts/{accountId}/linesPublicThe statement, newest first
Each unmatched line carries candidates — postings on the account for the same amount within two weeks, nearest first — and suggested, set only when the line and the posting are each other’s nearest.
200429
/api/v1/bank-accounts/{accountId}/linesBearer tokenPush lines from a bank feed
Each line carries the bank’s own id; a line already received is skipped, so resending a day is harmless. Amounts are signed decimals in the account’s currency, money in positive.
201400401422429
/api/v1/bank-accounts/{accountId}/statementsBearer tokenImport a statement file exported from online banking
The CSV as the request body (comma, semicolon or tab). Column names are recognised in English, Vietnamese and Japanese; an amount may be one signed column or separate money-in and money-out columns; dates may be day-first or year-first. Every line or none: a row that cannot be read is a 422 naming it. Lines already imported are skipped.
201401422429
/api/v1/bank-accounts/{accountId}/reconciliationPublicThe reconciliation statement
The books’ balance, the bank’s latest reported balance, and the two lists that explain the gap: lines on the statement not yet in the books, and postings in the books not yet on the statement. difference is zero when those explain it all.
200404422429
/api/v1/bank-lines/{lineId}/matchBearer tokenMatch a statement line to the posting that records it
The posting must be on the statement’s account and for the same amount to the unit; each line and each posting is matched at most once. The database enforces both.
201400401404409422429
/api/v1/bank-lines/{lineId}/matchBearer tokenUndo a match
The match is marked undone; the record that it was made stays.
204401404409429
/api/v1/bank-lines/{lineId}/entryBearer tokenBook a statement line the books have nothing for, and match it
For a fee, interest or a transfer nobody booked: posts the line’s own amount between the account and counterAccountId, dated the day the bank moved the money, and matches the line to it.
201400401404409422429
6 operations
/api/v1/reports/balance-sheetPublicAssets, liabilities and equity at a point in time
`balanced` is computed rather than assumed: a balance sheet that does not balance means the ledger is inconsistent.
200400429
/api/v1/reports/income-statementPublicRevenue and expenses over a period
Revenue and expenses are flows, so a period is required. Defaults to the last 30 days rather than all time, because an income statement with no period attached is meaningless.
200400429
/api/v1/reports/trial-balancePublicDebits, credits and residual per currency
A residual other than zero means the ledger is inconsistent.
200429
/api/v1/reports/statutoryPublicVietnam’s statutory balance sheet or income statement
In the layout of the circular the books follow: Mẫu B01-DN and B02-DN under Thông tư 200, B01a-DNN and B02-DNN under Thông tư 133. Each line carries the form’s code, its Vietnamese caption with an English gloss, the figure and the comparative the form asks for (start of the year, or the same period a year earlier). unplaced lists accounts with a balance no line claims. A 404 for books under any other chart.
200404429
/api/v1/reports/gross-marginPublicRevenue, cost and margin by product and by customer
Over [from, to): to is exclusive, so consecutive periods tile. With neither, the current calendar month; with one, the other is the edge of the month it falls in. Everything is in the functional currency — revenue at each invoice’s rate, cost at each lot’s. Freight and duty that arrived after the goods were sold appear per product as lateCharges.
200400429
/api/v1/reports/stock-reconciliationPublicEach inventory account against the lots behind it
difference is ledger less lots, and zero is the only healthy value. A difference comes from an entry that moved the account without moving a lot — a hand-typed journal line — and those entries are listed under unexplained. meta.agrees is false if any account disagrees.
200429
6 operations
/api/v1/ratesPublicExchange rates on file
Point-in-time facts, never updated. A lookup asks for the most recent rate at or before a date, so re-running last quarter’s reports uses last quarter’s rates.
200429
/api/v1/ratesBearer tokenRecord a rate
Re-recording the same pair, day and source is a correction rather than a second opinion. A rate is a decimal string with up to ten places — never a JSON number, which would already have lost precision.
201400401422429
/api/v1/periods/{periodMonth}/revalueBearer tokenRetranslate foreign monetary balances at the closing rate
IAS 21 remeasurement: cash, receivables and payables held in a foreign currency are restated at the month-end rate and the difference goes to profit or loss. Inventory and fixed assets are not — they stay at the rate they were bought at. Cumulative rather than reversing, so running it twice posts nothing the second time. `?preview=true` computes the adjustment without posting it.
200400401409422429
/api/v1/periodsPublicMonths, and whether they still accept entries
A month with entries but no period row is open; the row is created when it is closed.
200429
/api/v1/periods/{periodMonth}/closeBearer tokenClose a month
Posts a closing entry that zeroes revenue and expense into retained earnings, then locks the month against any entry dated inside it. The closing entry goes through the journal like any other, so it obeys the same balance rule. Periods close in order, and the current month cannot be closed.
200400401409422429
/api/v1/periods/{periodMonth}/reopenBearer tokenReopen a closed month
Reverses the closing entry, dated inside the month rather than today, and unlocks it. The original close stays on the record.
200400401409429
3 operations
/api/v1/api-keysBearer tokenList this tenant’s keys
Digests are never returned. Each key carries an identifying prefix and the time it was last used, which is what makes revoking the right one possible.
200401429
/api/v1/api-keysBearer tokenIssue a key
Returns the token exactly once; only its SHA-256 digest is stored. Minting a key requires an existing key, so the first one comes from the seed rather than from an open endpoint.
201400401429
/api/v1/api-keys/{keyId}Bearer tokenRevoke a key
The row is kept and `revoked_at` is set, because a deleted row answers "who had access, and until when?" with silence. Revoking twice is a 404, not a silent success.
200401404429
7 operations
/api/v1/webhook-endpointsPublicList registered endpoints
Signing secrets are never included; they are returned once, at creation.
200429
/api/v1/webhook-endpointsBearer tokenRegister an endpoint
Returns the signing secret exactly once. Store it: it cannot be read back, only rotated. An empty eventTypes subscribes to everything.
201400401409429
/api/v1/webhook-endpoints/{endpointId}PublicFetch one endpoint
200404429
/api/v1/webhook-endpoints/{endpointId}Bearer tokenEnable or disable an endpoint
Re-enabling clears the consecutive-failure count, so the circuit breaker does not trip again on the next single failure.
200400401404429
/api/v1/webhook-endpoints/{endpointId}Bearer tokenRemove an endpoint and its delivery history
204401404429
/api/v1/webhook-deliveriesPublicThe delivery log
Every attempt, with its status code, response excerpt and next retry time — so a subscriber can diagnose its own failures without a support thread.
200400429
/api/v1/webhook-deliveries/{deliveryId}/replayBearer tokenQueue the same event again
Creates a new delivery rather than resetting the old one, so the record of the original failure survives. The payload carries a replayOf link for deduplication.
202401404429
10 operations
/api/v1/itemsPublicList products with what is on hand and its value
200429
/api/v1/itemsBearer tokenAdd a product
Both accounts must be in the functional currency: stock is non-monetary and is never retranslated. Without costingMethod the item follows the organisation’s. LIFO is refused outside a US GAAP chart.
200201400401404409422429
/api/v1/items/{itemId}PublicFetch one product with its open lots and recent movements
Lots are oldest first — the order FIFO takes them in. Movements are the 50 most recent, newest first.
200404429
/api/v1/items/{itemId}/receiptsBearer tokenBook a delivery
Posts the purchase and opens a lot in one transaction, or does neither. quantity is to the item’s precision — a digit more is a 422, never a rounding. cost is the whole delivery in currency; a foreign cost is converted at the rate on the day it arrived and frozen there. The supplier’s leg is in the credit account’s own currency.
200201400401404409422429
/api/v1/items/{itemId}/issuesBearer tokenShip stock without a sale
Costed from the lots by the item’s method and posted to its cost of goods sold. For stock that is sold, use POST /sales, which posts the revenue beside the cost so the margin exists. Shipping more than is on hand is a 409 insufficient_stock and nothing is written.
200201400401404409422429
/api/v1/items/{itemId}/write-offsBearer tokenWrite off stock that was not sold
Costed from the lots like a sale, and posted to the expense account given rather than cost of sales, so shrinkage stays visible. reason is one of damaged, expired, lost, count_shortfall, other.
200201400401404409422429
/api/v1/items/{itemId}/supplier-returnsPublicWhat went back to suppliers from one product
200404429
/api/v1/items/{itemId}/supplier-returnsBearer tokenSend part of a delivery back to the supplier
The goods leave the named lot at what it carries them at, landed cost included. The supplier’s account comes down by the refund — its own price for the goods unless refund says otherwise — at the rate the delivery was bought at. Landed cost the refund does not cover goes to expenseAccountId, or the product’s cost of sales. With taxCodeId, the input tax on the refund is reversed and lands on the return for the month of the return; only for a delivery bought in the functional currency. More than is left of the lot is a 409 supplier_return_exceeds_lot; a refund above what was paid for the delivery is a 409 supplier_refund_exceeds_lot. Nothing is written either way.
200201400401404409422429
/api/v1/supplier-returnsPublicRecent returns to suppliers, newest first
200400429
/api/v1/supplier-returns/{supplierReturnId}PublicFetch one return to a supplier
200404429
11 operations
/api/v1/salesPublicRecent invoices, newest first
200400429
/api/v1/salesBearer tokenInvoice a customer and ship the goods
One entry carries the receivable (in the invoice currency), the revenue and any output tax (in the functional currency) and the cost of goods sold drawn from the lots. Each line’s amount is its net total in the invoice currency, not a unit price; its quantity is to that item’s precision. Two lines of one product draw successive lots. Selling more than is on hand is a 409 insufficient_stock with the figure on hand, and nothing is written. The reference is unique.
200201400401404409422429
/api/v1/sales/{saleId}PublicFetch one invoice with its lines, cost and margin
200404429
/api/v1/sales/{saleId}/credit-notesPublicThe credit notes issued against one invoice
200404429
/api/v1/sales/{saleId}/credit-notesBearer tokenTake back part of a sale: returned goods, a price allowance, or both
Each line names an invoice line by its movementId. Returned goods go back into the lots they left from, at the cost they left at. Revenue, output tax and the receivable are credited at the invoice’s own rate, and the tax lands on the return for the month the credit note is dated. Returning more than a line shipped, or crediting more than it charged, is a 409 credit_exceeds_sale with what is left; nothing is written. The final credit against an invoice takes exactly what is left, so a sale credited in instalments ends at zero.
200201400401404409422429
/api/v1/sales/{saleId}/einvoicesPublicThe Vietnamese e-invoice for a sale, and its adjustments
200429
/api/v1/sales/{saleId}/einvoicesBearer tokenIssue the Vietnamese e-invoice for a sale
Takes the next number in the company’s series — the database refuses a gap or a repeat — and builds the invoice XML in the national format: seller and buyer by tax code, lines, tax by rate, total in words. Issued once; a second request is a 409. The document is unsigned: a licensed provider signs it and obtains the tax office’s code. Needs the company’s registered name, tax code, address and a series for the year of issue.
201400401404409422429
/api/v1/credit-notes/{creditNoteId}/einvoiceBearer tokenIssue the adjustment e-invoice for a credit note
Names the original e-invoice and carries the reduction as negative amounts. The original is never reissued or changed. The sale’s own e-invoice must exist first.
201400401404409422429
/api/v1/einvoices/{einvoiceId}/xmlPublicDownload an e-invoice’s XML exactly as issued
200404429
/api/v1/credit-notesPublicRecent credit notes, newest first
200400429
/api/v1/credit-notes/{creditNoteId}PublicFetch one credit note
200404429