Create sales invoice
Saves a draft sales invoice with item lines, dates and a tax template.
POST https://cotlet.dev/api/v1/erpnext/sales-invoices
write
Saves a Sales Invoice as a draft and returns its ID and totals. A draft has no ledger effect and nothing is sent to the customer, and you can delete it in ERPNext, so this call does not ask for confirmation. The customer supplies the address, currency and price list defaults. Net total is the sum of the line amounts. To make the invoice final, call submit_sales_invoice.
Parameters
| Name | Type | Description |
|---|---|---|
| customer string required | string | Customer ID from list_customers. |
| items array required | array | Lines as objects: item_code (from list_items), qty and rate. |
| posting_date string | string | YYYY-MM-DD. Default: today. |
| due_date string | string | Payment Due Date, YYYY-MM-DD. Decides when the invoice becomes Overdue. |
| company string | string | Company name. Default: the default company of the signed-in user. |
| taxes_template string | string | Name of a Sales Taxes and Charges template from your site. |
Request
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"}' result = client.call("erpnext", "create_sales_invoice", {"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"}) const result = await cotlet.call('erpnext', 'create_sales_invoice', {"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"}); cotlet call erpnext create_sales_invoice --data '{"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
}