ERPNext logo ERPNext automation · runs weekly

Create and submit ERPNext sales invoices from a billing list

Every week the same list lands in a spreadsheet: customer, item, quantity, rate. Someone opens ERPNext, finds or creates each customer and types the lines into a new Sales Invoice one by one.

Cotlet does it in your own ERPNext account with list_customers, create_customer, create_sales_invoice and submit_sales_invoice, called by your AI agent, an n8n workflow or a script.

Hosted · nothing to install or maintain

Can ERPNext do this on its own?

ERPNext lets you build one invoice at a time in the Sales Invoice form (checked 14 Oct 2026). The REST API can create the same records, but it is a building block: you write the customer lookup, the line items and the submit step yourself. ERPNext has no feature that turns a list of customers and hours into a batch of invoices.

How you do it in ERPNext today

  1. Open Selling > Customer and search for the customer; if there is none, select Add Customer, enter the Customer Name and pick the Customer Type, Customer Group and Territory.
  2. Open Accounting > Sales and Receivables > Sales Invoice and click Add Sales Invoice, then choose the Company and the Customer, which brings in the address, currency and price list.
  3. Set the Posting Date and the Payment Due Date, then add each line under Items with Quantity and Rate.
  4. Add taxes under Sales Taxes and Charges, either by hand or from a template, and read the Grand Total.
  5. Save the invoice, which keeps it as a draft with no ledger effect, then click Submit once the amounts are right. Repeat for every customer on the list.

How to create and submit ERPNext sales invoices from a billing list

Prompt

Here is this week's billing list with customer, item, quantity and rate. Create the customers that do not exist yet, create a draft sales invoice for each one with the 10% sales tax template, show me the totals, and submit them after I say OK.
  1. 01

    Match every name to a customer

    Your agent looks up each name from the list with list_customers and writes down the exact Customer ID. A name with two close matches, such as two companies called Northwind, goes back to you instead of being guessed.

  2. 02

    Create only what is missing

    For a name with no match, create_customer runs with the Customer Type you named in the prompt. Nothing is created twice if the same new customer appears on three lines.

  3. 03

    Save drafts, not invoices

    create_sales_invoice saves one draft per customer with its lines, Posting Date, Payment Due Date and tax template. A draft has no ledger effect, so a wrong row costs you nothing yet.

  4. 04

    Show the totals before anything is final

    The agent lists each draft with net total, tax and grand total and checks that the sum of the lines matches your list. It stops here until you reply OK, or runs on if you told it to.

  5. 05

    Submit in a fixed order

    submit_sales_invoice runs one invoice at a time, oldest customer first, and reports any invoice ERPNext refuses, for example because a mandatory field on your site is empty. The rest continue.

What you get back

Example data

Billing list: 3 customers
New customers created: 1 (Harbor & Pine, Company)
Drafts created: 3
- ACC-SINV-2026-00042 Northwind Studio: net 1,500.00, tax 150.00, total 1,650.00
- ACC-SINV-2026-00043 Lumen Dental: net 450.00, tax 45.00, total 495.00
- ACC-SINV-2026-00044 Harbor & Pine: net 800.00, tax 80.00, total 880.00
Submitted after your OK: 3 of 3

Other ways to ask

  • Create the drafts only and leave them for me to check in ERPNext. Do not submit anything.
  • Bill the same three retainers on the first working day of every month, using last month's invoice as the template.
  • Create one invoice per row of this CSV and send me the ones where the grand total is above 5,000.
  • Find customers on my list that have no invoice since 1 September and draft one for each.

What ERPNext allows, and what to know first

  • ERPNext saves a new Sales Invoice as a draft, and a draft has no effect on the ledger until you click Submit.
  • The Payment Due Date on the invoice decides whether it becomes Overdue later, so set it before you submit.
  • A submitted or cancelled document cannot be edited, so a wrong submitted invoice has to be cancelled and replaced.
  • The Customer on an invoice supplies the billing address, contact, currency, price list and receivable account defaults.
  • Creating, submitting and cancelling follow the roles of the signed-in user, so an account that may only create drafts cannot submit.

submit_sales_invoice asks for your OK by default. To run it weekly without you, switch confirmation off for that tool in your dashboard.

Sources: ERPNext Docs: Sales Invoice · ERPNext Docs: Customer · Frappe Docs: Docstatus · Frappe Docs: REST API

Call create_sales_invoice from a script

curl

curl -X POST https://cotlet.dev/api/v1/erpnext/sales-invoices \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customer":"Northwind Studio","items":[{"item_code":"CONSULT-HR","qty":10,"rate":120},{"item_code":"SETUP-FEE","qty":1,"rate":300}],"posting_date":"2026-10-14","due_date":"2026-11-13","taxes_template":"Sales Tax 10% - AC"}'

Example response

{
  "invoice": "ACC-SINV-2026-00042",
  "customer": "Northwind Studio",
  "status": "Draft",
  "docstatus": 0,
  "posting_date": "2026-10-14",
  "due_date": "2026-11-13",
  "currency": "USD",
  "items": [
    {
      "item_code": "CONSULT-HR",
      "qty": 10,
      "rate": 120,
      "amount": 1200
    },
    {
      "item_code": "SETUP-FEE",
      "qty": 1,
      "rate": 300,
      "amount": 300
    }
  ],
  "net_total": 1500,
  "total_taxes": 150,
  "grand_total": 1650
}

MCP: add https://cotlet.dev/mcp/v1 with the same key; the call is erpnext_write → create_sales_invoice. Example data.

Schedule it in n8n, Make, Zapier or cron

ERPNext tools this automation uses

Cotlet ERPNext tools used to create and submit ERPNext sales invoices from a billing list
Tool Parameters
list_customers search, customer_group, territory, limit, cursor
create_customer customer_name, customer_type, customer_group, territory, billing_currency
create_sales_invoice customer, items, posting_date, due_date, company, taxes_template
submit_sales_invoice invoice
All 13 ERPNext tools with descriptions

Frequently asked questions

Does the agent send the invoice to my customer?

No. It creates and submits the Sales Invoice in ERPNext. Sending it by email or sharing a link is a separate step you do in ERPNext or with your own mail tool.

Is it safe to connect ERPNext to Cotlet?

Yes. You sign in to ERPNext yourself, in your own Cloud Browser in the EU, and we never save your password. Your agents only get ERPNext once you enable it, every background request is listed, and the browser profile is stored encrypted with AES-256-GCM, the cipher 1Password uses for its vaults. The AI model never sees a login, posts and messages wait for your OK, and Disable for agents cuts access in one click. Independent scanners grade cotlet.dev A+ on Qualys SSL Labs, securityheaders.com and Mozilla Observatory; live results are on https://cotlet.dev/security.

Give your agent access to ERPNext.

Free 7-day trial with 2,000 credits, no card needed. Cotlet is independent and not affiliated with ERPNext.