Duty & Tax Calculator
v 4.0.0
Division: DHL eCommerce, US
This API allows you to create and retrieve return labels for a specific pickup customer account.
Region: North America
Overview

DHL’s Duty and Tax Calculator (DTC) API calculates the duties, taxes and governmental fees for any cross border shipment, taking into consideration country de minimis values and preferential tariff rates that may apply.

 

We currently have private plugins that support Duty and Tax Calculation for the following three platforms: Shopify, Magento II, and SalesForce Commerce Cloud. For additional information regarding the plugins, please contact us here.

Scope

This API offers Duty and Tax Calculation, including foreign exchange conversion where necessary, for shipments from any country and to any country in the supported countries list.

 

The following operations are allowed in the DTC API:

OperationTypePath
Create Duty & Tax QuotePOST/dtc/v4/quotes

Workflow

Calculate The Duties, Taxes and other Fees for an international Shipment

For eCommerce stores selling to customers in international destinations,

  • Call the Duty and Tax Calculator when the customer is checking out their shopping cart
  • Get the quote for the shipment based on the contents + value + other landed costs
  • Display duties, taxes and any other fees to the customer to be included in payment
Request Description

M- Mandatory O- Optional C- Conditional N- Not Applicable 

NodeData TypeRequiredLengthDescriptionExample
pickupAccountstringM1:30DHL eCommerce pickup account number.5337574
itemSellerstringM1:100Store URLmystore.com
pricingStrategystring enumOMINIMUM, MAXIMUM, AVERAGE, EXACTPricing strategy used for the quote. For Minimum, Maximum, and Average strategies, the input HS digit length can be 2, 4, 6 or full length. If not provided, EXACT is used.AVERAGE
consigneeAddressobjectM Address of the consignee 
statestringO0:20Country State, Province, or Territory. This field is recommended when shipping into Canada and Brazil in order to produce accurate results. See References for allowed values for these countries.ON
countrystringM2Two letter ISO country code of the country where the shipment shall be delivered. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries.CA
senderAddressobjectM Address of the sender 
statestringO0:20Country State, Province, or Territory.GA
countrystringM2Two letter ISO country code of the sender Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries.US
packageDetailsobjectM Package level details 
freightChargeobjectO Freight charges for the package 
valuefloatM1:10Monetary value10.23
currencystringM3Currency name based on ISO 4217 3 character currency codes. See References for allowed values.USD
insuranceChargeobjectO Insurance charges for the package 
valuefloatM1:50Monetary value10.23
currencystringM1:20Currency name based on ISO 4217 3 character currency codes. See References for allowed values.USD
taxarrayO Provide tax information that's already included in the shipment 
includedbooleanMtrue, falseWhether tax was includedtrue
percentfloatM Percent tax included20
returnbooleanOtrue, falseWhether tax should be returned in the responsetrue
outputCurrencystringM3Currency in which the calculated fees should be output. based on ISO 4217 3 character currency codes. See References for allowed values.USD
clearanceModestring enumMPOST, COURIER, N/AClearance Mode for the PackageCOURIER
transportModestring enumOOCEAN, GROUND, AIR, N/ATransport Mode for the PackageAIR
endUsestring enumMPERSONAL, GIFTS, BUSINESS, N/AEnd use for the PackagePERSONAL
customsDetailsarrayM Customs Details of each item present in the package 
itemIdstringM1:50Item ID for the item34-49832044
hsCodestringO0:20HS Classification Code for the Item12.01.10
skuNumberstringO0:50SKU Number for the itemASFD-232
productIdentifiersobjectO Product Identifiers 
upcstringO12:12Universal Product Code assigned to the product. Used for auto-classification purposes only.123456789101
ean     
stringO8:13European Article Number assigned to the product. Used for auto-classification purposes only.88888888 
janstringO13:13Japanese Article Number assigned to the product. Used for auto-classification purposes only.1234567890123
isbnstringO10:13International Standard Book Number assigned to a book. Used for auto-classification purposes only.1234567890
mpnstringO1:50Manufacturer Part Number assigned to the product. Used for auto-classification purposes only.ABCDEFGH
brandstringO1:50Brand name of the product. Used for auto-classification purposes only.ABCDEFGHIJKLMNOPQRS
productCategorystringO0:50Product CategoryAPPAREL
itemShortDescriptionstringO0:75Item Short descriptionMENS SHIRTS
sizestringO0:200Item Full descriptionMENS FULL SLEEVE BUTTON DOWN SHIRTS
genderstringO0:10Size of the item (not the dimensions)10
ageGroupstring enumOMALE, FEMALE, UNISEXApplicable Gender for the item12
colorstring enumONEWBORN, TODDLER, INFANT, KIDS, ADULTApplicable Age Group for the itemADULT
stylestringO0:10Color of the itemBLUE
compositionstringO0:20Style of the itemMENS SHIRTS
conditionstringO0:999Composition of the item.[COTTON,POLYESTER]
countryOfOriginstring enumONEW, USED, REFURBISHED, ANTIQUECondition of the itemNEW
qualifiesForPreferentialTariffsstringO2Two letter ISO country code of the origin Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries.CN
itemQuantityobjectM Quantity of the itemobject
valueintegerM1:10Numeric value of the measure10
unitstring enumMPRS, NO, PCS, PC, UNT, GR, K, PK, EA, PKG, DOZUnit of Measure for quantityPCS
itemValueobjectM Item value 
valuefloatM1:10Monetary value10.23
currencystringM3Currency name based on ISO 4217 3 character currency codesUSD
itemFreightobjectM Monetary value2
valuefloatM1:10Monetary value10.23
currencystringM3Currency name based on ISO 4217 3 character currency codesUSD
itemInsuranceobjectM Monetary value25
valuefloatM1:10Monetary value10.23
currencystringM3Currency name based on ISO 4217 3 character currency codesUSD
widthobjectO Width of the item 
valuefloatM1:10Numeric value of the measure20
unitstring enumMMM, IN, CM, IN, FTThe unit of measure to be used with the valueCM
lengthobjectO Length of the item 
valuefloatM1:10Numeric value of the measure20
unitstring enumMMM, IN, CM, IN, FTThe unit of measure to be used with the valueCM
heightobjectO Height of the item 
valuefloatM1:10Numeric value of the measure20
unitstring enumMMM, IN, CM, IN, FTThe unit of measure to be used with the valueCM
weightobjectO Weight of the item 
valuefloatM1:10Numeric value of the measure2
unitstring enumMKGND, T, LB, G, OZ, KGThe unit of measure to be used with the valueKG
volumeobjectO Volume of the item 
valuefloatM1:10Numeric value of the measure0.25
unitstring enumMKM3, WG, HLT, KL, GAL, M3, CM3, IMPERIAL_GALLON, L, DAL, MLThe unit of measure to be used with the valueM3
areaobjectO Area of the item 
valuefloatM1:10Numeric value of the measure2
unitstring enumMM2, FT2The unit of measure to be used with the valueM2
taxarrayO Provide tax information that's already included in the item 
includedbooleanMtrue, falseWhether tax was includedtrue
percentfloatM0:99999999.99Percent tax included20
returnbooleanOtrue, falseWhether tax should be returned in the responsetrue
Response Description

M- Mandatory O- Optional C- Conditional N- Not Applicable 

NodeData TypeRequiredLengthDescriptionExample
quoteIdstringM36Unique ID for the quote84a135e9-2505-4331-9c5f-0c4532d5f051
pickupAccountstringM1:30DHL eCommerce pickup account number. For 7-digit pickups, add 3 leading zeroes.0005337574
itemSellerstringM1:100Store URLmystore.com
pricingStrategystring enumMMINIMUM, MAXIMUM, AVERAGE, EXACTPricing strategy used for the quote. For Minimum, Maximum, and Average strategies, the input HS digit length can be 2, 4, 6 or full length.AVERAGE
feeTotalsarrayM Calculated total fees 
namestringM1:20Name of feeDUTY
currencystringM3Currency of fee. 3-letter ISO currency code. See References for allowed values.USD
valuefloatM1:20Value of the fee2.00
consigneeAddressobjectM Address of the consignee 
statestringO0:20Country State, Province, or Territory. This field is required when shipping into Canada and Brazil in order to produce accurate results. See References for allowed values for these countries.ON
countrystringM2Two letter ISO country code of the country where the shipment shall be delivered. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries.CA
senderAddressobjectM Address of the sender 
statestringO0:20Country State, Province, or Territory.GA
countrystringM2Two letter ISO country code of the sender Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries.US
packageDetailsobjectM Package l 
freightChargeobjectM Freight charges for the package 
valuefloatM1:10Monetary value10.23
currencystringM3Currency name based on ISO 4217 3 character currency codes. See References for allowed values.USD
insuranceChargeobjectM Insurance charges for the package 
valuefloatM0:50Monetary value10.23
currencystringM0:20Currency name based on ISO 4217 3 character currency codes. See References for allowed values.USD
taxarrayO0:99999999.99Provide tax information that's already included in the shipment 
includedbooleanMtrue, falseWhether tax was includedtrue
percentfloatM Percent tax included20
returnbooleanOtrue, falseWhether tax should be returned in the responsetrue
outputCurrencystringM3Currency in which the calculated fees should be output. based on ISO 4217 3 character currency codes. See References for allowed values.USD
clearanceModestring enumMPOST, COURIER, N/AClearance Mode for the PackageCOURIER
transportModestring enumOOCEAN, GROUND, AIR, N/ATransport Mode for the PackageAIR
endUsestring enumMPERSONAL, GIFTS, BUSINESS, N/AEnd use for the PackagePERSONAL
packageFeesarrayM Package level fees 
namestringO0:20Name of feeDUTY
currencystringO3Currency name based on ISO 4217 3 character currency codesUSD
valuefloatO0:20Monetary value2.00
customeDetailsarrayM Customs Details of each item present in the package 
itemIdstringM1:50Item ID for the item34-49832044
hsCodestringO0:20HS Classification Code for the Item12.01.10
hsCodeAppliedstringM1:20HS Classification Code used by the Quote engine. Can be different from hsCode12.01.00
skuNumberstringO0:50SKU Number for the itemASFD-232
productIdentifiersobjectO Product Identifiers 
upcstringO12:12Universal Product Code assigned to the product. Used for auto-classification purposes only.123456789101
eanstringO8:13European Article Number assigned to the product. Used for auto-classification purposes only.88888888
janstringO13:13Japanese Article Number assigned to the product. Used for auto-classification purposes only.1234567890123
isbnstringO10:13International Standard Book Number assigned to a book. Used for auto-classification purposes only.1234567890
mpnstringO1:50Manufacturer Part Number assigned to the product. Used for auto-classification purposes only.ABCDEFGH
brandstringO1:50Brand name of the product. Used for auto-classification purposes only.ABCDEFGHIJKLMNOPQRS
productCategorystringO0:50Product CategoryAPPAREL
itemShortDescriptionstringO0:75Item Short descriptionMENS SHIRTS
itemDescriptionstringO0:200Item Full descriptionMENS FULL SLEEVE BUTTON DOWN SHIRTS
sizestringO0:10Size of the item (not the dimensions)10
genderstring enumOMALE, FEMALE, UNISEXApplicable Gender for the item12
ageGroupstring enumONEWBORN, TODDLER, INFANT, KIDS, ADULTApplicable Age Group for the itemADULT
colorstringO0:10Color of the itemBLUE
stylestringO0:20Style of the itemMENS SHIRTS
compositionstringO0:999Composition of the item.[COTTON,POLYESTER]
conditionstring enumONEW, USED, REFURBISHED, ANTIQUECondition of the itemNEW
countryOfOriginstringO2Two letter ISO country code of the origin Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries.CN
qualifiesForPreferentialTarrifsbooleanMtrue, falseWhether the item qualifies for preferential tariffs. Default is false.true
itemQuantityobjectM Quantity of the item 
valueintegerM1:10Numeric value of the measure10
unitstring enumMPRS, NO, PCS, PC, UNT, GR, K, PK, EA, PKG, DOZUnit of Measure for quantityPCS
itemValueobjectM Item value 
valuefloatM1:10Monetary value10.23
currencystringM3Currency name based on ISO 4217 3 character currency codesUSD
itemInsuranceobjectM Monetary value25
valuefloatM1:10Monetary value10.23
currencystringM3Currency name based on ISO 4217 3 character currency codesUS
widthobjectO Width of the item 
unitstring enumMMM, IN, CM, IN, FTThe unit of measure to be used with the valueCM
valuefloatM1:10Numeric value of the measure20
lengthobjectO Length of the item 
unitstring enumMMM, IN, CM, IN, FTThe unit of measure to be used with the valueCM
valuefloatM1:10Numeric value of the measure20
heightobjectO Height of the item 
unitstring enumMMM, IN, CM, IN, FTThe unit of measure to be used with the valueCM
valuefloatM1:10Numeric value of the measure20
weightobjectO Weight of the item 
unitstring enumMKGND, T, LB, G, OZ, KGThe unit of measure to be used with the valueKG
valuefloatM1:10Numeric value of the measure2
volumeobjectO Volume of the item 
unitstring enumMKM3, WG, HLT, KL, GAL, M3, CM3, IMPERIAL_GALLON, L, DAL, MLThe unit of measure to be used with the valueM3
valuefloatM1:10Numeric value of the measure0.25
areaobjectO Area of the item 
unitstring enumMM2, FT2The unit of measure to be used with the valueM2
valuefloatM1:10Numeric value of the measure2
taxarrayO Provide tax information that's already included in the item 
includedbooleanMtrue, falseWhether tax was includedtrue
percentfloatM0:99999999.99Percent tax included20
returnbooleanOtrue, falseWhether tax should be returned in the responsetrue
itemFeesobjectM Item level fees 
namestringM1:20Name of feeDUTY
currencystringM1:3Currency name based on ISO 4217 3 character currency codesUSD
valuefloatM1:20Monetary value2.00
infoarrayO Object that will contain additional information where applicable 
messagestringO1:999999Related messageDeminimis Notes: Fee [GST ] : Non-dutiable and non-controlled goods imported by air courier services with a total CIF value not exceeding SGD 400 are granted GST relief and no Customs permit is required.
Important

The API will return calculated duties and taxes, taking into account the price of the goods contained in the shipment, freight and insurance costs, and currency conversion.

Clients can define a pricingStrategy that will be utilized when calculating duties and taxes. The following strategies are supported:

  • MINIMUM - The system will return the minimum duty rate found in the tariffs based on the number of HS digits the caller provides in the request.
  • MAXIMUM - The system will return the maximum duty rate found in the tariffs based on the number of HS digits the callers provides in the request.
  • AVERAGE - The system will return the average duty rate found in the tariffs based on the number of HS digits the caller provides in the request.
  • EXACT - The system will return the exact rate found in the tariffs based on the full HS Code. This is the default strategy that will be applied if no pricing strategy is defined by the caller.

For Minimum, Maximum, and Average strategies, the input HS digit length can by any length over two digits.

VAT included strategy

Some merchants prefer to include VAT/Tax in the cost of the goods displayed on their site so that shoppers don’t have the VAT/Tax charge added at checkout, but still want to use the Duty/Tax Calculator API to calculate duties and other fees, and take into account all deminimis rules. The tax object is used for this purpose. This allows merchants to send in item prices with the VAT included in the cost; the VAT is then backed out of the price; only duties, taxes and fees are returned; and there is no ‘double taxation’.

This optional tax object is available at the Shipment or Item level.

Shipment level only: If a merchant has added the same tax percent to all item prices, then the shipment level object is the best approach. The tax object is provided at the shipment level, with ‘included’ set to true, and the percent of tax in the ‘percent’ field. For example, if 20% is added to the cost of all items, the object would be:

{
  "included": true,
  "percent": 20,
  “return”: true       
}

The ‘return’ field indicates whether the merchant wants the actual tax calculation returned from the API as well. In most cases, this would be set to ‘false’ as the tax is already included, but could be useful as a tool to check the actual tax.

Item Level: If the objectis sent at the item level, it applies to that item only. It is not necessary to have the objecton every item; the DTC API will only apply tax to that item. The format is the same as at the shipment level.

Note:

  • If the Tax object is included at the shipment level, any tax objects(s) at the item level will be ignored.
  • If “return” is true, then the tax value calculated by the API is returned.

Minimum attributes required

The more information you provide about your shipment, the more accurate the quote returned will be. For example, consigneeAddress/state field is required when shipping into Canada and Brazil in order to produce accurate results. Freight charges and insurance charges are required because duties are often calculated on Cost, Insurance and Freight (CIF).      
The minimum information that's necessary for a return quote is shown below-

{
 "pickupAccount": "0005331234",
 "itemSeller": "Mysite.com",
 "senderAddress": {
   "country": "US"
 },
 "consigneeAddress": {
   "country": "SG"
 },
 "packageDetails": {
   "outputCurrency": "USD"
 },
 "customsDetails": [
   {
     "itemId": "29616088973377",
     "itemQuantity": {
       "value": 2,
       "unit": "EA"
     },
     "itemValue": {
       "value": 200,
       "currency": "USD"
     }
   }
 ]
}
  • pickupAccount and itemSeller are mandatory to identify the client
  • senderAddress/country and consigneeAddress/country are mandatory as duty calculation is mainly driven by where it's shipped from and where it's shipped to
  • outputCurrency determines what currency you would like the duties to be returned in. For example, you can choose the currency of your shopping cart so you can get duties in the customer's purchase currency.
  • itemId is required to identify the item
  • itemQuantity and itemValue is mandatory as in most cases duties are calculated on adValorem basis

Duty Calculator Response

In the Duty Calculator response, quote will be returned in the following objects.

  • feeTotals
  • packageFees
  • itemFees

Each of these will have the following elements -

  • name - name of the fee
  • currency - currency of the fee
  • value - value of the fee

The sum of the itemFees for all items + packageFees should equal the feeTotals.

In addition, the itemFees will contain an optional ruleInfo element that will contain details about how the item fee was calculated.

Error Response

In multiple scenarios, Duty Calculator can return a 400 response code along with an error response that can be one of the following -

  • Static Validation Failed (400.0904001) - the request did not pass the JSON schema validation. E.g: Mandatory element not found, invalid JSON element in request, JSON element had a value which is not a valid enum etc. Example -

 

{
"type": "https://api.dhlecs.com/docs/errors/400.0904001",
"title": "Static Validation Failed",
"quoteId": "fbcbc29b-ec34-4ff9-8552-94790d6af327",
"invalidParams": [
 {
   "name": "pickupAccount",
   "path": "/",
   "reason": "required key [pickupAccount] not found"
 }
]
}

 

 

  • Data Validation Failed (400.0904003) - the request did not pass master data validation. E.g.: currency value in invalid, pickupAccount is invalid, itemSeller is invalid, pricingStrategy value is not from enum etc. Example -

 

{
"type": "https://api.dhlecs.com/docs/errors/400.0904003",
"title": "Data Validation Failed",
"quoteId": "33b6f512-3699-4dd5-8bb0-46049d202e91",
"invalidParams": [
 {
   "name": "country",
   "path": "/senderAddress",
   "reason": "Country UX not found in master data"
 }
]
}

 

  • Processing Error (400.0904002) - when the calculator runs into an error when processing the request for a quote. Example:

     

{
"type": "https://api.dhlecs.com/docs/errors/400.0904002",
"title": "Processing Error",
"quoteId": "603b8f4c-4566-4642-ae4b-e6bffe7ef6d4",
"invalidParams": [
 {
   "reason": "DTC Calculation failed = > Default Duty Rate was not found for HS : 120010"
 }
]
}

Static and Data validation errors are driven directly by the data provided in the request. Processing errors may be related to master data and trade sheets available for the engine. There are other error codes that may not be related to the request. Refer to the Errors section for complete reference on all possible errors.

POST Request Quote
{
"pickupAccount": "0005316279",
"itemSeller": "Test.com",
"pricingStrategy": "AVERAGE",
"consigneeAddress": {
"country": "AU"
},
"senderAddress": {
"country": "IN"
},
"packageDetails": {
"freightCharge": {
"value": 0,
"currency": "AUD"
},
"endUse": "GIFTS",
"insuranceCharge": {
"value": 0,
"currency": "AUD"
},
"tax": {
"included": true,
"percent": 10,
"return": true
},
"outputCurrency": "AUD",
"clearanceMode": "POST",
"transportMode": "AIR"
},
"customsDetails": [
{
"itemId": "NV17421748661",
"hsCode": "1507.90.00.13",
"itemDescription": "Of sizes not exceeding 81 cm chest measurement",
"itemShortDescription": "Of sizes not exceeding 81 cm chest measurement",
"gender": "MALE",
"skuNumber": "sku-54321-01",
"condition": "NEW",
"qualifiesForPreferentialTariffs": true,
"countryOfOrigin": "IN",
"composition": [],
"ageGroup": "ADULT",
"productCategory": "Sporting goods",
"style": "Oversized",
"size": "L",
"color": "BLACK",
"productIdentifiers": {
"jan": "0000000000000",
"upc": "000000000000",
"brand": "Wilson",
"mpn": "0000000",
"ean": "00000000",
"isbn": "0000000000"
},
"itemValue": {
"value": 10000,
"currency": "AUD"
},
"itemInsurance": {
"value": 0,
"currency": "AUD"
},
"itemFreight": {
"value": 0,
"currency": "AUD"
},
"width": {
"value": 30,
"unit": "IN"
},
"area": {
"value": 10,
"unit": "M2"
},
"itemQuantity": {
"value": 1,
"unit": "PC"
},
"height": {
"value": 10,
"unit": "IN"
},
"length": {
"value": 20,
"unit": "IN"
},
"weight": {
"value": 1,
"unit": "KG"
},
"tax": {
"included": true,
"percent": 10,
"return": false
}
}
]
}