Create sales invoice
Saves a draft sales invoice with item lines, dates and a tax template.
MCP tool erpnext_write → create_sales_invoice
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. |
tools/call
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "erpnext_write",
"arguments": {
"operation": "create_sales_invoice",
"arguments": {
"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
{
"content": [
{
"type": "text",
"text": "{ ... same JSON as structuredContent ... }"
}
],
"structuredContent": {
"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
},
"isError": false
}