3-Step Quickstart Guide

Feel like jumping right into making API calls? Get a free Tax Data API account and simply use our 3-Step Quickstart Guide.

Code Examples

Our API supports all major programming languages. Click below to browse through examples in PHP, Python, Node, jQuery and Ruby.

Tax Data API Reference

This API is organized around REST. Our API has predictable resource-oriented URLs,accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Just Getting Started?

Check out our development quickstart guide.

Authentication

Tax Data API uses API keys to authenticate requests. You can view and manage your API keys in the Accounts page.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code,and so forth.

All requests made to the API must hold a custom HTTP header named “apikey”.Implementation differs with each programming language. Below are some samples.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail.API requests without authentication will also fail.

Endpoints

GET /canada_rate_list

Canada tax rates by state

Parameters
No parameters.
GET /canada_rate_list
Returns

Below is a sample response from the endpoint


        {
          "data": [{
              "combined_rate": 0.05,
              "country": "CA",
              "gst": 0.05,
              "hst": 0,
              "pst": 0,
              "start": "2008-01-01",
              "state": "AB",
              "type": "GST"
          }, {
              "combined_rate": 0.12,
              "country": "CA",
              "gst": 0.05,
              "hst": 0,
              "pst": 0.07,
              "start": "2012-04-01",
              "state": "BC",
              "type": "GST,PST"
          }, {
              "combined_rate": 0.12,
              "country": "CA",
              "gst": 0.05,
              "hst": 0,
              "pst": 0.07,
              "start": "2019-07-01",
              "state": "MB",
              "type": "GST,PST"
          }]
      }
      
Get /price

Calculate price according to tax rate

Parameters

amount
(required)

Amount that will be used for price calculation

Location: Query,Data Type: string

city
(optional)

City

Location: Query,Data Type: string

country
(optional)

ISO country code (Required if ip_address and use_client_ip are not present)

Location: Query,Data Type: string

incl
(optional)

Set to 1 or true to preform reverse calculation if amount already includes tax

Location: Query,Data Type: boolean

ip_address
(optional)

Get tax rates according to IP address location

Location: Query,Data Type: string

state
(optional)

Two letter state ISO code (Required if country is CA)

Location: Query,Data Type: string

street
(optional)

Street

Location: Query, Data Type: string

type
(optional)

Goods type on which price is calculated (one from the /types endpoint)

Location: Query, Data Type: string

use_client_ip
(optional)

Set to 1 or true to get tax rates according to your IP address location

Location: Query, Data Type: boolean

zip
(optional)

Zip Code (Required if country is US)

Location: Query, Data Type: string

GET /price
** A word enclosed with curly brackets “{ }” in the code means that it is a parameter and it should be replaced with your own values when
executing. (also overwriting the curly brackets).
Returns

Below is a sample response from the endpoint


      {
        "country_code": "US",
        "country_name": "United States",
        "price_excl_vat": 100000,
        "price_incl_vat": 108000,
        "state": "GA",
        "success": true,
        "vat_rate": 0.08,
        "zip": "30228"
      }
    
Get /rate_list

Tax rates list by country

Parameters

per_page (optional)

Items per page (If present, items will be paginated by this number)

Location: Query,Data Type: string

GET /price

** A word enclosed with curly brackets “{ }” in the code means that it is a parameter and it should be replaced with your own values when
executing. (also overwriting the curly brackets).
Returns

Below is a sample response from the endpoint

    
    {
      "data": [
    {
      "country_code": "AU",
      "country_name": "Australia",
      "eu": false,
      "other_rates": [],
      "standard_rate": {
        "class": "standard",
        "description": "",
        "rate": 0.1,
        "types": null
      },
      "success": true
    },
    {
      "country_code": "AT",
      "country_name": "Austria",
      "eu": true,
      "other_rates": [
        {
          "class": "reduced",
          "description": "Admissions to cultural events and amusement parks; certain agricultural supplies; cut flowers and plants for decorative use; entrance to sporting events; firewood; wine production (from farm); domestic flights",
          "rate": 0.13,
          "types": null,
          "types_array": []
        },
        {
          "class": "reduced",
          "description": "TV licence; certain agricultural supplies; cut flowers and plants for food production; domestic refuse collection; domestic transport (excluding flights); ebooks; international and intra-community road and rail transport; newspapers and periodicals; pay and cable TV; pharmaceutical products; printed books; restaurants (ex all beverages); social services; take-away food; treatment of waste and waste water; water supplies; writers and composers; foodstuffs;",
          "rate": 0.1,
          "types": "foodstuffs, books, ebooks, pharmaceuticals, passenger transport, newspapers, admission to cultural events, hotels, admission to entertainment events",
          "types_array": [
            "foodstuffs",
            "books",
            "ebooks",
            "pharmaceuticals",
            "passenger transport",
            "newspapers",
            "admission to cultural events",
            "hotels",
            "admission to entertainment events"
          ]
        },
        {
          "class": "zero",
          "description": "Hotel accommodation; intra-community and international transport (excluding road and rail)",
          "rate": 0,
          "types": null,
          "types_array": []
        }
      ],
      "standard_rate": {
        "class": "standard",
        "description": "",
        "rate": 0.2,
        "types": null
      },
      "success": true
    },
    {
      "country_code": "AZ",
      "country_name": "Azerbaijan",
      "eu": false,
      "other_rates": [
        {
          "class": "zero",
          "description": "Exports and international transportation",
          "rate": 0,
          "types": null,
          "types_array": []
        }
      ],
      "standard_rate": {
        "class": "standard",
        "description": "",
        "rate": 0.18,
        "types": null
      },
      "success": true
    }
  ]
}
    
  

Get /tax_rates

Retrieve tax rates

Parameters

city
(optional)

City

Location: Query,Data Type: string

country
(optional)

ISO country code (Required if ip_address and use_client_ip are not present)

Location: Query,Data Type: string

ip_address
(optional)

Get tax rates according to IP address location

Location: Query,Data Type: string

state (optional)

Two letter state ISO code (Required if country is CA)

Location: Query,Data Type: string

street
(optional)

Street

Location: Query,Data Type: string

use_client_ip
(optional)

Set to 1 or true to get tax rates according to your IP address location

Location: Query,Data Type: string

zip
(optional)

Zip Code (Required if country is US)

Location: Query,Data Type: string

GET /tax_rates

** A word enclosed with curly brackets “{ }” in the code means that it is a parameter and it should be replaced with your own values when
executing. (also overwriting the curly brackets).
Returns

Below is a sample response from the endpoint

    
{
  "Canada Tax Rates Example Response": {
    "city": null,
    "combined_rate": 0.05,
    "country": "CA",
    "gst": 0.05,
    "hst": 0,
    "pst": 0,
    "start": "2008-01-01",
    "state": "AB",
    "type": "GST",
    "zip": null
  },
  "International Tax Rates Example Response": {
    "country_code": "DE",
    "country_name": "Germany",
    "eu": true,
    "other_rates": [
      {
        "class": "reduced",
        "description": "Admission to cultural events; audiobooks; books (excluding books whose content is harmful to minors); certain admission to sports events; certain agricultural inputs; certain domestic passenger transport; certain timber for industrial use; cut flowers and plants for decorative use and food production; ebooks; firewood; hotel accommodation (only short-term accommodation); intra-community and international passenger transport for certain road, rail and inland waterway transportation; medical and dental care; medical equipment for disabled persons; newspapers and periodicals (except those containing content harmful to minors and/or more than 50% advertising); social services; take-away food; taxation of certain gold coins and jewellery; water supplies (excluding bottled water); writers and composers; foodstuffs; hospitality; restaurants; cafes",
        "rate": 0.07,
        "types": "foodstuffs, books, medical, passenger transport, newspapers, admission to cultural events, admission to entertainment events, hotels",
        "types_array": [
          "foodstuffs",
          "books",
          "passenger transport",
          "newspapers",
          "admission to cultural events",
          "hotels",
          "admission to entertainment events",
          "medical"
        ]
      },
      {
        "class": "zero",
        "description": "Intra-community and international transport (excluding road and rail and certain inland waterways transport)",
        "rate": 0,
        "types": null,
        "types_array": []
      }
    ],
    "standard_rate": {
      "class": "standard",
      "description": "",
      "rate": 0.19,
      "types": null
    },
    "success": true
  },
  "US Tax Rates Example Response": {
    "city": "SANTA MONICA",
    "city_rate": 0.01,
    "combined_district_rate": 0.0425,
    "combined_rate": 0.1025,
    "combined_use_rate": 0.1025,
    "country": "US",
    "county": "LOS ANGELES",
    "county_rate": 0.0325,
    "freight_taxable": false,
    "state": "CA",
    "state_rate": 0.06,
    "zip": "90404"
  }
}
    
  

Get /types

Types of goods for tax calculation

Parameters
No parameters.
GET /types

Returns

Below is a sample response from the endpoint

    
{
  "types": [
    "foodstuffs",
    "books",
    "ebooks",
    "pharmaceuticals",
    "passenger transport",
    "newspapers",
    "admission to cultural events",
    "hotels",
    "admission to entertainment events",
    "restaurants",
    "water",
    "medical",
    "admission to sporting events",
    "baby foodstuffs",
    "accommodation",
    "property renovations",
    "childrens clothing",
    "wine",
    "domestic fuel",
    "advertising",
    "bikes",
    "domestic services",
    "agricultural supplies",
    "social housing"
  ]
}
    
  

Get /us_rate_list

US tax rates by zip code

Parameters
No parameters.

state
(required)

State abbreviation (2 letters)

Location: Query,Data Type: string

per_page
(optional)

Items per page (If present, items will be paginated by this number)

Location: Query,Data Type: string

GET /us_rate_list
** A word enclosed with curly brackets “{ }” in the code means that it is a parameter and it should be replaced with your own values when executing. (also overwriting the curly brackets).
Returns

Below is a sample response from the endpoint


      {
        "data": [
          {
            "city": "LOS ANGELES",
            "city_rate": 0,
            "combined_district_rate": 0.035,
            "combined_rate": 0.095,
            "combined_use_rate": 0.095,
            "country": "US",
            "county": "LOS ANGELES",
            "county_rate": 0.035,
            "freight_taxable": false,
            "state": "CA",
            "state_rate": 0.06,
            "zip": "90001"
          },
          {
            "city": "LOS ANGELES",
            "city_rate": 0,
            "combined_district_rate": 0.035,
            "combined_rate": 0.095,
            "combined_use_rate": 0.095,
            "country": "US",
            "county": "LOS ANGELES",
            "county_rate": 0.035,
            "freight_taxable": false,
            "state": "CA",
            "state_rate": 0.06,
            "zip": "90002"
          }
        ]
      }
    
Get /validate

Validate VAT numbers

Parameters

country_code
(required)

ISO country code (2 letters)

Location: Query,Data Type: string

vat_number
(required)

VAT number to look for

Location: Query,Data Type: string

GET /validate

** A word enclosed with curly brackets “{ }” in the code means that it is a parameter and it should be replaced with your own values when
executing. (also overwriting the curly brackets).
Returns

Below is a sample response from the endpoint

    
{
  "address": "VIA MANTA 15 \\n12030 LAGNASCO CN\\n",
  "countryCode": "IT",
  "format_valid": true,
  "name": "ASTESANA S.A.S. DI ASTESANA IVANO & C. SOCIETA AGRICOLA SIGL",
  "requestDate": "2022-04-25 17:50:45",
  "valid": true,
  "vat_number": "03334200049"
}
    
  

Rate Limiting

Each subscription has its own rate limit. When you become a member, you start by choosing a rate limit that suits your usage needs. Do not worry; You can upgrade or downgrade your plan at any time. For this reason, instead of starting with a larger plan that you do not need, we can offer you to upgrade your plan after you start with “free” or “gold plan” options and start using the API.

When you reach a rate limit (both daily and monthly), the service will stop responding and returning the HTTP 429 response status code (Too many requests) for each request with the following JSON string body text.


{
    "message":"You have exceeded your daily\/monthly API rate limit. Please review and upgrade your subscription plan at https:\/\/apilayer.com\/subscriptions to continue."
}
A reminder email will be sent to you when your API usage reaches both 80% and 90%, so that you can take immediate actions such as upgrading your plan in order to prevent your application using the API from being interrupted.

You can also programmatically check your rate limit yourself. As a result of each request made to the APILayer, the following 4 fields provide you with all the necessary information within the HTTP Headers.

x-ratelimit-limit-month: Request limit per month

x-ratelimit-remaining-month: Request limit remaining this month

x-ratelimit-limit-day: Request limit per day

x-ratelimit-remaining-day: Request limit remaining today

You can contact our support unit if you need any assistance with your application regarding to handle the returned result by looking at the header information.

Error Codes

APILayer uses standard HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate a clientside error, which means that failed given the information provided (e.g., a missing parameter, unauthorized access etc.). Codes in the 5xx range indicate an error with APILayer’s servers (normally this should’nt happen at all).

If the response code is not 200, it means the operation failed somehow and you may need to take an action accordingly. You can check the response (which will be in JSON format) for a field called ‘message’ that briefly explains the error reported.

Status Code Explanation
400 – Bad Request The request was unacceptable, often due to missing a required parameter.
401 – Unauthorized No valid API key provided.
404 – Not Found The requested resource doesn’t exist.
429 – Too many requests API request limit exceeded. See section Rate Limiting for more info.
5xx – Server Error We have failed to process your request. (You can contact us anytime)

You can always contact for support and ask for more assistance. We’ll be glad to assist you with building your product.