If you're about to post journals through an API, you need five ideas: the equation, debits and credits, the chart of accounts, accrual timing, and statements derived from journals. Here they are, each with the Paprel call that implements it.
| Concept | What it means for your code | Paprel surface |
|---|---|---|
| The accounting equation | Every write keeps Assets = Liabilities + Equity true | Balanced-or-rejected journals |
| Debits and credits | Each journal line is a debit or a credit, and they sum equal | POST /v1/accounting/journals |
| Chart of accounts | Every line posts to an account UUID in a tree | GET /v1/accounting/accounts, GET /v1/accounting/accounts-tree |
| Accrual timing | Revenue posts when you invoice, cash moves when you're paid | Invoice and payment workflows |
| Derived statements | Reports are computed from journal lines, never stored separately | GET /v1/reports/trial-balance and the other report endpoints |
1. The Accounting Equation
Assets = Liabilities + Equity.
Assets are what the business owns (cash, receivables, equipment). Liabilities are what it owes (payables, loans, money held for others). Equity is what's left for the owners, and revenue and expenses flow into it over time.
Every transaction touches at least two accounts so the equation keeps holding. For an engineer, treat the equation as an invariant: if any write can break it, the system is wrong. Paprel enforces it at write time. A journal whose debits and credits don't match is rejected before anything reaches the ledger.
2. Debits and Credits
A debit is the left side of an entry; a credit is the right side. Which one increases an account depends on the account's type:
| Account type | Increased by | Decreased by |
|---|---|---|
| Assets | Debit | Credit |
| Expenses | Debit | Credit |
| Liabilities | Credit | Debit |
| Equity | Credit | Debit |
| Revenue | Credit | Debit |
Here are the common business events as journals:
| Event | Debit | Credit |
|---|---|---|
| Buy equipment with cash | Equipment | Cash |
| Take out a business loan | Cash | Loan Payable |
| Send an invoice | Accounts Receivable | Revenue |
| Receive payment from a customer | Cash | Accounts Receivable |
Look at the last two rows. Revenue is recorded when you invoice. When the customer pays, cash goes up and the receivable goes down. Revenue doesn't change, because it was already earned. Crediting Revenue again on payment would count the sale twice.
In Paprel, a journal is a list of lines. Each line is a debit or a credit (never both) against an account UUID, with amounts as decimal strings. Here's a balanced cash sale posted directly. The account IDs are placeholders; use the UUIDs from your own chart:
curl -X POST "$PAPREL_API_BASE/v1/accounting/journals" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "x-partner-domain: $PARTNER_DOMAIN" \
-H "content-type: application/json" \
-d '{
"currency": "USD",
"date": "2026-10-29",
"description": "Cash sale",
"lines": [
{ "account_id": "<cash account id>", "description": "Cash received", "debit": "100.00" },
{ "account_id": "<revenue account id>", "description": "Revenue earned", "credit": "100.00" }
],
"posted": true
}'
The response's data.journal includes an anchor_id, which is the journal's stable identity across versions. Change either amount to "90.00" and the request is rejected, with nothing written.
Two rules apply to manual journals:
- Manual journals must arrive balanced. Paprel validates them; it doesn't fix them for you.
- Keep receivable and payable control accounts out of manual journals. Accounts Receivable and Accounts Payable are posted by document and payment workflows, which is why the invoice and payment rows above come from invoices, not from hand-written journals.
The 5-minute quickstart walks through this call end to end, including the token exchange.
3. The Chart of Accounts
The chart of accounts is the list of accounts every line posts to. It's arranged as a tree: assets, liabilities, equity, income and expenses at the top, with sub-accounts underneath. Reports are sums over branches of that tree, so the structure you choose shapes every report you'll produce.
You don't design one from scratch. Each Paprel company is provisioned with a default chart of accounts based on a standard taxonomy, and you extend it:
GET /v1/accounting/accountslists accounts with theirid,account,account_codeandcurrency.GET /v1/accounting/accounts-treereturns the hierarchy.POST /v1/accounting/accountsadds an account, nested under a parent withis_sub_accountandparent_id.
One detail catches people out: journal lines resolve accounts by account_id (a UUID). account_code is metadata only and does not select an account for posting.
Map your product's concepts onto accounts once. In the 20-minute guide, an item carries a sales_account_id, so every invoice line for that item posts revenue to the right account without the caller choosing it.
4. Accrual Timing
Cash-basis accounting records revenue when money arrives. Accrual accounting records revenue when it's earned and expenses when they're incurred, whenever the cash moves. Accrual gives a truer picture of a period, and it's what accountants will expect from books your product produces.
Paprel's document workflows post on an accrual basis:
- Send an invoice. Posting the invoice generates Dr Accounts Receivable / Cr Revenue.
- Record the payment.
POST /v1/invoices/{id}/paymentgenerates Dr Cash / Cr Accounts Receivable. Revenue is untouched.
Which status change on a document carries a ledger effect is part of its workflow configuration. GET /v1/invoices/setting/state-transition/ledger-effects lists the effects available for invoices.
Paprel does not automate revenue recognition. For a monthly plan billed monthly, posting at invoice time is correct recognition. For an annual prepay you model the deferral yourself, with manual journals against a deferred-revenue liability account. The SaaS billing guide shows the reclass and the monthly recognition entries.
5. Statements Derived From Journals
Financial statements are views over journal lines:
| Statement | Answers | Endpoint |
|---|---|---|
| Balance sheet | What the business owns and owes on a date | GET /v1/reports/balance-sheet?date=… |
| Income statement (P&L) | Revenue minus expenses over a period | GET /v1/reports/income-statement?date_range=… |
| Cash flow | Where cash came from and went over a period | GET /v1/reports/cash-flow?date_range=… |
| Trial balance | Every account's balance; total debits equal total credits | GET /v1/reports/trial-balance?date=… |
date_range takes inclusive dates as YYYY-MM-DD,YYYY-MM-DD.
In Paprel these reports are derived live from the journal rows. There's no separate reporting store to sync or reconcile. Post an invoice and the next P&L read includes it. Because every journal was balanced when it was written, the trial balance ties.
The trial balance response also carries a control_account_reconciliation block comparing the receivable and payable ledger balances with their subledgers. That's a quick check that the control accounts and the document detail agree.
Balanced postings give you a consistent trial balance, not an audit opinion. Whether your mappings and reports meet a given standard (GAAP, IFRS, local rules) is something you and your customers' accountants still have to validate.
Common Terms
| Term | Meaning | Where it shows up in Paprel |
|---|---|---|
| Journal | A balanced set of debit and credit lines | POST /v1/accounting/journals |
| General ledger | Every journal line, grouped by account | GET /v1/reports/general-ledger |
| Accounts receivable | Money customers owe you | Posted by invoices and payments |
| Accounts payable | Money you owe suppliers | Posted by bills and bill payments |
| Void | A correction that reverses a posted journal's effect and keeps its history | PUT /v1/accounting/journals/void |
| Anchor ID | The stable identity of a journal or document across versions | anchor_id |
Read Next
- Double-Entry Ledger Architecture for Engineers: the design decisions that keep these invariants true in production.
- Why Subledgers Matter: how invoice-level detail and GL balances stay in sync.
- Tenancy and the ledger core: how Paprel models each company's books.
Try it against a free sandbox (self-serve, no sales call). Want the product overview first? See the general ledger API.
Post your first balanced journal in 5 minutes →