Documentation Index
Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt
Use this file to discover all available pages before exploring further.
A Journal Entry Line (journal_entry_lines) is a single debit or credit leg within a double-entry journal entry. Each line is associated with exactly one JournalEntry and one primary LedgerAccount, carries a decimal debit or credit amount (never both simultaneously, enforced by a CHECK constraint), and may reference an auxiliary ledger account, a tax rate, and a counterparty company for subledger analysis. Lines are created exclusively by the accounting posting engine (invoice-journal-entry builder and payment-settlement pipeline) and are never written directly by end users.
| Naming | Value |
|---|
| Object | JournalEntryLine |
Resource type (JSON:API type) | journal_entry_line |
| Collection / records root | β (not a records root) |
| REST base | /v1/journal-entry-lines |
| Entity class | JournalEntryLine |
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.
API operations
| Operation | Method & path | Status |
|---|
| List | GET /v1/journal-entry-lines | π‘ Planned |
| Retrieve | GET /v1/journal-entry-lines/{id} | π‘ Planned |
| Create | POST /v1/journal-entry-lines | π‘ Planned |
| Update | PATCH /v1/journal-entry-lines/{id} | π‘ Planned |
| Delete | DELETE /v1/journal-entry-lines/{id} | π‘ Planned |
Data model
Attributes
| Field | Type | Required | Constraints | Allowed values | Description |
|---|
| journal_entry_line_id | string (UUID) | β
Yes | unique | β | Public stable identifier for the line, generated via gen_random_uuid() on creation. Used in all API and Hasura references. |
| label | string | βͺ No | max length 500 | β | Free-text description of the line (e.g. βRevenue recognition β Invoice #INV-001β). Written by the posting engine from the source document. |
| debit | decimal(15,2) | β
Yes | CHECK (debit >= 0), default β0β | β | Debit amount in the workspaceβs functional currency. Defaults to 0. Cannot be positive simultaneously with credit (CHECK constraint on parent table: NOT (debit > 0 AND credit > 0)). |
| credit | decimal(15,2) | β
Yes | CHECK (credit >= 0), default β0β | β | Credit amount in the workspaceβs functional currency. Defaults to 0. Cannot be positive simultaneously with debit. |
| source_currency | enum (CurrencyCodeEnum) | βͺ No | β | USD, EUR, GBP, JPY, CHF, CAD, AUD, NZD, SEK, NOK, DKK, PLN, CZK, HUF, RON, BGN, HRK, ISK, ALL, BAM, BYN, MDL, MKD, RSD, FOK, GGP β¦ (full ISO 4217 set defined in CurrencyCodeEnum). Stored as the enum value string (e.g. βEURβ). | ISO 4217 currency code of the original transaction before conversion to the accounting currency. Populated when the source document is in a foreign currency. |
| source_amount | decimal(15,2) | βͺ No | β | β | The monetary amount expressed in source_currency before FX conversion. Null when source and accounting currencies are identical. |
| accounting_currency | enum (CurrencyCodeEnum) | βͺ No | β | Same set as source_currency β full CurrencyCodeEnum value strings. | ISO 4217 currency code used for the accounting books (the workspaceβs reporting currency). Populated during FX conversion. |
| accounting_amount | decimal(15,2) | βͺ No | β | β | The monetary amount converted to accounting_currency using the exchange rate at posting time. |
| lettering_code | string | βͺ No | max length 20 | β | Reconciliation / lettering code used to match open AR/AP lines against their offsetting settlement lines. Assigned by the lettering engine. |
| lettering_date | date | βͺ No | β | β | Date on which the lettering code was assigned, marking when the outstanding balance was reconciled. |
| tax_rate | decimal(5,2) | βͺ No | CHECK (tax_rate >= 0 AND tax_rate <= 100) | β | Inline tax rate percentage applied to this line (0β100). Denormalised copy of the tax rate value at the time of posting, independent of any tax_rate_ref record. |
| posting_metadata | jsonb | βͺ No | β | β | Arbitrary key-value payload attached by the posting engine for traceability (e.g. source invoice pk, posting run identifier). No enforced schema; consumers should treat as opaque. |
| cost_center | string | βͺ No | max length 100 | β | Analytic axis β cost centre code for management reporting and budget allocation. |
| project | string | βͺ No | max length 100 | β | Analytic axis β project identifier for project-based accounting or profitability tracking. |
| created_at | π system β Date | β
Yes | β | β | Timestamp set automatically when the record is first persisted. Never updated thereafter. |
| updated_at | π system β Date | βͺ No | β | β | Timestamp set on creation and refreshed on every update by the MikroORM onUpdate hook. |
| deleted_at | π system β Date | null | βͺ No | β | β | Soft-delete timestamp. Null means the record is active. Set by the posting engine or a cascade from the parent JournalEntry; never set directly by end users. All queries must filter deleted_at IS NULL. |
Relationships
| Name | Type | Required | Description |
|---|
| workspace | to-one (ManyToOne) | β
Yes | The tenant boundary. Every journal entry line belongs to exactly one workspace. Indexed together with journal_entry (composite index) and with ledger_account (composite index). |
| journal_entry | to-one (ManyToOne) | β
Yes | The parent double-entry journal entry this line belongs to. A journal entry must balance: the sum of all its linesβ debits must equal the sum of all credits. |
| ledger_account | to-one (ManyToOne) | β
Yes | The primary chart-of-accounts ledger account credited or debited by this line (e.g. β401000 β Accounts Payableβ, β706000 β Revenueβ). |
| auxiliary_account | to-one (ManyToOne) | βͺ No | Optional subledger / auxiliary ledger account for detailed third-party tracking (e.g. a per-customer receivable subledger). References LedgerAccount. |
| company | to-one (ManyToOne) | βͺ No | The counterparty company linked to this line for subledger analysis (e.g. the customer on an AR line or the supplier on an AP line). Populated by the posting engine from the source invoiceβs issuer or receiver. |
| tax_rate_ref | to-one (ManyToOne) | βͺ No | Reference to the TaxRate record whose percentage was applied at posting time. Complements the denormalised tax_rate decimal field. |
System-computed
- journal_entry_line_id β generated via gen_random_uuid() database default on INSERT; also seeded client-side by randomUUID() in the entity constructor.
- created_at β set to new Date() by MikroORM onCreate hook; never updated.
- updated_at β set to new Date() on onCreate and refreshed by MikroORM onUpdate hook on every flush.
- deleted_at β null on creation; set to a timestamp by soft-delete logic in the accounting posting engine or by cascade from the parent JournalEntry; never hard-deleted in normal operation.
- debit / credit defaults β both default to β0β at the database level (DEFAULT 0) and in the entity constructor.
- CHECK constraint chk_jel_debit_credit_exclusive β enforced at the database level: NOT (debit > 0 AND credit > 0). A line must be either a debit line or a credit line, never both.
- posting_metadata β populated by the accounting posting engine (journal-entry-persister.service.ts / invoice-journal-entry-draft.builder.ts) with traceability data; not derived from any ORM hook.
- accounting_currency / accounting_amount β populated during FX conversion in the multi-currency posting path; null for same-currency workspaces.
- Composite indexes: (workspace_pk, journal_entry_pk) and (ledger_account_pk, workspace_pk) are created by the Migration20260311100000 migration for query performance.
Example
{
"data": {
"type": "journal_entry_line",
"id": "e3f1a2b4-5c6d-7e8f-9012-abcdef345678",
"attributes": {
"journal_entry_line_id": "e3f1a2b4-5c6d-7e8f-9012-abcdef345678",
"label": "Invoice revenue recognition β Well App Inc",
"debit": "0.00",
"credit": "1250.00",
"source_currency": "USD",
"source_amount": "1250.00",
"accounting_currency": "EUR",
"accounting_amount": "1152.37",
"lettering_code": "A001",
"lettering_date": "2026-05-15",
"tax_rate": "20.00",
"posting_metadata": {
"invoice_pk": 4821,
"posting_run_id": "run_20260515_001"
},
"cost_center": "SALES-EU",
"project": "Q2-2026-EXPANSION",
"created_at": "2026-05-15T08:22:10.000Z",
"updated_at": "2026-05-15T08:22:10.000Z",
"deleted_at": null
},
"relationships": {
"workspace": {
"data": { "type": "workspace", "id": "wsp_9a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d" }
},
"journal_entry": {
"data": { "type": "journal_entry", "id": "je_1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d" }
},
"ledger_account": {
"data": { "type": "ledger_account", "id": "la_2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e" }
},
"auxiliary_account": {
"data": null
},
"company": {
"data": { "type": "company", "id": "cmp_3c4d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f" }
},
"tax_rate_ref": {
"data": { "type": "tax_rate", "id": "tr_4d5e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f90" }
}
}
}
}
Source: apps/api/src/database/entities/JournalEntryLine.ts Β· domain: financial-graph Β· tier: Supporting