Documents
Accounting documents represent financial transactions from your ERP system — invoices, payments, credit memos, journal entries, and more. They are the foundation for reconciliation between your accounting system and bank transactions in Atlar.
This guide covers the conceptual model, field semantics, and integration patterns for the Documents API (/v2beta/documents).
Conceptual Model
SOURCE vs INSTRUCTION
Every document is automatically classified as either SOURCE or INSTRUCTION based on its general ledger entries:
| Classification | Meaning | Typical types | How it's determined |
|---|---|---|---|
| SOURCE | A receivable or payable — money is owed but no bank account is directly affected | Invoice, credit memo, purchase order | No GL entry references a BANK-type GL account |
| INSTRUCTION | A transaction that directly impacts a bank account | Payment, transfer | At least one GL entry references a BANK-type GL account |
You do not set classification yourself. The system computes it from the GL accounts used in glEntries. If you change GL entries via a PATCH, classification is recomputed.
Document Lifecycle
A typical document moves through these stages:
- Created — synced from your ERP into Atlar.
- Partially applied — one or more counter-documents are linked (e.g., a partial payment applied to an invoice). The
remainingAmountreflects what is still outstanding. - Fully applied —
remainingAmountreaches zero. - Matched — the document is matched to a bank transaction during reconciliation (
reconciliationStatus: MATCHED). - Reconciled — the reconciliation match is approved (
reconciliationStatus: RECONCILED).
How Documents Relate to Each Other
Documents are linked through appliedDocuments. For example, when a payment is made against an invoice:
- The payment document lists the invoice in its
appliedDocuments(with the applied amount). - The invoice document's
remainingAmountshould be updated to reflect the partial or full payment.
These relationships are bidirectional in meaning but managed by the caller — Atlar does not automatically update remainingAmount when you create or modify appliedDocuments. See What you manage vs what the system computes.
Document Types
The type field identifies the kind of accounting transaction:
| Type | Description | Typical classification |
|---|---|---|
INVOICE | A receivable or payable — an amount owed to or by a counterparty | SOURCE |
CREDIT_MEMO | An adjustment that reduces an outstanding receivable or payable | SOURCE |
PURCHASE_ORDER | A commitment to purchase goods or services | SOURCE |
PAYMENT | A bank transaction — money moving in or out of a bank account | INSTRUCTION |
TRANSFER | An internal transfer between bank accounts | INSTRUCTION |
JOURNAL_ENTRY | A general ledger adjustment (classification depends on accounts used) | Varies |
Remember: classification is determined by GL accounts, not by type. A JOURNAL_ENTRY that touches a bank GL account becomes an INSTRUCTION.
Key Fields Explained
amount and remainingAmount
amount and remainingAmountBoth fields use the MultiCurrencyAmount structure with two sub-amounts:
instructedAmount— the amount in the document's original currency.baseAmount— the amount in the GL entity's base (functional) currency.
amount is the total face value of the document and does not change after creation (unless explicitly patched).
remainingAmount tracks the outstanding portion:
- For SOURCE documents (e.g., invoices): represents the unpaid balance. Required at creation.
- For INSTRUCTION documents (e.g., payments): represents the unapplied portion — how much of the payment hasn't been matched to a source document yet. Optional.
Example:
You create an invoice for $1,000 with remainingAmount also set to $1,000. A $400 payment is applied against it. You would then PATCH the invoice to update remainingAmount to $600.
glEntries
glEntriesEvery document must have at least one general ledger entry. Each entry specifies:
glAccountId— the GL account affected.amount— the entry amount (withinstructedAmountandbaseAmount).type—DEBITorCREDIT.vendorId— the entry's identifier in your ERP.
GL entries serve two purposes: they record the accounting impact and they determine the document's classification. If any entry references a GL account of type BANK, the document is classified as INSTRUCTION.
Simple invoice example (two entries):
- Debit Accounts Receivable (non-bank) — $1,000
- Credit Revenue (non-bank) — $1,000
Result: classification = SOURCE (no bank account involved).
Payment example (two entries):
- Debit Accounts Payable (non-bank) — $500
- Credit Bank Account (bank) — $500
Result: classification = INSTRUCTION (bank account involved).
reference, references, and description
reference, references, and descriptionThese three fields serve distinct purposes:
| Field | Purpose | Required | Example |
|---|---|---|---|
description | Human-readable label for the document | Yes | "Invoice #10001" |
reference | The canonical external identifier (e.g., the invoice or payment number) | No | "INV-10001" |
references | A map of auxiliary identifiers — memo lines, PO numbers, or other metadata from your ERP | Yes (can be empty {}) | {"memo": "Q1 consulting", "poNumber": "PO-4421"} |
Use reference for the primary identifier your team would use to look up the document. Use references for supplementary data that helps with matching or audit trails.
date
dateThe meaning of date depends on the document type:
| Document type | date typically means |
|---|---|
| Invoice | Due date |
| Payment | Transaction date |
| Credit memo | Issue date |
| Journal entry | Posting date |
This is not the creation timestamp (that's created), nor when the document was created in your ERP (that's vendorCreated).
counterparty
counterpartyIdentifies the external party involved in the transaction:
name— the counterparty's legal name.type—VENDOR,CUSTOMER, orEMPLOYEE.erpId— the counterparty's identifier in your ERP system.
Required for INVOICE, CREDIT_MEMO, and PURCHASE_ORDER documents. Optional for other types.
currencyExchange
currencyExchangeRequired when the document's instructed currency differs from the GL entity's base currency. Specifies:
exchangeRate— the conversion rate.sourceCurrency/targetCurrency— the currency pair.unitCurrency— which currency the rate is quoted in.
vendorCreated and vendorResourceUrl
vendorCreated and vendorResourceUrlThese fields track the document's origin in your external system:
| Field | Purpose | Example |
|---|---|---|
vendorCreated | When the document was created in the source ERP | "2025-03-15T10:30:00Z" |
vendorResourceUrl | A deep link to the document in your ERP's UI | "https://erp.example.com/invoices/10001" |
What You Manage vs What the System Computes
Understanding this boundary is critical for a correct integration.
The system computes:
classification— derived from GL accounts inglEntries. Recomputed on update.id,organizationId,version,etag,created,updated— system-managed metadata.- GL entry IDs — auto-generated for each entry.
You must manage:
remainingAmount— the system does not update this whenappliedDocumentschange. When you apply a payment to an invoice, you must PATCH the invoice'sremainingAmountyourself.appliedDocuments— you maintain the links between documents. The system stores them but does not validate that referenced documents exist or that amounts balance.reconciliationStatus— you (or the reconciliation workflow) must explicitly transition this. Creating anappliedDocumentsentry does not automatically change reconciliation status.voided— you must explicitly mark a document as voided if it is cancelled in your ERP.
Reconciliation Status
The reconciliationStatus field tracks where a document stands in the reconciliation workflow:
| Status | Meaning |
|---|---|
OPEN | Not yet matched to any bank transaction |
MATCHED | Matched to a bank transaction, pending approval |
RECONCILED | Match has been approved — reconciliation is complete |
IGNORED | Explicitly excluded from reconciliation |
Constraints:
- Setting status to
RECONCILEDrequires areconciliationMatchIdto be set in the same PATCH request. - A
reconciliationMatchIdis only valid when status isRECONCILED.
