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

A request is one header and one or more lines The shape of the request below. Header fields apply to the whole document, and each line carries its own product, amount and addresses.
  • 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" }
    }
  ]
}
FieldWhat it drivesIf it is wrong
Company / legal entityWhich configuration applies: registrations, rules, defaultsTax calculated as if a different entity sold it, or not at all where the entity is not set up
Document typeDirection (sale or purchase) and sign (invoice or credit)Credits taxed as sales, purchases treated as sales, use tax not accrued
Document date / tax dateWhich rates and rules are effectiveWrong rate around a rate change or a tax holiday
CurrencyAmount interpretation and roundingThresholds and per-unit taxes misapplied
Customer or supplier IDExemptions, entity use, customer-specific rulesExempt customer taxed, or taxable customer treated as exempt

Line fields and what they drive

FieldWhat it drivesIf it is wrong
Product codeTaxability through product mappingDefault taxability, often fully taxable or not taxable
Amount and quantityTaxable base; per-unit feesWrong base; tax-inclusive amounts taxed again
Ship-fromOrigin jurisdiction; origin-based sourcingWrong state or local tax where origin rules apply
Ship-toDestination jurisdiction; most US sales and VAT place of supplyWrong jurisdiction or a fallback to a less precise one
Line-level exemption or useExemption for this line onlyWhole document treated the same way
Each part of the result traces back to a few request fields The two tables above, turned around. Pick the part of the result that looks wrong and read down its column. Company selects the setup behind every column, document type sets the sign, and ship-from matters where origin rules apply.
  • 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.

Every part of the answer can be traced to a field in the request Line 10 of the request beside line 10 of the response (illustrative rates). Each numbered pair shows a request field and the part of the answer it produced.
  • 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…

Without a postal code the engine can fall back to the state alone The first exercise, worked (illustrative rates). Nothing in the response says it is wrong. The local tax is simply absent.
  • 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.
  1. …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.
  2. …productCode on line 10 is not mapped? The default taxability applies, and the line may become non-taxable or taxed at the wrong treatment.
  3. …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.
  4. …documentType is 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.