Introduction
API Endpoint
https://api.taxrates.io
Terms of Service: https://taxrates.io/terms-of-service
Version: 3.0.3
Taxrates.io is a global tax rate service that automates the management of monitoring tax rates changes in 181 countries. We monitor over 14,000 US sales tax, VAT, GST rates for you and make updates via our API so you always have the most update tax rates.
You can use Taxrates.io as a virtual sandbox where we provide you with 30 days free trial.
Countries
We currently support the following countries around the world. If you would like to request the addition of a new country, please email us at support@taxrates.io
Please note that for countries outside of the United States the standard VAT/GST rate is applied except for ebooks where the reduced VAT/GST rate is supported.
Afghanistan | Gambia | Niger |
Albania | Georgia | Nigeria |
Andorra | Germany | North Korea |
Angola | Ghana | Norway |
Antigua and Barbuda | Greece | Pakistan |
Argentina | Grenada | Palestine |
Armenia | Guam | Panama |
Aruba | Guatemala | Papua New Guinea |
Australia | Guinea | Paraguay |
Austria | Guyana | Peru |
Azerbaijan | Haiti | Philippines |
Bahamas | Honduras | Poland |
Bahrain | Hungary | Portugal |
Bangladesh | Iceland | Puerto Rico |
Barbados | India | Republic of the Congo |
Belarus | Indonesia | Romania |
Belgium | Iran | Russian Federation |
Belize | Ireland | Rwanda |
Benin | Isle of Man | Samoa |
Bhutan | Israel | Senegal |
Bolivia | Italy | Serbia |
Bonaire | Japan | Seychelles |
Bosnia and Herzegovina | Jersey | Sierra Leone |
Botswana | Jordan | Singapore |
Brazil | Jordan | Slovakia |
Bulgaria | Kazakhstan | Slovenia |
Burkina Faso | Kenya | Solomon Islands |
Burundi | Kiribati | Somalia |
Cambodia | Kosovo | South Africa |
Cameroon | Kyrgyzstan | South Korea |
Cape Verde | Laos | South Sudan |
Central African Republic | Latvia | Spain |
Chad | Lebanon | Sri Lanka |
Chile | Lesotho | St Lucia |
China | Liberia | Sudan |
Columbia | Liechtenstein | Suriname |
Comoros | Lithuania | Swaziland |
Cook Islands | Luxembourg | Sweden |
Costa Rica | Macedonia | Switzerland |
Cote d'Ivoire | Madagascar | Tahiti |
Croatia | Malawi | Taiwan |
Cuba | Malaysia | Tajikistan |
Curacao | Maldives | Tanzania |
Cyprus | Mali | Thailand |
Czech Republic | Malta | Togo |
Democratic Republic of the Congo | Mauritania | Tonga |
Denmark | Mauritius | Trinidad and Tobago |
Djbouti | Mexico | Tunisia |
Dominica | Micronesia | Turkmenistan |
Dominican Republic | Moldova | Tuvalu |
Ecuador | Monaco | Uganda |
Egypt | Mongolia | Ukraine |
El Salvador | Montenegro | United Arab Emirates |
Equatorial Guinea | Morocco | United Kingdom |
Eritrea | Mozambique | United States |
Estonia | Myanmar | Uruguay |
Ethiopia | Namibia | Vanuatu |
Fiji | Nepal | Venezuela |
Finland | Netherlands | Vietnam |
France | New Zealand | Yemen |
Gabon | Nicaragua |
Products codes
The Taxrates.io API’s provides product-level tax rates for a subset of product codes. These codes are to be used for products that are either exempt from tax in some jurisdictions or are taxed at reduced rates.
We will be expanding support for additional, less common categories over time. If you would like to request the addition of a new product category, please email us at support@taxrates.io
Please select a product code/s when making a request to the Taxrates.io API
Product code | Product Description |
---|---|
C010 | General Services/Products which are not subject to a service/product-specific tax |
C012 | eBooks - Downloaded |
C011 | Music - Downloaded |
C011 | Movies/Digital Video - Downloaded |
C011 | Streaming Music/Audio Services new |
C011 | Streaming Video Services new |
C018 | Software as a Services, Generally (Remote Access to Hosted Software) |
C021 | Remote Access to Hosted Business Custom Applications |
C021 | Business Data Warehouses |
C022 | Infrastructure as Service, Generally |
C022 | Ecommerce Site/Webserver Hosting |
C022 | Information services |
C022 | Data processing services |
C030 | General Clothing (under $110) |
C031 | Clothing Protective |
C032 | Footwear |
C033 | Clothing Night Wear / Formal Wear / Swim Wear ) |
C034 | Shoes (Men / Women / Children / Infant) |
C035 | Vitamins (Nutritional Supplements /Nutritional Mineral Supplements) |
C036 | Personal Care -( Products / Bath & Body / Hair Care Supplies / Skin Care Products / Foot Care) |
C037 | Personal Care (Eye Care) |
C038 | General Foods |
C039 | Foods (Health or Breakfast Bars) |
C040 | Medication (non-prescription) OTC |
C041 | Medication (prescription) OTC |
C088 | Shipping with Handling |
C089 | Shipping |
Filtering
When calling the API endpoints you can use 'filter' parameters to get tax rate for the selected type. You can get the following tax types (Each tax rate will always have one of following types)
US Sales tax Rates
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SPDRate
- MTARate
We recommend using Postman when discovering our API. Happy using!
Rate Limiting
We limit API requests.
If you’re exceeding this rate and encountering 429 errors, review the following:
- Only make requests in states / regions where you have enabled.
- Cache responses if the order details haven’t changed since the last calculation at checkout.
Errors
The Taxrates.io API uses the following error codes:
Code | Error Message |
---|---|
400 | Bad Request – Your request format is bad. |
401 | Unauthorized – Your API key is wrong. |
404 | Not Found – The specified resource could not be found. |
405 | Method Not Allowed – You tried to access a resource with an invalid method. |
429 | Too Many Requests – You’re requesting too many resources! Slow down! |
500 | Internal Server Error – We had a problem with our server. Try again later. |
503 | Service Unavailable – We’re temporarily offline for maintenance. Try again later. |
Verify your API token is correct and make sure you’re correctly setting the Authorization header.
If you’re still not sure what’s wrong, contact us and we’ll investigate.
Changelog
Stay on top of new developer-facing features, accuracy improvements, and bug fixes for our API. Have a request? Encounter an issue? We’d love to hear your feedback.
Authentication
ApiKey
Taxrates uses API keys to allow access to the API. If you’re new to Taxrates.io, you’ll need to sign up for an account to get your API key. Otherwise, log in and go to API Access tab to generate a new API token.
Taxrates.io expects the API key to be included in all API requests to the server using a header like the following:
- type
- apiKey
- name
- Authorization
- in
- header
Testing via Postman
Authorization of the API
The following outlines to test each of the endpoints via Postman, if you have any questions please don’t hesitate to contact us support@taxrates.io
Steps
- Tab - "Authorization".
- Type - "API Key".
- Key - "Authorization".
- Value - "Apikey your_key".
- Add to - "Header".
See screenshot below:
Tax rates by IP address
Steps to test on Postman
- Make sure you are on Params tab
-
Input an IP address you can use the following:
US (New York) 72.229.28.185 Ireland 54.72.254.118 -
For US sales tax you can add a filter for one of the following tax rates:
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SpecialRate
- Input a product code, see the list “Product codes”
- Click “Send”
See the below screenshots:
Tax rates by Country Code
- Make sure you are on Params tab
-
Input a Country 2 digit ISO code
-
Samples below - see the following link here for a full list
- IE = Ireland
- IN = India
- GB = United Kindgom
-
Samples below - see the following link here for a full list
-
For US sales tax you can filter for any of the following sales tax rates
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SPDRate
- MTARate
- To get a tax rate for US sales tax you Need a zipcode, for testing use 10001 (New York) Make sure you have New York enabled on your dashboard
- Input a product code, see the list “Product codes”
- Click “Send”
See the below screenshot:
Get All tax rates
Steps to Test on Postman
- Select a product code in your Taxrates.io dashboard
-
Select the countries/ states that you want the Tax rates for in your Taxrates dashboard
- Note: for US sales tax the reponse will return all the Zipcode’s along the sales tax rates for each State. If all US states are selected than you are dealing with a lot of data (around 39,185 rows).
- Make sure you are on Params in Postman
-
You can filter the type of tax for any of the following types of sales tax rates, note: they are case sensitive
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SPDRate
- MTARate
-
Taxrates.io will only return 500 rates at a time,(It's a large amount of data so we will send more with one response) to leave the cursor empty for the first page and use value form “X-Cursor-Next” header for the next one. See below to get all the tax rates in the responses:
- Send the first request
- Check the tab with response headers
- If there is a X-Next-Cursor - use it for the "cursor" parameter to get the next page
- If there is no header/ X-Next-Cursor - this is the last page
Endpoints
All tax rates
curl "https://api.taxrates.io/api/v3/tax/rates?filter=CityRate&cursor=103862" \
-H "Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R"
$ch = curl_init('https://api.taxrates.io/api/v3/tax/rates?filter=CityRate&cursor=103862');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R',
]);
$result = curl_exec($ch);
import requests
response = requests.get(
'https://api.taxrates.io/api/v3/tax/rates',
params={'filter': 'CityRate', 'cursor': 103862},
headers={'Authorization': 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R'}
)
require 'faraday'
Faraday.new('https://api.taxrates.io/api/v3/tax/rates?filter=CityRate&cursor=103862', headers: { 'Authorization' => 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R' }).get
URL url = new URL("https://api.taxrates.io/api/v3/tax/rates?filter=CityRate&cursor=103862");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R");
InputStream responseStream = connection.getInputStream();
fetch(url + 'https://api.taxrates.io/api/v3/tax/rates?filter=CityRate&cursor=103862', {
method: 'GET',
headers: {
'Authorization': 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R'
}
}).then(res => res.json());
const axios = require("axios");
const baseUrl = "https://api.taxrates.io/api/v3/tax/rates";
axios.get(baseUrl, {
params: {
filter: 'CityRate',
cursor: 103862
},
headers: {
Authorization: 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R',
}
}).then(res => console.log(res.data));
import "net/http"
req, err := http.NewRequest("GET", "https://api.taxrates.io/api/v3/tax/rates?filter=CityRate&cursor=103862", nil)
req.Header.Add("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R")
client := &http.Client{}
resp, err := client.Do(req)
using System.Net.Http;
using System.Net.Http.Headers;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R");
HttpResponseMessage response = await client.GetAsync("https://api.taxrates.io/api/v3/tax/rates?filter=CityRate&cursor=103862");
US Sales tax sample response:
[
{
"id": "34314",
"name": "United States",
"code": "US",
"state": "Texas",
"zip": "75070",
"metadata": {
"city": "MCKINNEY",
"city_number": "2043045",
"county": "COLLIN",
"county_number": "n\/a",
"spd": "n\/a",
"spd_number": "n\/a",
"mta": "n\/a",
"mta_number": ""
},
"rates": [
{
"type": "CombinedRate",
"data_name": "Rate",
"data_value": "8.250",
"product_code": "C010",
"product_code_description": "General Services"
},
{
"type": "StateRate",
"data_name": "Rate",
"data_value": "6.250",
"product_code": "C010",
"product_code_description": "General Services"
},
{
"type": "CountyRate",
"data_name": "Rate",
"data_value": "0.000",
"product_code": "C010",
"product_code_description": "General Services"
},
{
"type": "CityRate",
"data_name": "Rate",
"data_value": "2.000",
"product_code": "C010",
"product_code_description": "General Services"
},
{
"type": "SPDRate",
"data_name": "Rate",
"data_value": "0.000",
"product_code": "C010",
"product_code_description": "General Services"
},
{
"type": "MTARate",
"data_name": "Rate",
"data_value": "0.000",
"product_code": "C010",
"product_code_description": "General Services"
}
]
}
]
For countries outside of the US:
[
{
"id": "144",
"name": "United Kingdom",
"code": "GB",
"state": null,
"zip": null,
"metadata": [],
"rates": [
{
"type": "standard",
"data_name": "Rate",
"data_value": "20.000",
"product_code": "C010",
"product_code_description": "General Services"
}
]
}
]
Get request. This method returns all tax rates configured on your account. Based on your country selection the endpoint will return all taxes for all countries. You can use the 'filter' parameter to narrow results to selected type of tax. Use 'zip' parameter when you have selected the United States.
We have development an easy to use scheduler so you can call the API to get the rates every hour or day. Please click on the following link to see the code on Github.
Please note in cases when a US state doesn't have sales tax and when a product is tax exempt for a zip code or for a state the API response will be "null"
To get a response you need to have selected a product code in your Taxrates.io dashboard, please see the Introduction section above for description of the different types of product codes.
For US sales tax you can filter the tax rate you want for each state or zip code with one of the following: (they are case sensitive)
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SPDRate
- MTARate
HTTP Request
GET /v3/tax/rates
Request Parameters
filter: string in query |
You can filter your taxes by one of following types: 'standard', 'CombinedRate', 'CountyRate', 'CityRate', 'SPDRate' and 'MTARate'. |
cursor: string in query |
Cursor shows from which record you want to get information. Default value is 0, next value can be retrieved from X-Cursor-Next header. |
Responses
200 OK |
An array of locations with tax rates |
404 Not Found |
No configured tax rates found. Have you added any country to your account? |
500 Internal Server Error |
Unexpected error |
Tax rates by IP address
curl "https://api.taxrates.io/api/v1/tax/ip?ip=208.80.152.201&product_codes[]=C010&filter=CountyRate&date=2020-10-01" \
-H "Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R"
$ch = curl_init('https://api.taxrates.io/api/v1/tax/ip?ip=208.80.152.201&product_codes[]=C010&filter=CountyRate&date=2020-10-01');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R',
]);
$result = curl_exec($ch);
import requests
response = requests.get(
'https://api.taxrates.io/api/v1/tax/ip',
params={'ip': '208.80.152.201', 'product_codes[]': ['C010'], 'filter': 'CountyRate', 'date': '2020-10-01'},
headers={'Authorization': 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R'}
)
require 'faraday'
Faraday.new('https://api.taxrates.io/api/v1/tax/ip?ip=208.80.152.201&product_codes[]=C010&filter=CountyRate&date=2020-10-01', headers: { 'Authorization' => 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R' }).get
URL url = new URL("https://api.taxrates.io/api/v1/tax/ip?ip=208.80.152.201&product_codes[]=C010&filter=CountyRate&date=2020-10-01");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R");
InputStream responseStream = connection.getInputStream();
fetch('https://api.taxrates.io/api/v1/tax/ip?ip=208.80.152.201&product_codes[]=C010&filter=CountyRate&date=2020-10-01', {
method: 'GET',
headers: {
'Authorization': 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R'
}
}).then(res => res.json());
const axios = require("axios");
const baseUrl = "https://api.taxrates.io/api/v1/tax/ip";
axios.get(baseUrl, {
params: {
ip: '208.80.152.201',
product_codes: ['C010'],
filter: 'CountyRate',
date: '2020-10-01'
},
headers: {
Authorization: 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R',
}
}).then(res => console.log(res.data));
import "net/http"
req, err := http.NewRequest("GET", "https://api.taxrates.io/api/v1/tax/ip?ip=208.80.152.201&product_codes[]=C010&filter=CountyRate&date=2020-10-01", nil)
req.Header.Add("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R")
client := &http.Client{}
resp, err := client.Do(req)
using System.Net.Http;
using System.Net.Http.Headers;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R");
HttpResponseMessage response = await client.GetAsync("https://api.taxrates.io/api/v1/tax/ip?ip=208.80.152.201&product_codes[]=C010&filter=CountyRate&date=2020-10-01");
US Sales Tax sample response:
[
{
"country_name": "United States",
"country_code": "US",
"taxes": [
{
"Country": "United States",
"CountryCode": "US",
"Type": "CityRate",
"ProductCode": "C010",
"ProductCodeDescription": "General Services",
"data_name": "Rate",
"data_value": "4.500",
"metadata": {
"City": "MANHATTAN",
"CityNumber": "8081"
},
"State": "New York"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "CombinedRate",
"ProductCode": "C010",
"ProductCodeDescription": "General Services",
"data_name": "Rate",
"data_value": "8.875",
"metadata": {
"Zip": "10004"
},
"State": "New York"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "CountyRate",
"ProductCode": "C010",
"ProductCodeDescription": "General Services",
"data_name": "Rate",
"data_value": "0.000",
"metadata": {
"County": "NEW YORK",
"CountyNumber": "8051"
},
"State": "New York"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "MTARate",
"ProductCode": "C010",
"ProductCodeDescription": "General Services",
"data_name": "Rate",
"data_value": "0.375",
"metadata": {
"MTA": "n\/a",
"MTANumber": ""
},
"State": "New York"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "SPDRate",
"ProductCode": "C010",
"ProductCodeDescription": "General Services",
"data_name": "Rate",
"data_value": "0.000",
"metadata": {
"SPD": "n\/a",
"SPDNumber": "n\/a"
},
"State": "New York"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "StateRate",
"ProductCode": "C010",
"ProductCodeDescription": "General Services",
"data_name": "Rate",
"data_value": "4.000",
"metadata": [],
"State": "New York"
}
]
}
]
For countries outside of the US:
[
{
"country_name": "Ireland",
"country_code": "IE",
"taxes": [
{
"Country": "Ireland",
"CountryCode": "IE",
"Type": "standard",
"ProductCode": "C010",
"ProductCodeDescription": "General Services",
"data_name": "Rate",
"data_value": "21.000",
"metadata": []
}
]
}
]
Get request. This method returns all tax rates for country discovered on either your IP address or IP address param. The IP param is not required. When empty, the taxrates.io will try to discover your IP address and based on this will retrieve the tax rates. You can use 'filter' parameter to narrow results to selected type of tax
For US sales tax you can filter the tax rate you want for each state or zip code with one of the following: (they are case sensitive)
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SPDRate
- MTARate
HTTP Request
GET /v1/tax/ip
Request Parameters
ip: string required in query |
Customer's IP address |
filter: string in query |
You can filter your taxes by one of following types: 'standard', 'CombinedRate', 'CountyRate', 'CityRate', 'SPDRate' and 'MTARate'. |
product_codes: string[] required in query |
You can filter your taxes by product codes. |
date: string (yyyy-mm-dd) in query |
You can filter your taxes by date in the past. |
Responses
200 OK |
An array of tax rates for VAT, GST & TAX |
404 Not Found |
Geolocation can not be processed/No matching country found |
500 Internal Server Error |
Unexpected error |
Tax rates by Country Code
// United States
curl "https://api.taxrates.io/api/v1/tax/countrycode?country_code=US&product_codes[]=C010&filter=StateRate&zip=10001" \
-H "Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R"
// Canada
curl "https://api.taxrates.io/api/v1/tax/countrycode?country_code=CA&product_codes[]=C010&filter=GST&province=Quebec" \
-H "Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R"
// Others
curl "https://api.taxrates.io/api/v1/tax/countrycode?country_code=IE&product_codes[]=C010&date=2020-10-01" \
-H "Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R"
$url = 'https://api.taxrates.io/api/v1/tax/countrycode?product_codes[]=C010'; if ($country === 'United States') {
$url .= '&country_code=US&filter=StateRate&zip=10001';
} elseif ($country === 'Canada') {
$url .= '&country_code=CA&filter=GST&province=Quebec';
} else {
$url .= '&country_code=IE&date=2020-10-01';
} $ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R',
]);
$result = curl_exec($ch);
import requests
payload = {'product_codes[]': ['C010']}
if country == 'United States':
payload.update({'country_code': 'US', 'filter': 'StateRate', 'zip': 10001})
elif country === 'Canada':
payload.update({'country_code': 'CA', 'filter': 'GST', 'province': 'Quebec'})
else:
payload.update({'country_code': 'IE', 'date': '2020-10-01'})
response = requests.get(
'https://api.taxrates.io/api/v1/tax/countrycode',
params=payload,
headers={'Authorization': 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R'}
)
require 'faraday'
url = "https://api.taxrates.io/api/v1/tax/countrycode?product_codes[]=C010"
if country == 'United States':
url += "country_code=US&filter=StateRate&zip=10001"
elsif country == 'Canada':
url += "country_code=CA&filter=GST&province=Quebec"
else:
url += "country_code=IE&date=2020-10-01"
Faraday.new(url, headers: { 'Authorization' => 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R' }).get
String spec = "https://api.taxrates.io/api/v1/tax/countrycode?product_codes[]=C010";
if (country == "United States") {
spec += "&country_code=US&filter=StateRate&zip=10001";
} else if (country == "Canada") {
spec += "&country_code=CA&filter=GST&province=Quebec";
} else {
spec += "&country_code=IE&date=2020-10-01";
}
URL url = new URL(spec);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R");
InputStream responseStream = connection.getInputStream();
let url = 'https://api.taxrates.io/api/v1/tax/countrycode?product_codes[]=C010';
if (country === 'United States') {
url += '&country_code=US&filter=StateRate&zip=10001'
} else if (country === 'Canada') {
url += '&country_code=CA&filter=GST&province=Quebec';
} else {
url += '&country_code=IE&date=2020-10-01';
}
fetch(url, {
method: 'GET',
headers: {
'Authorization': 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R'
}
}).then(res => res.json());
const axios = require("axios");
const baseUrl = "https://api.taxrates.io/api/v1/tax/countrycode";
let params = {
product_codes: ['C010']
}
if (country === 'United States') {
params = Object.assign(params, {
country_code: 'US',
filter: 'StateRate',
zip: 10001
})
} else if (country === 'Canada') {
params = Object.assign(params, {
country_code: 'CA',
filter: 'GST',
province: 'Quebec'
})
} else {
params = Object.assign(params, {
country_code: 'IE',
date: '2020-10-01'
})
}
axios.get(baseUrl, {
params,
headers: {
Authorization: 'Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R',
}
}).then(res => console.log(res.data));
import {
"net/http"
"bytes"
}
var url bytes.Buffer
if country == 'United States' {
url.WriteString("&country_code=US&filter=StateRate&zip=10001")
} else if country == 'Canada' {
url.WriteString("&country_code=CA&filter=GST&province=Quebec")
} else {
url.WriteString("&country_code=IE&date=2020-10-01")
}
req, err := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R")
client := &http.Client{}
resp, err := client.Do(req)
using System.Net.Http;
using System.Net.Http.Headers;
string url = "https://api.taxrates.io/api/v1/tax/countrycode?product_codes[]=C010";
if (country == "United States") {
url += "&country_code=US&filter=StateRate&zip=10001";
} else if (country == "Canada") {
url += "&country_code=CA&filter=GST&province=Quebec";
} else {
url += "&country_code=IE&date=2020-10-01";
}
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Apikey PylBOdnULv0EGLCSm1FHhGrpiYh3o9cBdb4R");
HttpResponseMessage response = await client.GetAsync(url);
US Sales tax sample response:
[
{
"country_name": "United States",
"country_code": "US",
"taxes": [
{
"Country": "United States",
"CountryCode": "US",
"Type": "CityRate",
"ProductCode": "C010",
"ProductCodeDescription": "C010",
"data_name": "Rate",
"data_value": "1.250",
"metadata": {
"City": "CROSSEST",
"CityNumber": "43863"
},
"State": "Arkansas"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "CombinedRate",
"ProductCode": "C010",
"ProductCodeDescription": "C010",
"data_name": "Rate",
"data_value": "9.250",
"metadata": {
"Zip": "71642"
},
"State": "Arkansas"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "CountyRate",
"ProductCode": "C010",
"ProductCodeDescription": "C010",
"data_name": "Rate",
"data_value": "1.500",
"metadata": {
"County": "ASHLEY",
"CountyNumber": "02-00"
},
"State": "Arkansas"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "MTARate",
"ProductCode": "C010",
"ProductCodeDescription": "C010",
"data_name": "Rate",
"data_value": "0.000",
"metadata": {
"MTA": "n\/a",
"MTANumber": ""
},
"State": "Arkansas"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "SPDRate",
"ProductCode": "C010",
"ProductCodeDescription": "C010",
"data_name": "Rate",
"data_value": "0.000",
"metadata": {
"SPD": "n\/a",
"SPDNumber": "n\/a"
},
"State": "Arkansas"
},
{
"Country": "United States",
"CountryCode": "US",
"Type": "StateRate",
"ProductCode": "C010",
"ProductCodeDescription": "C010",
"data_name": "Rate",
"data_value": "6.500",
"metadata": [],
"State": "Arkansas"
}
]
}
]
For countries outside of the US:
[
{
"country_name": "United Kingdom",
"country_code": "GB",
"taxes": [
{
"Country": "United Kingdom",
"CountryCode": "GB",
"Type": "standard",
"ProductCode": "C010",
"ProductCodeDescription": "C010",
"data_name": "Rate",
"data_value": "20.000",
"metadata": []
}
]
}
]
Get request. This method returns all tax rates for country discovered based on country code. The country code must be 2 letters ISO 3166-1 alfa-2 country code (see here for more information). You can use 'filter' parameter to narrow results to selected type of tax
For US sales tax you can filter the tax rate you want for each state or zip code with one of the following: (they are case sensitive)
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SPDRate
- MTARate
HTTP Request
GET /v1/tax/countrycode
Request Parameters
country_code: string required in query |
Country code alpha 2 |
filter: string in query |
You can filter your taxes by one of following types: 'standard', 'CombinedRate', 'CountyRate', 'CityRate', 'SPDRate' and 'MTARate'. |
zip: string in query |
You must provide a zip code if one of your selected countries is United States and you've had selected a state on your Taxrates.io member's dashboard. |
province: string in query |
Must be used if country is Canada; it can be a 2 digit or the full name of the province, see link for provinces https://www.ncbi.nlm.nih.gov/books/NBK7254/ |
product_codes: string[] required in query |
You can filter your taxes by product codes. |
date: string (yyyy-mm-dd) in query |
You can filter your taxes by date in the past. |
Responses
200 OK |
Success |
404 Not Found |
Country not found. Have you provided correct alpha-2 country code? |
500 Internal Server Error |
Unexpected error |
Schema Definitions
Rates: object
{
"country_name": "string",
"country_code": "string",
"taxes": [
{
"Country": "string",
"CountryCode": "string",
"Type": "string",
"ProductCode": "string",
"ProductCodeDescription": "string",
"data_name": "string",
"data_value": "string",
"metadata": "object"
}
]
}
- country_name: string
- The country name
- country_code: string
- The country code
- taxes: array
- Tax
Tax: object
{
"Country": "string",
"CountryCode": "string",
"Type": "string",
"ProductCode": "string",
"ProductCodeDescription": "string",
"data_name": "string",
"data_value": "string",
"metadata": "object"
}
- Country: string
- The country name
- CountryCode: string
- The country code
- Type: string
- The tax type
- ProductCode: string
- The product code
- ProductCodeDescription: string
- The product code description
- data_name: string
- The tax name and description (VAT, GST, PIT, CIT etc)
- data_value: string
- The tax value in percents
- metadata: object
- Map, values are strings and possible keys are City, CityNumber, County, CountyNumber, SPD, SPDNumber, MTA, MTANumber, Zip
Error: object
{
"code": "integer (int32)",
"message": "string",
"fields": "string"
}
- code: integer (int32)
- message: string
- fields: string
TaxRate: object
{
"type": "string",
"data_name": "string",
"data_value": "string",
"product_code": "string",
"product_code_description": "string"
}
- type: string
- The tax type
- data_name: string
- The tax name and description (VAT, GST, PIT, CIT etc)
- data_value: string
- The tax value in percents
- product_code: string
- Product code
- product_code_description: string
- Product code description
Location: object
{
"id": "integer",
"name": "string",
"code": "string",
"state": "string",
"zip": "string",
"metadata": "object",
"rates": [
{
"type": "string",
"data_name": "string",
"data_value": "string",
"product_code": "string",
"product_code_description": "string"
}
]
}
- id: integer
- name: string
- Country name
- code: string
- Country code
- state: string
- State/province name if exists
- zip: string
- Zipcode
- metadata: object
- Map, values are strings and possible keys are city, city_number, county, county_number, spd, spd_number, mta, mta_number
- rates: array
- TaxRate