← Back to catalog

Finance

Taxrates.io

auto-generated
swirls add taxrates
actionGETv1.0.0

All tax rates

<p>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.</p> <p>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 <a href="https://gist.github.com/gregbird/cd904ff230cdf86253716aa351154edb">code on Github</a>.</p> <p><b>Please note</b> 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"</p> <p>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.</p> <p>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)</p> <ul> <li>CombinedRate</li> <li>StateRate</li> <li>CountyRate</li> <li>CityRate</li> <li>SpecialRate</li> </ul> <pre><code class="js"> var taxrates_endpoint = 'tax/rates'; var taxrates_params = {'domain':'api.taxrates.io'}; var taxrates_url = '/api/v3/'; if ( localStorage.getItem("Taxrates_API_Client_Secret") ){ jQuery.support.cors = true; jQuery.ajax({ url: taxrates_url+taxrates_endpoint, type: 'get', method: 'get', dataType: "json", data: taxrates_params, beforeSend: function (request) { request.withCredentials = true; request.setRequestHeader("Authorization", "Apikey " + localStorage.getItem("Taxrates_API_Client_Secret")); }, headers: { "accept": "application/json" }, contentType: 'application/json; charset=utf-8', success: function (data, textStatus, jqXHR) { //Maintain errors inside success because the API may return 200 in general, but different code inside if(data.ErrorCode=='404' || data.ErrorCode=='500'){ //Maintain errors here console.log(data.ErrorMessage); return false; }else{ var rates = []; var i=0; var taxrates_range = ''; jQuery.each(data, function(k, v) { if(v.hasOwnProperty("rates")){ jQuery.each(v.rates, function(m, w) { rates[i] = []; //Only showing standard rate type if( w.Type == "standard" ){ rates[i][0] = w.Type; rates[i][1] = w.data_value; rates[i][2] = w.product_code; i++; } }); } }).fail(function(xhr) { //Maintain your errors here return false; }); var cursor = jqXHR.getResponseHeader('X-Cursor-Next'); if (cursor) { // get next page... } return true; }else{ //Not logged into taxrates.io //Maintain your errors here return false; }</code></pre>

Source
actionGETv1.0.0

Tax rates by Country Code

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 <a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes">here</a> for more information). You can use 'filter' parameter to narrow results to selected type of tax <p>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)</p> <ul> <li>CombinedRate</li> <li>StateRate</li> <li>CountyRate</li> <li>CityRate</li> <li>SpecialRate</li> </ul> <pre><code class="js">var taxrates_endpoint = 'tax/countrycode'; var taxrates_params = {'domain':'api.taxrates.io', 'country_code':'IE', 'product_code':'C010'}; var taxrates_url = '/api/v1/'; if ( localStorage.getItem("Taxrates_API_Client_Secret") ){ jQuery.support.cors = true; jQuery.ajax({ url: taxrates_url+taxrates_endpoint, type: 'get', method: 'get', dataType: "json", data: taxrates_params, beforeSend: function (request) { request.withCredentials = true; request.setRequestHeader("Authorization", "Apikey " + localStorage.getItem("Taxrates_API_Client_Secret")); }, headers: { "accept": "application/json" }, contentType: 'application/json; charset=utf-8', success: function (data) { //Maintain errors inside success because the API may return 200 in general, but different code inside if(data.ErrorCode=='404' || data.ErrorCode=='500'){ //Maintain errors here console.log(data.ErrorMessage); return false; }else{ var rates = []; var i=0; jQuery.each(data, function(k, v) { if(v.hasOwnProperty("taxes")){ jQuery.each(v.taxes, function(m, w) { rates[i] = []; //Only showing standard rate type if( w.Type == "standard" ){ rates[i][0] = w.Country; rates[i][1] = w.Type; rates[i][2] = w.data_value; i++; } }); } //Now you have all your rates inside rates variable. }).fail(function(xhr) { //Maintain your errors here return false; }); return true; }else{ //Not logged into taxrates.io //Maintain your errors here return false; }</code></pre>

Source
actionGETv1.0.0

Tax rates by IP address

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 <p>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)</p> <ul> <li>CombinedRate</li> <li>StateRate</li> <li>CountyRate</li> <li>CityRate</li> <li>SpecialRate</li> </ul> <pre><code class="js">var taxrates_endpoint = 'tax/ip'; var taxrates_params = {'domain':'api.taxrates.io', 'ip':'208.80.152.201', 'product_code':'C010'}; var taxrates_url = '/api/v1/'; if ( localStorage.getItem("Taxrates_API_Client_Secret") ){ jQuery.support.cors = true; jQuery.ajax({ url: taxrates_url+taxrates_endpoint, type: 'get', method: 'get', dataType: "json", data: taxrates_params, beforeSend: function (request) { request.withCredentials = true; request.setRequestHeader("Authorization", "Apikey " + localStorage.getItem("Taxrates_API_Client_Secret")); }, headers: { "accept": "application/json" }, contentType: 'application/json; charset=utf-8', success: function (data) { //Maintain errors inside success because the API may return 200 in general, but different code inside if(data.ErrorCode=='404' || data.ErrorCode=='500'){ //Maintain errors here console.log(data.ErrorMessage); return false; }else{ var rates = []; var i=0; jQuery.each(data, function(k, v) { if(v.hasOwnProperty("taxes")){ jQuery.each(v.taxes, function(m, w) { rates[i] = []; //Only showing standard rate type if( w.Type == "standard" ){ rates[i][0] = w.Country; rates[i][1] = w.Type; rates[i][2] = w.data_value; i++; } }); } //Now you have all your rates inside rates variable. }).fail(function(xhr) { //Maintain your errors here return false; }); return true; }else{ //Not logged into taxrates.io //Maintain your errors here return false; }</code></pre>

Source
Beyond the catalog

Any provider, on request.

01

Request it

Tell us which provider you need, and we will ship it in the registry.

02

Generate it

Point swirls add at an OpenAPI or GraphQL spec. Typed actions for any API you hold credentials for, today.

acme · integrations
terminal
~/acme $swirls add linear
✓ 12 typed actions · scopes and schemas included
 
~/acme $swirls add https://api.acme.dev/openapi.json
◆ Fetched spec · 38 operations
✓ 6 typed actions · generated from spec