Prompt
How do I get VAT rates by customer address in an API?
Latest observation
Nov 3, 2026
OpenAI APIWeb search: off
To get VAT rates by customer address via an API, you generally need to:
-
Collect the customer’s tax-relevant address
- Country is usually the minimum.
- For many jurisdictions, you may also need postal code, state/region, or city.
- For EU VAT, the country is often enough to determine the VAT treatment, but address and VAT ID can matter for validation and place-of-supply rules.
-
Call a tax/VAT lookup API
- Many tax services expose an endpoint where you send:
countrypostal_code(optional but often useful)region/state(optional)tax_exempt/vat_id/ customer type if relevant
- The API returns the applicable tax rate(s) and sometimes the jurisdiction breakdown.
- Many tax services expose an endpoint where you send:
-
Use the returned rate to calculate tax
- Multiply the taxable amount by the returned VAT rate.
- If the API returns multiple components, sum them as needed.
Example API pattern
A typical request might look like:
POST /tax/rates
Content-Type: application/json
{
"country": "DE",
"postal_code": "10115",
"state": "Berlin"
}
Example response:
{
"country": "DE",
"vat_rate": 0.19,
"currency": "EUR",
"jurisdiction": "DE"
}
Common options
If you’re building this yourself, you can also:
- Map VAT rates by country code in a database/config file
- Use a third-party tax engine (recommended for accuracy), such as:
- Avalara
- TaxJar
- Stripe Tax
- Quaderno
- Vertex
Important considerations
- VAT rules can depend on:
- customer B2C vs B2B
- whether the customer has a valid VAT ID
- digital goods vs physical goods
- shipping address vs billing address
- Keep the tax rate source updated regularly, since VAT rules change.
If you want, I can show you:
- a real API example for a specific provider, or
- how to implement this in Node.js / Python / PHP.