Double-Entry Accounting for Developers: The Concepts Behind Paprel's Ledger API

The accounting equation, debits and credits, the chart of accounts, accrual timing, and derived statements, each mapped to the Paprel call that implements it.

Paprel Product Team
8 min read
Two equal stacks of accounting records share a charcoal foundation and a copper connection

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.

ConceptWhat it means for your codePaprel surface
The accounting equationEvery write keeps Assets = Liabilities + Equity trueBalanced-or-rejected journals
Debits and creditsEach journal line is a debit or a credit, and they sum equalPOST /v1/accounting/journals
Chart of accountsEvery line posts to an account UUID in a treeGET /v1/accounting/accounts, GET /v1/accounting/accounts-tree
Accrual timingRevenue posts when you invoice, cash moves when you're paidInvoice and payment workflows
Derived statementsReports are computed from journal lines, never stored separatelyGET /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 typeIncreased byDecreased by
AssetsDebitCredit
ExpensesDebitCredit
LiabilitiesCreditDebit
EquityCreditDebit
RevenueCreditDebit

Here are the common business events as journals:

EventDebitCredit
Buy equipment with cashEquipmentCash
Take out a business loanCashLoan Payable
Send an invoiceAccounts ReceivableRevenue
Receive payment from a customerCashAccounts 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:

Shell
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/accounts lists accounts with their id, account, account_code and currency.
  • GET /v1/accounting/accounts-tree returns the hierarchy.
  • POST /v1/accounting/accounts adds an account, nested under a parent with is_sub_account and parent_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:

  1. Send an invoice. Posting the invoice generates Dr Accounts Receivable / Cr Revenue.
  2. Record the payment. POST /v1/invoices/{id}/payment generates 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:

StatementAnswersEndpoint
Balance sheetWhat the business owns and owes on a dateGET /v1/reports/balance-sheet?date=…
Income statement (P&L)Revenue minus expenses over a periodGET /v1/reports/income-statement?date_range=…
Cash flowWhere cash came from and went over a periodGET /v1/reports/cash-flow?date_range=…
Trial balanceEvery account's balance; total debits equal total creditsGET /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

TermMeaningWhere it shows up in Paprel
JournalA balanced set of debit and credit linesPOST /v1/accounting/journals
General ledgerEvery journal line, grouped by accountGET /v1/reports/general-ledger
Accounts receivableMoney customers owe youPosted by invoices and payments
Accounts payableMoney you owe suppliersPosted by bills and bill payments
VoidA correction that reverses a posted journal's effect and keeps its historyPUT /v1/accounting/journals/void
Anchor IDThe stable identity of a journal or document across versionsanchor_id

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 →
Posted by: Paprel Product Team · Product & Platform Integration Review
Posted on: (Updated: October 29, 2026)
Evaluate Paprel

Build in sandbox, launch with a production trial

Use sandbox for developer testing with no billing. When you are ready for real workflows, start production on a monthly plan with a 14-day free trial.

API-First Delivery
Audit-Ready Controls
Sandbox And Guided Rollout