Invoices → accounting
This guide connects MendriX invoicing to your accounting system: pull finalized invoices out, and post payments back in. It uses the Invoice service (list/get/patch/finalize/cancel/delete, plus payments).
Step 1 — Pull finalized invoices (incremental)
Section titled “Step 1 — Pull finalized invoices (incremental)”# Page finalized invoices changed since your last run.curl "$MENDRIX_BASE/invoice/invoices/?since=$WATERMARK&limit=1000" \ -H "Authorization: Bearer $MENDRIX_ACCESS_TOKEN" \ -H "Accept: application/json"const since = loadWatermark() || 1; // sequence number; 1 on the first runconst params = new URLSearchParams({ limit: '1000', since });
const state = {};for await (const invoice of listAll('/invoice/invoices/', params, state)) { if (isFinalized(invoice)) { postInvoiceToAccounting(invoice); // your side }}saveWatermark(state.maxSequence); // once, at the end of the cycleFetch a single invoice’s full detail with
GET /invoice/invoices/{invoiceId} when you need line-level data.
- Schedule Trigger — e.g. hourly.
- HTTP Request
Get access token— the login node from Using n8n (Custom Auth =MendriX API token). - HTTP Request (
GET /invoice/invoices/):Authorizationheader =Bearer {{ $('Get access token').first().json.data.items[0].access }}, querylimit=1000andsince={{ $json.watermark }}; enable pagination. - Filter node — keep only finalized invoices.
- Map fields and create/update the invoice in your accounting system.
- Store
data.maxSequencefrom the last page as the next watermark — it is a sequence number, not a date (see Pagination & sync).
Importable workflow: invoices-accounting.json.
Step 2 — Post payments back
Section titled “Step 2 — Post payments back”When your accounting system registers a payment, record it against the MendriX invoice:
curl -X POST "$MENDRIX_BASE/invoice/invoices/INVOICE_ID/payments" \ -H "Authorization: Bearer $MENDRIX_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "amount": 1250.00, "date": "2026-07-21", "reference": "BANK-TXN-8842" }'List or remove payments:
curl "$MENDRIX_BASE/invoice/invoices/INVOICE_ID/payments" \ -H "Authorization: Bearer $MENDRIX_ACCESS_TOKEN"
curl -X DELETE \ "$MENDRIX_BASE/invoice/invoices/INVOICE_ID/payments/PAYMENT_ID" \ -H "Authorization: Bearer $MENDRIX_ACCESS_TOKEN"Refer to the reference for the exact payment body.
- Trigger on a payment event from your accounting system (Webhook or Schedule).
- HTTP Request
Get access token— the login node from Using n8n. - HTTP Request (
POST /invoice/invoices/{{ $json.invoiceId }}/payments),Authorizationheader =Bearer {{ $('Get access token').first().json.data.items[0].access }}, JSON body withamount,date,reference. - Handle errors (e.g. invoice not found / already paid) via the error output.
Other invoice operations
Section titled “Other invoice operations”The Invoice service also supports, via REST (see the reference):
POST /invoice/invoices/{invoiceId}/finalize— finalize a preliminary invoice.POST /invoice/invoices/{invoiceId}/cancel— cancel an invoice.DELETE /invoice/invoices/{invoiceId}— delete a preliminary invoice.PATCH /invoice/invoices/{invoiceId}— merge-patch (preliminary-only fields apply while preliminary).
Reconciliation tips
Section titled “Reconciliation tips”- Match on a stable key (MendriX invoice id ↔ your accounting reference).
- Idempotent payment posting — guard against posting the same bank
transaction twice (dedupe on
reference). - Watermark after success so a failed run safely re-reads next time.