Documents

Commercial documents represent various types of business documents such as invoices, credit notes, and other financial documents. They can include both item lines for goods/services and payment lines for payment instructions.

Endpoints

Method Endpoint Description
GET /documents List documents
POST /documents Create a document
GET /documents/{id} Get a specific document
PUT/PATCH /documents/{id} Update a document
DELETE /documents/{id} Delete a document
POST /documents/preview Generate a preview PDF of a document

Query Parameters

The GET /documents endpoint supports the following query parameters:

Parameter Type Required Description
client_account_id integer No Filter by client account ID. If omitted, returns documents across all client accounts the user can access
business_partner_id integer No Filter by business partner ID
from_document_date date No Filter from document date (inclusive)
to_document_date date No Filter to document date (inclusive)
document_date date No Filter by exact document date
due_date date No Filter by exact due date
document_type string No Filter by document type
document_status string No Filter by document status
document_number string No Filter by document number
payment_reference string No Filter by payment reference
gross_amount decimal No Filter by gross amount
open_amount decimal No Filter by remaining unpaid amount
pending_payment_amount decimal No Filter by pending payment request amount
payment_status string No Filter by payment status
is_active boolean No Filter by active status
is_payable boolean No Filter by whether the document is payable
is_unpaid boolean No Filter by whether the document is unpaid
is_available_for_payment boolean No Filter by whether the document is available for payment
is_being_paid boolean No Filter by whether the document has a pending payment
is_reconcilable boolean No Filter by whether the document can be reconciled
is_unreconciled boolean No Filter by whether the document has unreconciled amounts
match_bank_transaction_id integer No Find documents matching a specific bank transaction
order_by string No Sort order
page integer No Page number for pagination (default: 1)
per_page integer No Number of items per page (default: 100)
with string No Include related resources. Comma-separated list (supported: business_partner, payor, collector, bank_account, item_lines, payment_lines, reconciliation_lines, reconciliation_lines.status, reconciliation_lines.target, document_references, files, payment_requests). None are included by default. reconciliation_lines.status adds the derived status and reconciliation_lines.target the derived target to each reconciliation line; both imply reconciliation_lines. On the Vouchers endpoints the same relations are document.reconciliation_lines.status and document.reconciliation_lines.target

Document Attributes

Attribute Type Description
id integer The unique identifier of the document
created_at datetime When the document was created
created_by_id integer The ID of the user who created the document
updated_at datetime When the document was last updated
updated_by_id integer The ID of the user who last updated the document
client_account_id integer The ID of the client account
business_partner_id integer The ID of the business partner
payor_id integer The ID of the payor
collector_id integer The ID of the collector
document_date date The date of the document
due_date date The payment due date
period_start date Start date of the period covered
period_end date End date of the period covered
period_description string Description of the period
document_type string Type of document
document_status string Status of the document
document_number string Document number
document_uuid string Unique identifier for the document
document_description string Description of the document
buyer_reference string Buyer’s reference number
order_reference string Order reference number
note string Additional notes
collection_case_number string Collection case reference
collection_severity string Severity of collection
payment_status string Status of payment based on reconciliation (read-only)
stated_payment_status string Payment status stated via voucher statement, e.g. when using “Mark as paid”. Complements payment_status which is reconciliation-driven (read-only)
payment_means string Method of payment
payment_ref string Payment reference
payment_card_number string Card number for card payments
gross_amount decimal Total amount including tax
net_amount decimal Amount before tax
open_amount decimal Remaining unpaid amount (read-only)
pending_payment_amount decimal Amount in pending payment requests (read-only)
late_fee_amount decimal Late payment fees
interest_amount decimal Interest charges
bank_account_id integer ID of the associated bank account
voucher_id integer ID of the associated file/voucher
currency_id integer ID of the currency
currency_code string Currency code
exchange_rate decimal Exchange rate used
is_draft boolean Whether this is a draft document
is_imported boolean Whether this was imported
is_active boolean Whether the document is active
is_archived boolean Whether this is archived
is_payable boolean Whether the document can be paid (read-only)
is_unpaid boolean Whether the document has outstanding balance (read-only)
is_available_for_payment boolean Whether the document is available for payment (read-only)
is_being_paid boolean Whether the document has a pending payment request (read-only)
is_reconcilable boolean Whether the document can be reconciled (read-only)
is_unreconciled boolean Whether the document has unreconciled amounts (read-only)
archive_category string Category for archived documents
send_document boolean Whether to send the document
structured_data object Additional structured data. Always included in every response — not gated by the with parameter

Document Line Attributes

Attribute Type Description
id integer The unique identifier of the line
document_id integer The ID of the parent document
line_id integer Line number within the document
item_id integer The ID of the item
item_no string Item number/code
item_name string Name of the item
description string Description of the line
price decimal Unit price
currency_code string Currency code
quantity decimal Quantity
unit_id integer ID of the unit of measure
tax_code_id integer ID of the tax code
tax_rate decimal Tax rate percentage
tax_amount_lc decimal Tax amount in local currency
tax_amount_fc decimal Tax amount in foreign currency
total_lc decimal Total amount in local currency
total_fc decimal Total amount in foreign currency
item_collection_entry_id integer ID of collection entry

Payment Line Attributes

Attribute Type Description
id integer The unique identifier of the payment line
document_id integer The ID of the parent document
line_type string Type of payment line
requested_execution_date date Requested date for execution
debtor_business_partner_id integer ID of the debtor
debtor_bank_account_id integer ID of debtor’s bank account
creditor_business_partner_id integer ID of the creditor
creditor_bank_account_id integer ID of creditor’s bank account
amount decimal Payment amount
currency_code string Currency code
creditor_reference string Creditor’s reference

Relationships

Relationship Type Description
business_partner BusinessPartner The associated business partner
payor BusinessPartner The payor business partner
collector BusinessPartner The collector business partner
bank_account BankAccount The associated bank account
files UploadedFile Associated files and attachments
item_lines [DocumentLine] The item lines in the document
payment_lines [PaymentLine] The payment lines in the document
reconciliation_lines [DocumentReconciliationLine] Reconciliation lines for the document
document_references [DocumentReference] References to other documents
payment_requests PaymentRequest Associated payment requests

Payment Line Types

Value Description
PRELIMINARY_TAX Preliminary tax payment
VAT_SETTLEMENT VAT settlement payment
NATIONAL_INSURANCE_CONTRIBUTION National insurance contribution
TAX_WITHHOLDING Tax withholding payment
EMPLOYEE_PAYMENT Payment to employee
SUPPLIER_PAYMENT Payment to supplier
LOAN_PAYMENT Loan repayment
INTERNAL_TRANSFER Internal bank transfer
GARNISHMENT Garnishment deduction payment

Reconciliation Line Attributes

Attribute Type Description
id integer The unique identifier of the reconciliation line
document_id integer The ID of the parent document
line_id integer Line number within the document
description string Description of the line as printed on the statement
reconciliation_type string TRANSACTIONAL for a movement on the statement, BALANCE for a balance at a date
amount decimal The amount as printed on the statement
currency_code string Currency code
transaction_date date Date of the movement or balance. null means the document period applies
category string What the line is about, as the issuer presents it; see Reconciliation Category. null until classified. Extraction fills it; writable through nested reconciliation_lines on PATCH/PUT
status string Derived from the line’s live external reconciliation (read-only). Only present with with=reconciliation_lines.status; see Reconciliation Line Status
target object Derived from category (read-only). Only present with with=reconciliation_lines.target; null when the line has no category or the client’s country has no rules. ledger_sign (1 or -1) is the sign applied to amount to get the expected ledger amount; accounts lists the general ledger accounts a sign-off may point at (id, account_code, description); dimension is the document’s value for the sub-ledger dimension those accounts require ({"relation_type": "businesspartner", "relation_id": 56}), or null

Reconciliation Category

The category is written from the document’s point of view: what the line is about, as the issuer presents it. It fixes the ledger sign and, per country, the accounts a sign-off may use; the document supplies the dimension (its business partner for businesspartner, its bank account for bankacc) where a target account requires one. The sign reads the printed amount — positive when the item increases the issuer’s running balance for the client — into ledger terms (debit positive). If extraction got a printed sign wrong, correct the line’s amount while it is OPEN; the category rule never bends.

Category What the line is about Sign Accounts (NO)
DEPOSIT balance or movement on an account the bank holds for us +1 1900–1969, 2380–2399
DEPOSIT_INTEREST interest, customer dividend or other return the bank credited −1 8050–8079
DEPOSIT_FEE fees or commission charged on the deposit account −1 7770–7779
OVERDRAFT_INTEREST interest charged on an overdrawn deposit or card account −1 8150–8159
LOAN outstanding principal, draws, repayments on a loan or credit facility −1 2200–2399, 2900–2999
LOAN_INTEREST interest charged on the loan +1 8150–8159
LOAN_FEE fees on the loan +1 7770–7779, 8170–8179
TRADE_PAYABLE invoices, credit notes, payments, balance on a supplier statement −1 2400–2499
TRADE_RECEIVABLE the same on a customer statement +1 1500–1579
PENSION_PREMIUM contributions invoiced or paid to a pension scheme +1 5420–5429
PENSION_FUND balance of a premium or contribution fund held for us +1 1700–1799
INSURANCE_PREMIUM premiums invoiced or paid +1 7500–7599
VAT VAT due per return or settlement −1 2740
TAX_WITHHOLDING withheld employee tax due −1 2600–2609
EMPLOYER_CONTRIBUTION employer’s national insurance due −1 2770–2779
INCOME_TAX company tax assessed or prepaid −1 2500–2599
INVESTMENT holdings or value in an investment account +1 1300–1399, 1800–1899
INVESTMENT_RETURN dividends or gains credited −1 8070–8079

Lines of an AP_STATEMENT are always TRADE_PAYABLE. Annual report extraction classifies each line, leaving null where nothing applies (revenue, payroll cost and other financial statement lines). A line without a category cannot be signed off. An invalid value is refused with 400 Invalid reconciliation category.

Reconciliation Line Status

Reconciliation lines are attested through External Reconciliations: a record compares the line’s printed amount with journal entry lines (for TRANSACTIONAL lines) or an account balance (for BALANCE lines). The status is recomputed on every read by re-running that comparison against the current ledger.

Value Description
OPEN No live external reconciliation references the line
RECONCILED The ledger side is unchanged since the record was made and the difference is zero
EXPLAINED The ledger side is unchanged and the non-zero difference is covered by reconciling items
DRIFTED The ledger amount has moved since the record was made; the record no longer describes the ledger

A line referenced by a live external reconciliation cannot have its amount, currency_code, transaction_date, reconciliation_type or category changed, and neither the line nor its document can be deleted, until the reconciliation is retired (400 Reconciliation line is reconciled).

File Relationships

Documents can have multiple associated files:

  • A primary voucher file (through voucher_id)
  • Additional attached files (through the files relationship)
  • Files can be accessed through their download URLs with appropriate permissions

Example Response

Example shown with with=files,item_lines,payment_lines — these relations are omitted unless requested.

{
    "id": 1,
    "created_at": "2023-05-10T12:00:00Z",
    "client_account_id": 1,
    "business_partner_id": 2,
    "document_date": "2023-05-10",
    "due_date": "2023-06-09",
    "document_type": "ARINV",
    "document_status": "OPEN",
    "document_number": "INV-2023-001",
    "document_description": "Monthly services",
    "gross_amount": "1200.00",
    "net_amount": "1000.00",
    "currency_code": "EUR",
    "exchange_rate": "1.0000",
    "payment_status": "NONE",
    "stated_payment_status": null,
    "is_draft": false,
    "is_active": true,
    "is_payable": true,
    "is_unpaid": true,
    "is_available_for_payment": true,
    "is_being_paid": false,
    "is_reconcilable": true,
    "is_unreconciled": true,
    "files": [
        {
            "id": 1,
            "file_name": "invoice.pdf",
            "download_url": "https://example.com/files/invoice.pdf",
            "thumbnail_url": "https://example.com/thumbnails/invoice.jpg"
        }
    ],
    "item_lines": [
        {
            "id": 1,
            "document_id": 1,
            "line_id": 1,
            "item_id": null,
            "item_no": null,
            "item_name": "Consulting Services",
            "description": "Professional consulting May 2023",
            "price": "1000.000000",
            "currency_code": "EUR",
            "quantity": "1.000000",
            "unit_id": 5,
            "tax_code_id": 3,
            "tax_rate": "25.000000",
            "tax_amount_lc": "250.000000",
            "tax_amount_fc": "250.000000",
            "total_lc": "1250.000000",
            "total_fc": "1250.000000",
            "item_collection_entry_id": null
        }
    ],
    "payment_lines": [
        {
            "id": 1,
            "document_id": 1,
            "line_type": "SUPPLIER_PAYMENT",
            "requested_execution_date": "2023-06-09",
            "debtor_business_partner_id": null,
            "debtor_bank_account_id": 24,
            "creditor_business_partner_id": 2,
            "creditor_bank_account_id": null,
            "amount": "1250.000000",
            "currency_code": "EUR",
            "creditor_reference": "12345678901"
        }
    ]
}

Notes

  • The client_account_id must be one of the eligible client accounts for the authenticated user
  • When creating or updating a document, the created_by_id/updated_by_id is automatically set to the authenticated user’s ID
  • Documents marked with send_document will be automatically sent when created or updated from draft status
  • The preview endpoint generates a PDF preview without saving the document
  • All amounts are returned as string representations of decimal numbers
  • Dates are returned in ISO 8601 format
  • Relationships can be included by specifying them in the with query parameter
  • Draft documents can be modified or deleted; finalized documents have restrictions
  • Files associated with documents can be accessed through their download URLs which expire after one hour