Anatomy of a tax calculation request
Every engine call is a document with a header and lines. This lesson walks through a generic, vendor-neutral request and response, field by field, and shows which fields drive jurisdiction, taxability, rate and exemption.
By Herb Park, Clarent Technologies
Field names differ between ONESOURCE, Vertex, Avalara and others, but every indirect tax engine request carries the same kinds of information. The example below is illustrative and vendor-neutral: it uses plain field names so you can map them to whatever your engine calls them.
A generic request
- Header: Company, Document type, Document number, Document date, Tax date, Currency, Customer
- Line 10: Product code, Quantity, Amount, Ship-from, Ship-to
- Line 20: Product code, Amount, Ship-from, Ship-to
{
"company": "US01",
"documentType": "SalesInvoice",
"documentNumber": "90012345",
"documentDate": "2026-10-15",
"taxDate": "2026-10-15",
"currency": "USD",
"customer": { "id": "C-1001", "exemptionCertificate": null },
"lines": [
{
"lineNumber": 10,
"productCode": "MAT-55021",
"quantity": 4,
"amount": 1200.00,
"shipFrom": { "country": "US", "region": "TX", "city": "Houston", "postalCode": "77041" },
"shipTo": { "country": "US", "region": "CO", "city": "Denver", "postalCode": "80202" }
},
{
"lineNumber": 20,
"productCode": "FREIGHT",
"amount": 85.00,
"shipFrom": { "country": "US", "region": "TX", "city": "Houston", "postalCode": "77041" },
"shipTo": { "country": "US", "region": "CO", "city": "Denver", "postalCode": "80202" }
}
]
}Header fields and what they drive
| Field | What it drives | If it is wrong |
|---|---|---|
| Company / legal entity | Which configuration applies: registrations, rules, defaults | Tax calculated as if a different entity sold it, or not at all where the entity is not set up |
| Document type | Direction (sale or purchase) and sign (invoice or credit) | Credits taxed as sales, purchases treated as sales, use tax not accrued |
| Document date / tax date | Which rates and rules are effective | Wrong rate around a rate change or a tax holiday |
| Currency | Amount interpretation and rounding | Thresholds and per-unit taxes misapplied |
| Customer or supplier ID | Exemptions, entity use, customer-specific rules | Exempt customer taxed, or taxable customer treated as exempt |
Line fields and what they drive
| Field | What it drives | If it is wrong |
|---|---|---|
| Product code | Taxability through product mapping | Default taxability, often fully taxable or not taxable |
| Amount and quantity | Taxable base; per-unit fees | Wrong base; tax-inclusive amounts taxed again |
| Ship-from | Origin jurisdiction; origin-based sourcing | Wrong state or local tax where origin rules apply |
| Ship-to | Destination jurisdiction; most US sales and VAT place of supply | Wrong jurisdiction or a fallback to a less precise one |
| Line-level exemption or use | Exemption for this line only | Whole document treated the same way |
- Company (Header): Jurisdiction Setup; Taxability Setup; Rate Setup; Exemption Setup; Taxable base Setup
- Document type (Header): Jurisdiction Not a driver; Taxability Not a driver; Rate Not a driver; Exemption Not a driver; Taxable base Sign
- Tax date (Header): Jurisdiction Not a driver; Taxability Not a driver; Rate Main driver; Exemption Not a driver; Taxable base Not a driver
- Currency (Header): Jurisdiction Not a driver; Taxability Not a driver; Rate Not a driver; Exemption Not a driver; Taxable base Minor
- Customer ID (Header): Jurisdiction Not a driver; Taxability Not a driver; Rate Not a driver; Exemption Main driver; Taxable base Not a driver
- Product code (Line): Jurisdiction Not a driver; Taxability Main driver; Rate Not a driver; Exemption Not a driver; Taxable base Not a driver
- Amount, quantity (Line): Jurisdiction Not a driver; Taxability Not a driver; Rate Not a driver; Exemption Not a driver; Taxable base Main driver
- Ship-from (Line): Jurisdiction In some cases; Taxability Not a driver; Rate Not a driver; Exemption Not a driver; Taxable base Not a driver
- Ship-to (Line): Jurisdiction Main driver; Taxability Not a driver; Rate Not a driver; Exemption Not a driver; Taxable base Not a driver
Reading the response
{
"documentNumber": "90012345",
"totalTax": 99.33,
"lines": [
{
"lineNumber": 10,
"taxableAmount": 1200.00,
"totalTax": 92.76,
"jurisdictions": [
{ "level": "State", "name": "Destination state", "rate": 0.029, "tax": 34.80 },
{ "level": "City", "name": "Destination city", "rate": 0.04, "tax": 48.00 },
{ "level": "District", "name": "Special district", "rate": 0.0083, "tax": 9.96 }
],
"reasons": ["Product taxable", "Destination sourcing"]
},
{
"lineNumber": 20,
"taxableAmount": 85.00,
"totalTax": 6.57,
"reasons": ["Freight taxable when part of a taxable sale (example rule)"]
}
]
}A useful response tells you, per line, the taxable base, the jurisdictions that applied with their rates, and reasons or rule identifiers that explain the decision. When you troubleshoot, read the reasons before the amounts: they tell you which rule fired, and whether a custom rule or an exemption was involved.
- Request, line 10: taxDate: 2026-10-15 customer: C-1001 exemptionCertificate: null productCode: MAT-55021 quantity: 4 amount: 1200.00 shipFrom: US, TX, Houston, 77041 shipTo: US, CO, Denver, 80202
- Response, line 10: reasons: Product taxable Destination sourcing taxableAmount: 1200.00 jurisdictions: State 0.029 34.80 City 0.04 48.00 District 0.0083 9.96 totalTax: 92.76
- (1) The product code is mapped, and the mapping makes the line taxable.
- (2) The amount becomes the taxable base.
- (3) The ship-to address selects the state, city and district, because the sale is sourced to the destination.
Try it: what changes if…
- With postal code 80202: taxableAmount: 1200.00 jurisdictions: State 0.029 34.80 City 0.04 48.00 District 0.0083 9.96 totalTax: 92.76
- Postal code missing: taxableAmount: 1200.00 jurisdictions: State 0.029 34.80 totalTax: 34.80
- (1) Only the state was found. The city and district lines are gone.
- (2) The call still succeeds, so the invoice posts with too little tax.
- …the ship-to postal code is missing? The engine may fall back to city or state-level jurisdiction, and local or district tax may be wrong or missing.
- …
productCodeon line 10 is not mapped? The default taxability applies, and the line may become non-taxable or taxed at the wrong treatment. - …the customer has a valid resale certificate for Colorado but it is not linked to C-1001? Tax is charged, and the customer will dispute the invoice.
- …
documentTypeis a credit memo dated today, not the original invoice date? The credit may use a different rate than the original sale.
Each of these is on the list of usual suspects in Diagnosing an unexpected tax result. When a result looks wrong, read the request first.