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.
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.
amount
is required, and exactly one of the following must be set: zip_code
or (city
+ state
)
amount
requiredPurchase amount to calculate tax on.
zip_code
optionalValid US ZIP code.
city
optionalCity name.
state
optionalState name.
X-Api-Key
requiredAPI Key associated with your account.
zip_code
The ZIP code for which tax information is returned.
state_rate
State sales tax rate as a decimal.
city_rate
premium onlyCity sales tax rate as a decimal.
county_rate
premium onlyCounty sales tax rate as a decimal.
additional_rate
premium onlyAdditional special district sales tax rate as a decimal.
total_rate
premium onlyTotal 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 onlyThe calculated city sales tax amount.
county_tax
premium onlyThe calculated county sales tax amount.
additional_tax
premium onlyThe calculated additional special district sales tax amount.
total_tax
premium onlyThe total calculated sales tax amount.
total_price
premium onlyThe total amount including tax.
https://api.api-ninjas.com/v1/salestaxcalculator?zip_code=90210&amount=100
Headers
X-Api-Key
Log in or sign up to get your API Key
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
}
]
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.