Sales Tax Calculator API

The Sales Tax Calculator API provides accurate and detailed sales tax calculations for any purchase amount in the United States, including tax breakdowns and total amounts.

To only get sales tax rate information, please use the Sales Tax API.

/v1/salestaxcalculator GET

https://api.api-ninjas.com/v1/salestaxcalculator

Calculates sales tax for a given amount and location. Returns a detailed breakdown including state, county, city, and special district taxes, along with the calculated tax amount and total amount after tax.


Parameters

amount is required, and exactly one of the following must be set: zip_code or (city + state)

  • amount  required

    Purchase amount to calculate tax on.

  • zip_code  optional

    Valid US ZIP code.

  • city  optional

    City name.

  • state  optional

    State name.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Returns

  • zip_code

    The ZIP code for which tax information is returned.

  • state_rate

    State sales tax rate as a decimal.

  • city_rate premium only

    City sales tax rate as a decimal.

  • county_rate premium only

    County sales tax rate as a decimal.

  • additional_rate premium only

    Additional special district sales tax rate as a decimal.

  • total_rate premium only

    Total combined sales tax rate of state, county, city, and additional rates as a decimal.

  • state_tax

    The calculated state sales tax amount.

  • city_tax premium only

    The calculated city sales tax amount.

  • county_tax premium only

    The calculated county sales tax amount.

  • additional_tax premium only

    The calculated additional special district sales tax amount.

  • total_tax premium only

    The total calculated sales tax amount.

  • total_price premium only

    The total amount including tax.

Sample Request Live Demo!

zip_code
amount
https://api.api-ninjas.com/v1/salestaxcalculator?zip_code=90210&amount=100

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [ { "zip_code": "90210", "state_rate": 0.06, "total_rate": 0.0975, "city_rate": 0.01, "county_rate": 0.0025, "additional_rate": 0.025, "state_tax": 6, "city_tax": 1, "county_tax": 0.25, "additional_tax": 2.5, "total_tax": 9.75, "total_price": 109.75 } ]

Code Examples

1 2 3 4 5 6 7 8 9 10 import requests zip_code = '90210' amount = '100' api_url = 'https://api.api-ninjas.com/v1/salestaxcalculator?zip_code={}&amount={}'.format(zip_code, amount) response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) if response.status_code == requests.codes.ok: print(response.text) else: print("Error:", response.status_code, response.text)

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.