Import duty API

Web standardized import duty data in an API

By 2025 we want to power over 10% of the World’s e-commerce websites with import duty calculations and we’re going to increase commerce in developing countries by making it easier for website owners to charge import duty on the goods they sell – helping them to reach a wider audience.

Show your support by giving us the thumbs up! Our project is not for commercial gain and not for profit. Our API is not perfect yet – but it will be soon!

2+
  Open API Access

20%
0%
25%
2.7%
20%

HS code 660200 example illustrated above

Import duty look up

Standalone version here


Results

Country Min % Max % Avg % Calculation Description
20 20 20 MFN applied duty rates

EXAMPLE ONE. 1 RESULT RETURNED

API example 1 quick test URL

Sample API request using PHP

<?php

function api_call_func($api_url)
{
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $api_url);
	curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_VERBOSE, true);
	$result = curl_exec($ch);
	curl_close($ch);

	$myArray = json_decode($result, true);

	return $myArray;
}

$return = api_call_func("https://slib.co/v1/?duty=hs&country=BR&code=640291");

?> 

Sample JSON response

{
    "duty": [
        {
            "id": 3395,
            "maximumrate": "35",
            "minimumrate": "35",
            "averagerate": "35",
            "specificrate": "",
            "description": "MFN applied duty rates",
            "flag1x1": "https:\/\/slib.co\/flags\/1x1\/br.svg",
            "flag3x4": "https:\/\/slib.co\/flags\/4x3\/br.svg",
            "statuscode": "201",
            "statusdescription": "HS Data Found"
        }
    ]
}

Sample PHP foreach loop using the JSON response

<?php

foreach ($return["duty"] as $duty)
{
	?>
	<tr>
		<td><img src="<?php echo $duty["flag3x4"]; ?>" style="width:50px; height:19px;"></td> 
		<td><?php echo $duty["minimumrate"]; ?></td>
		<td><?php echo $duty["maximumrate"]; ?></td>
		<td><?php echo $duty["averagerate"]; ?></td>
		<td><?php echo $duty["specificrate"]; ?></td>
		<td><?php echo $duty["description"]; ?></td>
		<td>Code: <?php echo $duty["statuscode"]; ?>. <?php echo $duty["statusdescription"]; ?></td> 
	</tr>
	<?php
}

?>

HTML output

Country Min % Max % Avg % Calculation Description
20 20 20 MFN applied duty rates

EXAMPLE TWO. 2 OR MORE RESULTS RETURNED

API example 2 quick test URL

Sample JSON response

{
    "duty": [
        {
            "id": 47740,
            "maximumrate": "48",
            "minimumrate": "6",
            "averagerate": "24.333333",
            "specificrate": "",
            "description": "MFN applied duty rates",
            "flag1x1": "https:\/\/slib.co\/flags\/1x1\/us.svg",
            "flag3x4": "https:\/\/slib.co\/flags\/4x3\/us.svg",
            "statuscode": "201",
            "statusdescription": "HS Data Found"
        },
        {
            "id": 47741,
            "maximumrate": "",
            "minimumrate": "",
            "averagerate": "",
            "specificrate": "90 cents\/pr. + 20%",
            "description": "MFN applied duty rates",
            "flag1x1": "https:\/\/slib.co\/flags\/1x1\/us.svg",
            "flag3x4": "https:\/\/slib.co\/flags\/4x3\/us.svg",
            "statuscode": "201",
            "statusdescription": "HS Data Found"
        }
...

Getting all maximum rate duties when more than one array value is returned

<?php

$maximumrateduties = array_column($return["duty"], 'maximumrate', 'id' );
 
print_r($maximumrateduties);

?> Returns: Array ( [47740] => 48 [47741] => [47742] => [47743] => 0 [47744] => 0 [47745] => 0 [47746] => 0 [47747] => 0 [47748] => 0 [47749] => 0 [47750] => 0 [47751] => 0 [47752] => 0 [47753] => [47754] => [47755] => 6 [47756] => 0 [47757] => 6 [47758] => 0 [47759] => [47760] => [47761] => 0 [47762] => [47763] => [47764] => [47765] => 15 [47766] => 0 [47767] => [47768] => 0 [47769] => [47770] => 1.8 [47771] => [47772] => 0 [47773] => 0 [47774] => 0 [47775] => [47776] => [47777] => 84 )

Find the highest maximum rate duty in the array above

<?php

echo $maximumratedutiesonline = max(array_column($return["duty"], 'maximumrate', 'id'));

?> Returns: 84

API request guide

API Request Variable Description
duty Enter hs

Example: duty=hs
code 6 digit HS code. Find HS codes here: https://www.trade-tariff.service.gov.uk/trade-tariff/sections

Example: code=640291
country ISO 3166-2 two letter country code of the landing country. Find country codes here: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.

Example: country=GB

API response guide

API Response Variable Description
id Unique id (primary key) of the duty. Unique per country (or per EU country only).
maximumrate Maximum ad valorem value % duty
minimumrate Minimum ad valorem value % duty
averagerate Average ad valorem value % duty
specificrate Specific duty calculation
description Description often contains specific regions and countries that the duty applies to
flag1x1 Country flag (1x1) SVG image src
flag3x4 Country flag (3x4) SVG image src
statuscode 200 & 201 = Success. 400 = Error
statusdescription Description of the status code

Countries supported

Country Code Country
AE United Arab Emirates
AG Antigua and Barbuda
AL Albania
AM Armenia
AO Angola
AR Argentina
AS American Samoa
AT Austria
AU Australia
BB Barbados
BD Bangladesh
BE Belgium
BF Burkina Faso
BG Bulgaria
BH Bahrain
BI Burundi
BJ Benin
BN Brunei Darussalam
BO Bolivia, Plurinational State of
BR Brazil
BS Bahamas
BW Botswana
BY Belarus
BZ Belize
CA Canada
CD Congo, the Democratic Republic of the
CF Central African Republic
CG Congo
CH Switzerland
CI Côte d'Ivoire
CL Chile
CM Cameroon
CN China
CO Colombia
CR Costa Rica
CU Cuba
CV Cabo Verde
CY Cyprus
CZ Czechia
DE Germany
DJ Djibouti
DK Denmark
DM Dominica
DO Dominican Republic
DZ Algeria
EC Ecuador
EE Estonia
EG Egypt
ES Spain
FI Finland
FJ Fiji
FK Falkland Islands (Malvinas)
FR France
GA Gabon
GB United Kingdom of Great Britain and Northern Ireland
GD Grenada
GE Georgia
GH Ghana
GM Gambia
GN Guinea
GR Greece
GT Guatemala
GW Guinea-Bissau
GY Guyana
HK Hong Kong
HN Honduras
HR Croatia
HT Haiti
HU Hungary
ID Indonesia
IL Israel
IS Iceland
IT Italy
JM Jamaica
JO Jordan
JP Japan
KE Kenya
KG Kyrgyzstan
KH Cambodia
KN Saint Kitts and Nevis
KP Korea, Democratic People's Republic of
KR Korea, Republic of
KW Kuwait
KZ Kazakhstan
LA Lao People's Democratic Republic
LC Saint Lucia
LK Sri Lanka
LR Liberia
LS Lesotho
LT Lithuania
LU Luxembourg
LV Latvia
MA Morocco
MD Moldova, Republic of
ME Montenegro
MG Madagascar
MK Macedonia, the former Yugoslav Republic of
ML Mali
MM Myanmar
MN Mongolia
MO Macao
MR Mauritania
MT Malta
MU Mauritius
MV Maldives
MW Malawi
MX Mexico
MY Malaysia
MZ Mozambique
NA Namibia
NE Niger
NG Nigeria
NI Nicaragua
NL Netherlands
NO Norway
NP Nepal
NZ New Zealand
OM Oman
PA Panama
PE Peru
PH Philippines
PK Pakistan
PL Poland
PT Portugal
PY Paraguay
QA Qatar
RO Romania
RS Serbia
RU Russian Federation
RW Rwanda
SA Saudi Arabia
SB Solomon Islands
SC Seychelles
SE Sweden
SG Singapore
SI Slovenia
SK Slovakia
SL Sierra Leone
SN Senegal
SR Suriname
SV El Salvador
SZ Eswatini
TD Chad
TG Togo
TH Thailand
TJ Tajikistan
TO Tonga
TT Trinidad and Tobago
TZ Tanzania, United Republic of
UA Ukraine
UG Uganda
US United States of America
UY Uruguay
VC Saint Vincent and the Grenadines
VE Venezuela, Bolivarian Republic of
VN Viet Nam
WS Samoa
YE Yemen
ZA South Africa
ZM Zambia
ZW Zimbabwe

Countries not supported

Country Code Country
AD Andorra
AF Afghanistan
AI Anguilla
AQ Antarctica
AW Aruba
AX Åland Islands
AZ Azerbaijan
BA Bosnia and Herzegovina
BL Saint Barthélemy
BM Bermuda
BQ Bonaire, Sint Eustatius and Saba
BT Bhutan
BV Bouvet Island
CC Cocos (Keeling) Islands
CK Cook Islands
CW Curaçao
CX Christmas Island
EH Western Sahara
ER Eritrea
ET Ethiopia
FM Micronesia, Federated States of
FO Faroe Islands
GF French Guiana
GG Guernsey
GI Gibraltar
GL Greenland
GP Guadeloupe
GQ Equatorial Guinea
GS South Georgia and the South Sandwich Islands
GU Guam
HM Heard Island and McDonald Islands
IE Ireland
IM Isle of Man
IN India
IO British Indian Ocean Territory
IQ Iraq
IR Iran, Islamic Republic of
JE Jersey
KI Kiribati
KM Comoros
KY Cayman Islands
LB Lebanon
LI Liechtenstein
LY Libya
MC Monaco
MF Saint Martin (French part)
MH Marshall Islands
MP Northern Mariana Islands
MQ Martinique
MS Montserrat
NC New Caledonia
NF Norfolk Island
NR Nauru
NU Niue
PF French Polynesia
PG Papua New Guinea
PM Saint Pierre and Miquelon
PN Pitcairn
PR Puerto Rico
PS Palestine, State of
PW Palau
RE Réunion
SD Sudan
SH Saint Helena, Ascension and Tristan da Cunha
SJ Svalbard and Jan Mayen
SM San Marino
SO Somalia
SS South Sudan
ST Sao Tome and Principe
SX Sint Maarten (Dutch part)
SY Syrian Arab Republic
TC Turks and Caicos Islands
TF French Southern Territories
TK Tokelau
TL Timor-Leste
TM Turkmenistan
TN Tunisia
TR Turkey
TV Tuvalu
TW Taiwan, Province of China
UM United States Minor Outlying Islands
UZ Uzbekistan
VA Holy See
VG Virgin Islands, British
VI Virgin Islands, U.S.
VU Vanuatu
WF Wallis and Futuna
YT Mayotte

Data accuracy

We do not and cannot guarantee the accuracy of the data in our API. 

We rely on data from many sources including Customs, WTO and 3rd party data suppliers. We cannot be held responsible for any loss or damage if the data is not 100% accurate. Slibstream do not guarantee the API is free from error.

Change log

Version 1- Beta Stage [November 2018]:

  • 161 countries supported
  • Specific duty calculation returned for non ad valorem duty
  • Ad valorem values returned
  • ISO 3166-2 two letter country codes support (WooCommerce friendly)
  • Harmonized commodity coding system (HS code) support
  • Country flags returned. Credit: http://flag-icon-css.lip.is/
  • Contact us and contribute data by emailing: support@slibstream.com
  • The API does not currently run duty calculations it returns values

Feedback below

Let us know what you think about our API…

Share with the World:

Leave a Reply

Your email address will not be published. Required fields are marked *