Calculate tax
Calculate tax for a transaction before you create it.
Public record create and update keep caller-supplied tax by default. Set
auto_calculate_tax to "required" to calculate and replace line tax on write
(or receive 422 when calculation cannot complete). On write, the calculation supports
native US sales tax (the DualEntry tax engine) and Avalara Sales Tax, VAT, and GST.
Native VAT and GST return 422.
Use this endpoint when you need a preview, when you selected a VAT/GST rate and want to
confirm amounts, or when you will copy results onto lines without auto_calculate_tax.
Required:
company_idcustomer_id(money-in) orvendor_id(money-out), not both
Usually also send:
itemswithitem_id,quantity, andunit_pricetransaction_buyer_addressfor US sales tax (destination / shipping address)transaction_dateandcurrency_codefor US sales taxsupply_dateto filter VAT/GST rates by validity
The response type is SALES_TAX, VAT, GST, or NONE. NONE is HTTP 200
with a reason (for example a missing buyer address). It is not an error.
Map each result line onto record items[].tax (and expenses[].tax when present):
tax_code→tax.codetax_rate→tax.ratetax_amount→tax.amountis_taxable→tax.is_taxabletax_exempt_amount→tax.tax_exempt_amounttax_metadata→tax.tax_metadataselected_vat_rate_id→tax.vat_rate_idselected_gst_tax_rate_id→tax.gst_tax_rate_id
For native Canada GST and VAT previews, the first call returns available_rates.
Pick a rate. On this endpoint, send it as selected_vat_rate_id or
selected_gst_tax_rate_id. On a record line without auto_calculate_tax, send it
as tax.vat_rate_id or tax.gst_tax_rate_id.
auto_calculate_tax: "required" does not select native VAT/GST rates.
On create and update with auto_calculate_tax, money-in uses payload shipping_address,
then billing_address, then the customer saved address. Money-out uses payload
ship_from_address and ship_to_address, then the vendor and company saved
addresses. When a money-in payload has no address, DualEntry copies the customer
saved address to billing_address and shipping_address. A money-out record saves
only the ship addresses that the payload sends. This calculate endpoint does not read the customer saved
address for US sales tax. Send transaction_buyer_address.
V2 API only.
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.
255Body
Company ID
1
Customer ID (money-in records)
1
Vendor ID (money-out records)
null
Optional taxable record type. Customer/vendor credits use ReturnOrder estimates.
invoice, cash_sale, customer_credit, sales_order, bill, direct_expense, vendor_credit, purchase_order "invoice"
Optional linked source for customer/vendor credits. Used to pin AvaTax taxOverride.taxDate to the original sale/purchase.
Buyer address on the transaction — required for sales tax, ignored for VAT
Vendor shipment origin for money-out records. Overrides the vendor default address in tax preview.
Company delivery location for money-out records. Overrides the company default address in tax preview.
Transaction date — required for sales tax
"2025-08-29"
Tax point / date of supply — filters VAT and GST rates by valid_from / valid_to
"2025-08-29"
List of items to calculate tax for
Currency code (ISO 4217) — required for sales tax
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 "USD"