Description
n8n-nodes-erpnext-accounting




Community n8n node package for ERPNext/Frappe Accounting v15-v16.
This package is part of the n8n2erpnext ecosystem. It focuses on common ERPNext Accounting doctypes and keeps a generic Frappe escape hatch for custom doctypes and whitelisted methods.
Connected Ecosystem Coverage
Accounting is live-tested as part of a connected ERPNext business lifecycle, not as a standalone invoice or ledger reader.
The Stock validation suite includes end-to-end workflows that connect Buying, Stock, Selling, and Accounting:
- Standard Product Lifecycle: Supplier -> Purchase Receipt -> inventory increase -> Purchase Invoice -> Customer Sale -> Sales Invoice
update_stock = 1-> inventory decrease. - Exception / After-Sales Lifecycle: sale -> return credit note -> warranty warehouse -> defective warehouse -> repair/virtual workshop -> disposal.
- Cross-module lock validation: linked Purchase Invoice blocks unsafe Purchase Receipt cancellation, and linked Sales Invoice blocks unsafe Delivery Note cancellation.
- Ledger validation:
Bin,Stock Ledger Entry, Purchase Invoice, Sales Invoice, Credit Note, and Stock Entry documents are verified after submit. - ERP administrators who maintain ERPNext/Frappe.
- Accounting, finance, or operations teams that need invoice, payment, journal, or ledger workflows.
- Integration teams that need repeatable n8n automations without writing custom Frappe client code for every workflow.
This proves the Accounting node participates in the full operational chain: supplier invoices, customer invoices, return credit notes, and the document locks that protect inventory and financial history.
Live-Tested Status
This package has been live-tested end to end on the project ERPNext/Frappe test environment:
| Area | Status |
| — | — |
| ERPNext/Frappe target | Live-tested on ERPNext v16/Frappe v16 behavior |
| n8n runtime | Live-tested on self-hosted n8n 2.20.7-exp.0 |
| Infrastructure | Live-tested through LXD ERPNext container at http://10.192.135.2:8001 with host header erp.thaiduy.digital |
| API coverage | Live-tested with Frappe API v1 read workflows and API v2 document workflows |
| Module lifecycle | Sales Invoice, Purchase Invoice, Payment Entry, Journal Entry, GL Entry readback, submit/cancel, and stress/security cases |
| Ecosystem coverage | Buying -> Stock -> Selling -> Accounting end-to-end workflows |
| Cross-module lock coverage | Linked Purchase Invoice and linked Sales Invoice protect inventory documents from unsafe cancellation |
| Security response policy | Public webhook responses were allowlisted summaries; securityFindings: [] |
| Cleanup | Temporary workflows were deactivated and verified as 404 Active version not found |
The live verification used traceable demo records in the ERPNext LXD test instance. The README intentionally includes test infrastructure routing values and document IDs, but no API keys, API secrets, Authorization headers, database passwords, npm tokens, or credential material.
Who This Is For
This package is built for teams that run ERPNext Accounting and want a controlled way to connect finance data with n8n workflows.
Typical users:
The node is intentionally conservative: it exposes standard Accounting document operations, supports Frappe API v1 and v2, and allows controlled fallback access to custom DocTypes and whitelisted Frappe methods.
Architecture At A Glance
Read workflow from left to right:
ERPNext / Frappe Accounting <---- API token ----> n8n ERPNext Accounting node <---- webhook/API ----> Client / App / Report
Common read pattern:
Client
-> n8n Webhook
-> ERPNext Accounting node
-> Frappe REST API
-> ERPNext Accounting DocType
-> filtered JSON response
Common accounting lifecycle pattern:
n8n Webhook / Schedule / App Event
-> validation / mapping / approval logic
-> ERPNext Accounting node
-> Invoice, Payment Entry, Journal Entry, or GL readback
-> safe summary response or downstream system
Recommended production network pattern:
Public Client
-> HTTPS reverse proxy / VPN / allowlist
-> n8n
-> private network or internal VPS address
-> ERPNext / Frappe site
Supported Resources
Node Identity
All n8n2erpnext module nodes use the same ERPNext-style logo shape. Each module changes only the main background color.
| Module | Color | Hex | Reason |
| — | — | — | — |
| Core | ERPNext blue | #2490EF | Foundation package, closest to the ERPNext brand color. |
| HRMS | People green | #2E7D5F | Human operations, employees, attendance, leave, payroll. |
| Accounting | Finance orange-red | #D94A2B | Ledger, journals, invoices, financial control. |
| Buying | Procurement amber | #C47F00 | Purchase flow, suppliers, RFQs, purchase orders, spend. |
| Selling | Commerce teal | #00A6A6 | Customer-facing pipeline, quotations, sales orders, revenue. |
| Stock | Frappe black | #171717 | Warehouses, items, inventory movement; aligned with Frappe black. |
When building another module, copy the HRMS/Accounting SVG structure and change only the main background fill to that module color.
Operations
For Accounting doctypes:
For Frappe methods:
API Versions
The node supports both ERPNext/Frappe document API styles:
v1: /api/resource/:doctypev2: /api/v2/document/:doctypeUse v1 for broad compatibility. Use v2 when your ERPNext/Frappe v16 environment is ready for the newer document API behavior.
Reference:
Credentials
Create an API key and secret in ERPNext/Frappe, then configure:
https://erp.example.comerp.example.comThe node authenticates with:
Authorization: token apikey:apisecret
Credential fields are marked as password fields where appropriate. Do not expose API keys, API secrets, Authorization headers, tokens, or passwords in webhook responses, logs, README examples, or package artifacts.
Internal URL With Public Host Header
When n8n and ERPNext run on the same VPS, you can point n8n at the internal ERPNext address and still send the public ERPNext host header:
http://erpnext.internal:8001erp.example.comThis avoids public reverse-proxy authentication while still letting ERPNext receive the expected site host.
For the current VPS/LXD test setup:
Site URL: http://10.192.135.2:8001
Site Host Header: erp.thaiduy.digital
This is infrastructure routing information for the project test environment, not credential material. API keys and API secrets are not included in this README.
For production, create a dedicated ERPNext integration user instead of using a daily admin account. Give that user only the roles required for the workflows it runs.
Official Frappe references:
Examples
Get submitted sales invoices:
{
"resource": "salesInvoice",
"operation": "getMany",
"fields": "name,customer,postingdate,grandtotal,status",
"filtersJson": "[["docstatus","=",1]]",
"returnAll": false,
"limit": 20,
"orderBy": "posting_date desc"
}
Get GL entries for an account:
{
"resource": "glEntry",
"operation": "getMany",
"fields": "name,postingdate,account,debit,credit,vouchertype,voucher_no",
"filtersJson": "[["account","=","1110 - Cash - TDD"]]",
"returnAll": false,
"limit": 50,
"orderBy": "posting_date desc"
}
Run a whitelisted Frappe method:
{
"resource": "frappeMethod",
"operation": "runMethod",
"methodName": "frappe.client.get_value",
"argumentsJson": {
"doctype": "Sales Invoice",
"filters": { "name": "ACC-SINV-2026-00001" },
"fieldname": ["name", "customer", "grand_total"]
}
}
Webhook From n8n to ERPNext Accounting
Use this pattern when you want an HTTP GET endpoint in n8n that returns Accounting data from ERPNext.
Client / Browser / BI Tool
-> GET n8n webhook URL
-> ERPNext Accounting node
-> GET /api/resource or /api/v2/document
-> JSON response
1. Configure the ERPNext Credential
In n8n, create or edit an ERPNext API credential:
http://erpnext.internal:8001erp.example.comfalseFor the current VPS/LXD production setup:
Site URL: http://10.192.135.2:8001
Site Host Header: erp.thaiduy.digital
2. Create the Workflow
Create a workflow with these nodes:
GET Webhook -> ERPNext Accounting
Webhook node:
GETerpnext-accounting-get-accountsWhen Last Node FinishesAll EntriesERPNext Accounting node:
ERPNext API credentialAccountGet Manyv1name,accountname,accountnumber,company,accounttype,isgroup[]false20modified desc3. Activate and Test
Activate the workflow, then call:
curl -i https://n8n.example.com/webhook/erpnext-accounting-get-accounts
On the local VPS, you can test without going through the public proxy:
curl -i http://127.0.0.1:5678/webhook/erpnext-accounting-get-accounts
The working workflow artifact is included in this repository:
n8n-webhook-erpnext-accounting-get-accounts.workflow.json
API v2 read workflow artifact:
n8n-webhook-erpnext-accounting-v2-get-accounts.workflow.json
API v2 test endpoint:
curl -i http://127.0.0.1:5678/webhook/erpnext-accounting-v2-get-accounts
Webhook From ERPNext v16 to n8n
Use this pattern when ERPNext should call n8n automatically after an Accounting document is created or updated. For example, ERPNext can call a n8n workflow whenever a Sales Invoice, Purchase Invoice, or Payment Entry changes.
ERPNext Doc Event
-> Frappe Webhook
-> POST n8n webhook URL
-> n8n workflow
-> validation, notification, sync, approval, audit, or downstream automation
1. Create The n8n Webhook Receiver
Create a workflow in n8n with a Webhook trigger:
Webhook -> your processing nodes
Webhook node:
POSTerpnext-accounting-eventNone for a private/internal test, or Header Auth for productionImmediately or When Last Node FinishesThe production webhook URL will look like:
https://n8n.example.com/webhook/erpnext-accounting-event
On this VPS, if ERPNext and n8n are on the same host/network, you can also use an internal n8n URL from ERPNext.
2. Add The Webhook In ERPNext/Frappe v16
In ERPNext/Frappe Desk:
1. Open the global search bar.
2. Search for Webhook.
3. Open Webhook from the Integrations area.
4. Click New.
Configure the Webhook:
Sales Invoice, Purchase Invoice, or another Accounting DocTypeonsubmit, oncancel, afterinsert, or onupdate depending on the workflowPOSTJSONExample JSON body:
{
"event": "salesinvoicesubmitted",
"doctype": "{{ doc.doctype }}",
"name": "{{ doc.name }}",
"customer": "{{ doc.customer }}",
"company": "{{ doc.company }}",
"postingdate": "{{ doc.postingdate }}",
"grandtotal": "{{ doc.grandtotal }}",
"outstandingamount": "{{ doc.outstandingamount }}",
"status": "{{ doc.status }}",
"modified": "{{ doc.modified }}"
}
For production, add a shared secret header and validate it in n8n:
X-ERPNext-Webhook-Secret: your-long-random-secret
If you use Frappe’s Webhook Secret field, Frappe adds an X-Frappe-Webhook-Signature header generated from the payload and secret. You can verify this signature in n8n with a Code node if needed.
Official Frappe reference:
Tested Workflow Artifacts
The repository includes workflow artifacts used during live ERPNext LXD testing.
Read-only artifacts:
n8n-webhook-erpnext-accounting-get-accounts.workflow.json
n8n-webhook-erpnext-accounting-v2-get-accounts.workflow.json
n8n-webhook-erpnext-accounting-get-journal-entry-by-id.workflow.json
Write-test artifacts:
n8n-webhook-erpnext-accounting-v2-create-journal-entry.workflow.json
n8n-webhook-erpnext-accounting-v2-update-journal-entry.workflow.json
n8n-webhook-erpnext-accounting-submit-cancel-journal-entry.workflow.json
n8n-webhook-erpnext-accounting-v2-create-sales-invoice-draft.workflow.json
n8n-webhook-erpnext-accounting-v2-business-lifecycle-test.workflow.json
Stress/security artifact:
n8n-webhook-erpnext-accounting-v2-stress-security-test.workflow.json
Accounting write-test workflows create real demo/test documents in the ERPNext LXD test instance. They should be activated only during testing and deactivated after verification unless a trusted operator intentionally keeps them active.
Journal Entry API v2 Nested Payload Test
This package has been tested with a draft Journal Entry payload that includes the nested accounts child table through the Frappe v2 document API.
Workflow artifact:
n8n-webhook-erpnext-accounting-v2-create-journal-entry.workflow.json
Test shape:
GET Webhook -> ERPNext Accounting
ERPNext Accounting node:
Journal EntryCreatev2accountsPayload pattern:
{
"voucher_type": "Journal Entry",
"company": "Thái Duy Digital",
"posting_date": "2026-05-14",
"user_remark": "n8n Accounting node API v2 nested accounts draft test. Do not submit.",
"accounts": [
{
"account": "1110 - Cash - TDD",
"debitinaccount_currency": 1000,
"creditinaccount_currency": 0
},
{
"account": "3300 - Opening Balance Equity - TDD",
"debitinaccount_currency": 0,
"creditinaccount_currency": 1000
}
]
}
Verified result:
ACC-JV-2026-00001docstatus: 0total_debit: 1000total_credit: 1000difference: 00The test workflow was deactivated after verification to prevent accidental repeated draft Journal Entry creation.
Get Journal Entry By ID
Use these read-only webhooks to fetch a Journal Entry by document name.
Workflow artifact:
n8n-webhook-erpnext-accounting-get-journal-entry-by-id.workflow.json
API v1 endpoint:
curl -i 'http://127.0.0.1:5678/webhook/erpnext-accounting-get-journal-entry?name=ACC-JV-2026-00001'
API v2 endpoint:
curl -i 'http://127.0.0.1:5678/webhook/erpnext-accounting-v2-get-journal-entry?name=ACC-JV-2026-00001'
Both endpoints return the Journal Entry header and nested accounts rows.
Update Journal Entry API v2 Test
This package has also been tested with an API v2 update against the same draft Journal Entry.
Workflow artifact:
n8n-webhook-erpnext-accounting-v2-update-journal-entry.workflow.json
Test shape:
POST Webhook -> ERPNext Accounting
ERPNext Accounting node:
Journal EntryUpdatev2ACC-JV-2026-00001user_remarkPayload pattern:
{
"user_remark": "n8n Accounting node API v2 update test passed. Draft remains unsubmitted; no GL Entry created."
}
Verified result:
ACC-JV-2026-00001docstatus: 0total_debit: 1000total_credit: 1000difference: 00The test workflow was deactivated after verification to prevent accidental repeated writes.
Submit And Cancel Journal Entry Test
Submit and Cancel have been tested with the same Journal Entry to verify the full accounting document lifecycle.
Workflow artifact:
n8n-webhook-erpnext-accounting-submit-cancel-journal-entry.workflow.json
Test shape:
POST Submit Webhook -> ERPNext Accounting Submit
POST Cancel Webhook -> ERPNext Accounting Cancel
ERPNext Accounting node:
Journal Entryv2ACC-JV-2026-00001Submit, then CancelVerified submit result:
docstatus: 12100010000Verified cancel result:
docstatus: 24200020004Implementation note:
frappe.client.submit expects { doc }.frappe.client.cancel expects { doctype, name }.The Submit/Cancel workflow was deactivated after verification to prevent accidental repeated ledger writes.
Business Lifecycle And Stress/Security Tests
Accounting write tests are intentionally shipped as inactive workflow artifacts. Import and review them before activation because they create submitted accounting documents and ledger entries.
Lifecycle workflow artifact:
n8n-webhook-erpnext-accounting-v2-business-lifecycle-test.workflow.json
Lifecycle test shape:
POST Webhook
-> Build bounded run context
-> Create Customer, Supplier, sales Item, purchase Item
-> Create and submit Sales Invoice
-> Create and submit Receive Payment Entry
-> Create and submit Purchase Invoice
-> Create and submit Pay Payment Entry
-> Create and submit simulated closing Journal Entry
-> Read closing GL Entries
-> Return safe allowlisted summary
The test uses unique N8N-ACC-LIFECYCLE-* master data per run and keeps the webhook response restricted to document names, totals, counts, and credential leak-scan status. It does not return raw ERPNext documents or credentials.
Default account assumptions:
Cash: 1110 - Cash - TDD
Receivable: 1310 - Debtors - TDD
Payable: 2110 - Creditors - TDD
Sales: 4110 - Sales - TDD
Expense: 5111 - Cost of Goods Sold - TDD
Closing equity: 3300 - Opening Balance Equity - TDD
Adjust these account names before running the workflow on another ERPNext company/chart of accounts.
Stress/security workflow artifact:
n8n-webhook-erpnext-accounting-v2-stress-security-test.workflow.json
Stress/security shape:
POST Webhook
-> Build 1..25 stress items
-> Read Account getMany through API v2
-> Return safe counts and leak-scan status
Example body:
{
"iterations": 10
}
The workflow caps iterations at 25, performs read-only account queries, and scans the response payload for credential-like strings such as API key, API secret, Authorization, token, and password.
Verified Business Lifecycle Run
The lifecycle and stress/security workflows were imported into the live n8n container, activated temporarily, tested against the ERPNext LXD instance, and deactivated again.
Test timestamp:
2026-05-14 09:58-09:59 UTC
Lifecycle result:
Run ID: N8N-ACC-LIFECYCLE-1778752708065
Status: passed
Sales Invoice: ACC-SINV-2026-00002
Receive Payment Entry: ACC-PAY-2026-00001
Purchase Invoice: ACC-PINV-2026-00001
Pay Payment Entry: ACC-PAY-2026-00002
Closing Journal Entry: ACC-JV-2026-00002
Closing GL rows: 3
Closing debit total: 1500
Closing credit total: 1500
Security findings: []
ERPNext DB verification:
ACC-SINV-2026-00002 | docstatus 1 | Paid | grand_total 1500 | outstanding 0
ACC-PINV-2026-00001 | docstatus 1 | Paid | grand_total 600 | outstanding 0
ACC-PAY-2026-00001 | docstatus 1 | Receive | paid 1500 | received 1500
ACC-PAY-2026-00002 | docstatus 1 | Pay | paid 600 | received 600
ACC-JV-2026-00002 | docstatus 1 | debit 1500 | credit 1500 | difference 0
GL verification:
Sales Invoice ACC-SINV-2026-00002 | 2 rows | debit 1500 | credit 1500 | cancelled 0
Payment Entry ACC-PAY-2026-00001 | 2 rows | debit 1500 | credit 1500 | cancelled 0
Purchase Invoice ACC-PINV-2026-00001 | 2 rows | debit 600 | credit 600 | cancelled 0
Payment Entry ACC-PAY-2026-00002 | 2 rows | debit 600 | credit 600 | cancelled 0
Journal Entry ACC-JV-2026-00002 | 3 rows | debit 1500 | credit 1500 | cancelled 0
Stress/security verification:
iterations=3 -> requestedIterations 3, accountRowsReturned 15, leakedPatterns []
iterations=30 -> requestedIterations 25, accountRowsReturned 125, leakedPatterns []
After testing, both workflow endpoints returned 404 Active version not found, confirming the write-test webhook and stress-test webhook were no longer active.
Reverse Proxy Notes
If https://erp.example.com is protected by NetBird or another reverse-proxy auth layer, n8n server-side requests may be blocked before they reach ERPNext. In that case:
Site URL.Site Host Header to the public ERPNext host.Security Baseline
Accounting data includes invoices, payments, ledger rows, tax accounts, payable/receivable balances, and business financial records. Treat every workflow as sensitive by default.
Recommended baseline:
Get Many with explicit Fields over Get when exposing webhook responses, because Get can return the full document including comments, owners, child tables, and accounting metadata.Site Host Header.Security Notice
This package pins transitive form-data resolution with an npm overrides entry so npm audit --omit=dev reports no known vulnerabilities at release time. Keep this override in place until upstream dependencies resolve to a safe version without assistance.
In this package’s tested deployment model, security risk is also reduced by:
Do not treat this mitigation as a permanent substitute for dependency maintenance. Re-run npm audit --omit=dev before publishing a new package version and upgrade compatible n8n dependencies when the upstream dependency chain allows it without breaking n8n node compatibility.
Deployment Checklist For SME And Mid-Market Teams
Before going live:
v1 or v2.Site Host Header if ERPNext is served by a named Frappe site.Get Many for each required resource with limited fields.Suggested production approach:
Troubleshooting
Common checks:
401 or 403: verify API key, API secret, user roles, and DocType permissions in ERPNext.EPROTO or tlsv1 alert internal error: use the internal ERPNext HTTP URL from n8n when the public domain is protected by a reverse proxy or VPN layer.[] response: the node is working, but filters may not match any records.Site Host Header to the public ERPNext site name./webhook/ URL, not /webhook-test/.Get to Get Many and set an explicit Fields list.Development
npm install
npm run build
npm run lint
For local n8n testing, link this package into your n8n custom nodes directory or install it from a packed tarball.
Useful n8n references:
Scope And Roadmap
This package is intentionally Accounting-focused. Other ERPNext modules should live in separate packages so each module can evolve independently:
n8n-nodes-erpnext-hrmsn8n-nodes-erpnext-sellingn8n-nodes-erpnext-buyingn8n-nodes-erpnext-stockRecommended next hardening tasks before wider public adoption:
Official References
Frappe / ERPNext:
n8n:
License
MIT
Acknowledgement
Prepared and reviewed with care by Codex for the n8n2erpnext ERPNext Accounting integration work.
Signed: Codex, May 14, 2026.