create_sales_invoice
Creates an item-invoice Sales voucher in TallyPrime with stock item lines, quantities, rates, and per-line sales ledgers. Supports optional VAT and buyer details for real invoice posting.
Instructions
Create an item-invoice Sales voucher in TallyPrime — a real invoice with stock item lines (quantity, rate), each posted to its own Sales ledger, plus one optional VAT/tax line on the total. Distinct from create_voucher, which only supports plain ledger-to-ledger entries with no stock items. WARNING (confirmed live): if the same party ledger or stock item is used in BOTH a Sales and a Purchase item-invoice, it can become undeletable via the API afterward (returns 'Cannot be deleted!' even with zero balance) — using it in only one of the two is fine and stays deletable. If it does happen, running Company Data → Rewrite in Tally itself clears it (confirmed live) — this is not a permanent lock.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"date": "<date>",
"partyLedger": "<partyLedger>",
"items": "<items>"
},
"name": "create_sales_invoice"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Invoice date in DD-MM-YYYY format | |
| items | Yes | One entry per invoice line. | |
| billName | No | Bill reference name for bill-wise tracking (requires the party ledger's maintainBillWise to be on). Omit if not using bill-wise tracking. | |
| billType | No | Defaults to 'New Ref'. | |
| buyerTrn | No | The buyer's Tax Registration Number as it should appear on THIS invoice — a per-voucher snapshot (Tally's TRADERCONSVATTINNO/BASICBUYERSSALESTAXNO fields), separate from and not inherited from the party ledger's own trn (create_ledger). Reverse-engineered from a real Tax Invoice export: leaving this unset is exactly what leaves the invoice's Party Details showing a blank TRN even when the party ledger has one set — always pass this explicitly for a UAE VAT tax invoice. | |
| buyerName | No | Name to print in this voucher's Buyer (Bill to) box, when it should differ from the customer ledger's own name — Tally's per-voucher Party Details mailing name. The ledger itself is not changed. Useful when many sales are posted against one shared ledger (e.g. cash or card sales) but each invoice needs its own readable buyer name. | |
| narration | No | Narration / description for the invoice | |
| reference | No | Free-text reference for this invoice (Tally's voucher-level REFERENCE field), e.g. a purchase order or bill number the customer quoted. | |
| vatLedger | No | Default VAT/tax ledger applied to any item that doesn't set its own vatLedger (optional — omit for a fully non-taxable invoice). | |
| buyerState | No | The buyer's Emirate/state as it should appear on THIS invoice's Party Details (voucher-level STATENAME) — not inherited from the party ledger master. Match the company's existing convention (check get_company_info or an existing invoice). | |
| partyLedger | Yes | Customer ledger name (the party being invoiced) | |
| voucherType | No | Voucher type to post as, for a company that uses its own Sales-class type in Item Invoice mode (e.g. 'Tax Invoice', 'Export Invoice'). Defaults to 'Sales'. | |
| buyerCountry | No | The buyer's country as it should appear on THIS invoice's Party Details (voucher-level COUNTRYOFRESIDENCE). Plain free text, e.g. 'UAE'. | |
| referenceDate | No | Date for the reference above, in DD-MM-YYYY format. Independent of the invoice's own date. | |
| voucherNumber | No | Explicit voucher number. Normally omit this and let Tally auto-number — but some Tally configurations (confirmed live: after a Company Data → Rewrite in at least one case) stop auto-numbering item-invoice vouchers via the XML gateway and fail with a blank EXCEPTIONS:1/no error text unless a number is given explicitly. If a create call fails with no error text, check get_vouchers for the highest existing number of this voucher type and retry with voucherNumber set to the next one. | |
| vatRatePercent | No | Default VAT rate as a percentage, e.g. 5. Required if vatLedger is set. Items with mixed rates can override this per-line. | |
| placeOfSupplyCountry | No | UAE VAT Place of Supply Country (Tally's PLACEOFSUPPLYCOUNTRY field), e.g. 'UAE'. | |
| placeOfSupplyEmirate | No | UAE VAT Place of Supply Emirate for this invoice (Tally's EMIRATEPOS field) — for a standard domestic B2B supply of services this is normally the SUPPLIER's own Emirate (check get_company_info), not the buyer's. Required for a compliant UAE tax invoice; omitting it is what left this blank on a real invoice this was reverse-engineered from. |