Create InvoiceV2 record
Create an invoice.
A posted invoice writes general ledger entries. Those entries debit accounts receivable and credit income or a deferral account. Tax and discounts write their own entries. A draft does not post those entries.
When you send contract_id or sales_order_id, DualEntry links that contract or sales order.
When you create an invoice and send neither billing_address nor shipping_address, DualEntry copies the address saved on the customer to both fields.
The tax on each line stays as you send it. Set auto_calculate_tax to required and DualEntry calculates the tax and replaces it before saving the invoice.
The calculation covers native US sales tax using DualEntry’s tax engine. It also covers Avalara US sales tax, VAT, and GST. If the result is DualEntry’s own VAT or GST, the request fails with 422. A calculation that cannot finish also fails with 422.
DualEntry reads shipping_address, then billing_address, then the address saved on the customer. On an update, the calculation also copies the customer’s saved address to both fields when you send neither address.
To email the invoice, call the send endpoint.
Side effects
- If an approval workflow matches this request, DualEntry can set
record_statusback todraft. - If this request posts the invoice and the company files e-invoices in its country, DualEntry checks the e-invoice with the authority and queues the filing. The check can take up to 10 seconds.
Additional validations
- Fails with
422if the e-invoice of the posted record has data that the authority refuses. Thee_invoicingkey lists the reasons. - Fails with
422and the error codeposting_date_after_limitifdateis after the latest posting date that your organization allows. - Fails with
422anderror_codetax_not_calculatedwhen the organization uses manual tax mode with the tax reminder on, the request posts the record, and the request sends lines but none of them carriestax. Setauto_calculate_taxtorequired, or sendtaxon the lines. - Fails with
422if you set an inactive, archived, or draft customer or vendor, or an inactive company. - Fails with
422if you set the customer or vendor that stands for the record’s own company as a party. - A reference that the record or its linked source record already holds passes these checks.
Authorizations
Headers
Optional. A unique value (a UUID works well) identifying this operation. If the request is repeated with the same key, the original response is replayed instead of the operation running again, so a retry cannot create a duplicate record. Results are replayable for 48 hours. Reusing a key with a different request body returns 422.
255Query Parameters
When false, store submitted line classifications, including an empty list. When omitted, organization defaults apply to new lines with omitted or empty classifications only when the organization setting is enabled.
Body
Tax point date for VAT and GST.
When the saved record uses a VAT or GST tax regime and you omit this field, DualEntry sets it to transaction_date, or to date when there is no transaction_date.
Recurring templates store the value you send. Each generated record that uses VAT or GST and has no supply date gets that default on save.
On PATCH, an omitted field keeps the stored value. Send supply_date again when you change date or transaction_date.
2Deprecated: send the structured billing_address / shipping_address instead.
Deprecated: send the structured billing_address / shipping_address instead.
PERCENTAGE, FIXED Configures how to handle automatic tax calculations.
If auto_calculate_tax is unset, the tax you send on each line is stored. Set it to required to have DualEntry calculate the tax, replacing the tax on every line before it saves the record.
The calculation covers native US sales tax using DualEntry's tax engine. It also covers Avalara US sales tax, VAT, and GST.
- For native VAT and GST, leave this field unset and send the rate and the tax on each line. Set it to
requiredwhen a tax provider returns the tax. - The request fails with
422when the result is DualEntry's own VAT or GST, when the calculation cannot finish, or when a required address is still missing. - When the record has a customer, DualEntry reads
shipping_address, thenbilling_address, then the address saved on the customer. - If you send neither address, DualEntry copies the customer's saved address to
billing_addressandshipping_address. - When the record has a vendor, DualEntry reads
ship_from_addressandship_to_address, then the addresses saved on the vendor and the company. - DualEntry stores only the ship addresses you sent.
required If this customer is intercompany, DualEntry also writes a transaction in the elimination company.
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XAG, XAU, XCD, XDR, XOF, XPD, XPF, XPT, YER, ZAR, ZMW, ZWL If omitted or null, calculated from the company base currency, invoice currency, and date.
draft, posted, archived Schema for payment collection configuration input (matches frontend structure).
Response
OK
Deprecated: send the structured billing_address / shipping_address instead.
Deprecated: send the structured billing_address / shipping_address instead.
Base for record-level tax context; regime discriminates data.
Mirrors TaxResultV2Out (core.taxes.api.taxes)
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XAG, XAU, XCD, XDR, XOF, XPD, XPF, XPT, YER, ZAR, ZMW, ZWL ^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,16}0*$Total amount of transaction
^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,2}0*$Amount to be paid
^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,2}0*$Amount that was already paid by Customer Repayment Applications or Customer Payments
^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,2}0*$Timestamp of the most recent change that could have affected amount_due. Moves whenever the invoice itself is edited, or whenever a posted Customer Payment or Customer Prepayment Application referencing this invoice is written.
Posting date (GL date) - the date when the transaction is recorded in the general ledger
Transaction date (inception date) - the date when the transaction actually occurred
draft, posted, archived PERCENTAGE, FIXED ^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,6}0*$Sum of line-item tax amounts, net of discount-line tax.
^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,2}0*$Date and time the record was created
Date and time the record was last updated
2Schema for payment collection configuration output.
Schema for audit actor information.
Schema for audit actor information.
Schema for rejector information including rejection reason.
The number of the linked sales order.
The e-invoice filing of the record. Null when DualEntry did not file it. Not in v1.