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:
| Operation | Type | Path |
| Create Duty & Tax Quote | POST | /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
M- Mandatory O- Optional C- Conditional N- Not Applicable
| Node | Data Type | Required | Length | Description | Example |
| pickupAccount | string | M | 1:30 | DHL eCommerce pickup account number. | 5337574 |
| itemSeller | string | M | 1:100 | Store URL | mystore.com |
| pricingStrategy | string enum | O | MINIMUM, MAXIMUM, AVERAGE, EXACT | Pricing 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 |
| consigneeAddress | object | M | Address of the consignee | ||
| state | string | O | 0:20 | Country 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 |
| country | string | M | 2 | Two 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 |
| senderAddress | object | M | Address of the sender | ||
| state | string | O | 0:20 | Country State, Province, or Territory. | GA |
| country | string | M | 2 | Two letter ISO country code of the sender Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries. | US |
| packageDetails | object | M | Package level details | ||
| freightCharge | object | O | Freight charges for the package | ||
| value | float | M | 1:10 | Monetary value | 10.23 |
| currency | string | M | 3 | Currency name based on ISO 4217 3 character currency codes. See References for allowed values. | USD |
| insuranceCharge | object | O | Insurance charges for the package | ||
| value | float | M | 1:50 | Monetary value | 10.23 |
| currency | string | M | 1:20 | Currency name based on ISO 4217 3 character currency codes. See References for allowed values. | USD |
| tax | array | O | Provide tax information that's already included in the shipment | ||
| included | boolean | M | true, false | Whether tax was included | true |
| percent | float | M | Percent tax included | 20 | |
| return | boolean | O | true, false | Whether tax should be returned in the response | true |
| outputCurrency | string | M | 3 | Currency in which the calculated fees should be output. based on ISO 4217 3 character currency codes. See References for allowed values. | USD |
| clearanceMode | string enum | M | POST, COURIER, N/A | Clearance Mode for the Package | COURIER |
| transportMode | string enum | O | OCEAN, GROUND, AIR, N/A | Transport Mode for the Package | AIR |
| endUse | string enum | M | PERSONAL, GIFTS, BUSINESS, N/A | End use for the Package | PERSONAL |
| customsDetails | array | M | Customs Details of each item present in the package | ||
| itemId | string | M | 1:50 | Item ID for the item | 34-49832044 |
| hsCode | string | O | 0:20 | HS Classification Code for the Item | 12.01.10 |
| skuNumber | string | O | 0:50 | SKU Number for the item | ASFD-232 |
| productIdentifiers | object | O | Product Identifiers | ||
| upc | string | O | 12:12 | Universal Product Code assigned to the product. Used for auto-classification purposes only. | 123456789101 |
| ean | |||||
| string | O | 8:13 | European Article Number assigned to the product. Used for auto-classification purposes only. | 88888888 | |
| jan | string | O | 13:13 | Japanese Article Number assigned to the product. Used for auto-classification purposes only. | 1234567890123 |
| isbn | string | O | 10:13 | International Standard Book Number assigned to a book. Used for auto-classification purposes only. | 1234567890 |
| mpn | string | O | 1:50 | Manufacturer Part Number assigned to the product. Used for auto-classification purposes only. | ABCDEFGH |
| brand | string | O | 1:50 | Brand name of the product. Used for auto-classification purposes only. | ABCDEFGHIJKLMNOPQRS |
| productCategory | string | O | 0:50 | Product Category | APPAREL |
| itemShortDescription | string | O | 0:75 | Item Short description | MENS SHIRTS |
| size | string | O | 0:200 | Item Full description | MENS FULL SLEEVE BUTTON DOWN SHIRTS |
| gender | string | O | 0:10 | Size of the item (not the dimensions) | 10 |
| ageGroup | string enum | O | MALE, FEMALE, UNISEX | Applicable Gender for the item | 12 |
| color | string enum | O | NEWBORN, TODDLER, INFANT, KIDS, ADULT | Applicable Age Group for the item | ADULT |
| style | string | O | 0:10 | Color of the item | BLUE |
| composition | string | O | 0:20 | Style of the item | MENS SHIRTS |
| condition | string | O | 0:999 | Composition of the item. | [COTTON,POLYESTER] |
| countryOfOrigin | string enum | O | NEW, USED, REFURBISHED, ANTIQUE | Condition of the item | NEW |
| qualifiesForPreferentialTariffs | string | O | 2 | Two letter ISO country code of the origin Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries. | CN |
| itemQuantity | object | M | Quantity of the item | object | |
| value | integer | M | 1:10 | Numeric value of the measure | 10 |
| unit | string enum | M | PRS, NO, PCS, PC, UNT, GR, K, PK, EA, PKG, DOZ | Unit of Measure for quantity | PCS |
| itemValue | object | M | Item value | ||
| value | float | M | 1:10 | Monetary value | 10.23 |
| currency | string | M | 3 | Currency name based on ISO 4217 3 character currency codes | USD |
| itemFreight | object | M | Monetary value | 2 | |
| value | float | M | 1:10 | Monetary value | 10.23 |
| currency | string | M | 3 | Currency name based on ISO 4217 3 character currency codes | USD |
| itemInsurance | object | M | Monetary value | 25 | |
| value | float | M | 1:10 | Monetary value | 10.23 |
| currency | string | M | 3 | Currency name based on ISO 4217 3 character currency codes | USD |
| width | object | O | Width of the item | ||
| value | float | M | 1:10 | Numeric value of the measure | 20 |
| unit | string enum | M | MM, IN, CM, IN, FT | The unit of measure to be used with the value | CM |
| length | object | O | Length of the item | ||
| value | float | M | 1:10 | Numeric value of the measure | 20 |
| unit | string enum | M | MM, IN, CM, IN, FT | The unit of measure to be used with the value | CM |
| height | object | O | Height of the item | ||
| value | float | M | 1:10 | Numeric value of the measure | 20 |
| unit | string enum | M | MM, IN, CM, IN, FT | The unit of measure to be used with the value | CM |
| weight | object | O | Weight of the item | ||
| value | float | M | 1:10 | Numeric value of the measure | 2 |
| unit | string enum | M | KGND, T, LB, G, OZ, KG | The unit of measure to be used with the value | KG |
| volume | object | O | Volume of the item | ||
| value | float | M | 1:10 | Numeric value of the measure | 0.25 |
| unit | string enum | M | KM3, WG, HLT, KL, GAL, M3, CM3, IMPERIAL_GALLON, L, DAL, ML | The unit of measure to be used with the value | M3 |
| area | object | O | Area of the item | ||
| value | float | M | 1:10 | Numeric value of the measure | 2 |
| unit | string enum | M | M2, FT2 | The unit of measure to be used with the value | M2 |
| tax | array | O | Provide tax information that's already included in the item | ||
| included | boolean | M | true, false | Whether tax was included | true |
| percent | float | M | 0:99999999.99 | Percent tax included | 20 |
| return | boolean | O | true, false | Whether tax should be returned in the response | true |
M- Mandatory O- Optional C- Conditional N- Not Applicable
| Node | Data Type | Required | Length | Description | Example |
| quoteId | string | M | 36 | Unique ID for the quote | 84a135e9-2505-4331-9c5f-0c4532d5f051 |
| pickupAccount | string | M | 1:30 | DHL eCommerce pickup account number. For 7-digit pickups, add 3 leading zeroes. | 0005337574 |
| itemSeller | string | M | 1:100 | Store URL | mystore.com |
| pricingStrategy | string enum | M | MINIMUM, MAXIMUM, AVERAGE, EXACT | Pricing 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 |
| feeTotals | array | M | Calculated total fees | ||
| name | string | M | 1:20 | Name of fee | DUTY |
| currency | string | M | 3 | Currency of fee. 3-letter ISO currency code. See References for allowed values. | USD |
| value | float | M | 1:20 | Value of the fee | 2.00 |
| consigneeAddress | object | M | Address of the consignee | ||
| state | string | O | 0:20 | Country 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 |
| country | string | M | 2 | Two 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 |
| senderAddress | object | M | Address of the sender | ||
| state | string | O | 0:20 | Country State, Province, or Territory. | GA |
| country | string | M | 2 | Two letter ISO country code of the sender Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries. | US |
| packageDetails | object | M | Package l | ||
| freightCharge | object | M | Freight charges for the package | ||
| value | float | M | 1:10 | Monetary value | 10.23 |
| currency | string | M | 3 | Currency name based on ISO 4217 3 character currency codes. See References for allowed values. | USD |
| insuranceCharge | object | M | Insurance charges for the package | ||
| value | float | M | 0:50 | Monetary value | 10.23 |
| currency | string | M | 0:20 | Currency name based on ISO 4217 3 character currency codes. See References for allowed values. | USD |
| tax | array | O | 0:99999999.99 | Provide tax information that's already included in the shipment | |
| included | boolean | M | true, false | Whether tax was included | true |
| percent | float | M | Percent tax included | 20 | |
| return | boolean | O | true, false | Whether tax should be returned in the response | true |
| outputCurrency | string | M | 3 | Currency in which the calculated fees should be output. based on ISO 4217 3 character currency codes. See References for allowed values. | USD |
| clearanceMode | string enum | M | POST, COURIER, N/A | Clearance Mode for the Package | COURIER |
| transportMode | string enum | O | OCEAN, GROUND, AIR, N/A | Transport Mode for the Package | AIR |
| endUse | string enum | M | PERSONAL, GIFTS, BUSINESS, N/A | End use for the Package | PERSONAL |
| packageFees | array | M | Package level fees | ||
| name | string | O | 0:20 | Name of fee | DUTY |
| currency | string | O | 3 | Currency name based on ISO 4217 3 character currency codes | USD |
| value | float | O | 0:20 | Monetary value | 2.00 |
| customeDetails | array | M | Customs Details of each item present in the package | ||
| itemId | string | M | 1:50 | Item ID for the item | 34-49832044 |
| hsCode | string | O | 0:20 | HS Classification Code for the Item | 12.01.10 |
| hsCodeApplied | string | M | 1:20 | HS Classification Code used by the Quote engine. Can be different from hsCode | 12.01.00 |
| skuNumber | string | O | 0:50 | SKU Number for the item | ASFD-232 |
| productIdentifiers | object | O | Product Identifiers | ||
| upc | string | O | 12:12 | Universal Product Code assigned to the product. Used for auto-classification purposes only. | 123456789101 |
| ean | string | O | 8:13 | European Article Number assigned to the product. Used for auto-classification purposes only. | 88888888 |
| jan | string | O | 13:13 | Japanese Article Number assigned to the product. Used for auto-classification purposes only. | 1234567890123 |
| isbn | string | O | 10:13 | International Standard Book Number assigned to a book. Used for auto-classification purposes only. | 1234567890 |
| mpn | string | O | 1:50 | Manufacturer Part Number assigned to the product. Used for auto-classification purposes only. | ABCDEFGH |
| brand | string | O | 1:50 | Brand name of the product. Used for auto-classification purposes only. | ABCDEFGHIJKLMNOPQRS |
| productCategory | string | O | 0:50 | Product Category | APPAREL |
| itemShortDescription | string | O | 0:75 | Item Short description | MENS SHIRTS |
| itemDescription | string | O | 0:200 | Item Full description | MENS FULL SLEEVE BUTTON DOWN SHIRTS |
| size | string | O | 0:10 | Size of the item (not the dimensions) | 10 |
| gender | string enum | O | MALE, FEMALE, UNISEX | Applicable Gender for the item | 12 |
| ageGroup | string enum | O | NEWBORN, TODDLER, INFANT, KIDS, ADULT | Applicable Age Group for the item | ADULT |
| color | string | O | 0:10 | Color of the item | BLUE |
| style | string | O | 0:20 | Style of the item | MENS SHIRTS |
| composition | string | O | 0:999 | Composition of the item. | [COTTON,POLYESTER] |
| condition | string enum | O | NEW, USED, REFURBISHED, ANTIQUE | Condition of the item | NEW |
| countryOfOrigin | string | O | 2 | Two letter ISO country code of the origin Country. Based on the ISO 3166-1 alpha 2 standard. See Reference for allowed countries. | CN |
| qualifiesForPreferentialTarrifs | boolean | M | true, false | Whether the item qualifies for preferential tariffs. Default is false. | true |
| itemQuantity | object | M | Quantity of the item | ||
| value | integer | M | 1:10 | Numeric value of the measure | 10 |
| unit | string enum | M | PRS, NO, PCS, PC, UNT, GR, K, PK, EA, PKG, DOZ | Unit of Measure for quantity | PCS |
| itemValue | object | M | Item value | ||
| value | float | M | 1:10 | Monetary value | 10.23 |
| currency | string | M | 3 | Currency name based on ISO 4217 3 character currency codes | USD |
| itemInsurance | object | M | Monetary value | 25 | |
| value | float | M | 1:10 | Monetary value | 10.23 |
| currency | string | M | 3 | Currency name based on ISO 4217 3 character currency codes | US |
| width | object | O | Width of the item | ||
| unit | string enum | M | MM, IN, CM, IN, FT | The unit of measure to be used with the value | CM |
| value | float | M | 1:10 | Numeric value of the measure | 20 |
| length | object | O | Length of the item | ||
| unit | string enum | M | MM, IN, CM, IN, FT | The unit of measure to be used with the value | CM |
| value | float | M | 1:10 | Numeric value of the measure | 20 |
| height | object | O | Height of the item | ||
| unit | string enum | M | MM, IN, CM, IN, FT | The unit of measure to be used with the value | CM |
| value | float | M | 1:10 | Numeric value of the measure | 20 |
| weight | object | O | Weight of the item | ||
| unit | string enum | M | KGND, T, LB, G, OZ, KG | The unit of measure to be used with the value | KG |
| value | float | M | 1:10 | Numeric value of the measure | 2 |
| volume | object | O | Volume of the item | ||
| unit | string enum | M | KM3, WG, HLT, KL, GAL, M3, CM3, IMPERIAL_GALLON, L, DAL, ML | The unit of measure to be used with the value | M3 |
| value | float | M | 1:10 | Numeric value of the measure | 0.25 |
| area | object | O | Area of the item | ||
| unit | string enum | M | M2, FT2 | The unit of measure to be used with the value | M2 |
| value | float | M | 1:10 | Numeric value of the measure | 2 |
| tax | array | O | Provide tax information that's already included in the item | ||
| included | boolean | M | true, false | Whether tax was included | true |
| percent | float | M | 0:99999999.99 | Percent tax included | 20 |
| return | boolean | O | true, false | Whether tax should be returned in the response | true |
| itemFees | object | M | Item level fees | ||
| name | string | M | 1:20 | Name of fee | DUTY |
| currency | string | M | 1:3 | Currency name based on ISO 4217 3 character currency codes | USD |
| value | float | M | 1:20 | Monetary value | 2.00 |
| info | array | O | Object that will contain additional information where applicable | ||
| message | string | O | 1:999999 | Related message | Deminimis 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. |
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" } } ] }
pickupAccountanditemSellerare mandatory to identify the clientsenderAddress/countryandconsigneeAddress/countryare mandatory as duty calculation is mainly driven by where it's shipped from and where it's shipped tooutputCurrencydetermines 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.itemIdis required to identify the itemitemQuantityanditemValueis 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.
feeTotalspackageFeesitemFees
Each of these will have the following elements -
name- name of the feecurrency- currency of the feevalue- 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.
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.:
currencyvalue in invalid,pickupAccountis invalid, itemSeller is invalid,pricingStrategyvalue 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.
{
"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
}
}
]
}