Retrieve the Predicted HS Code¶
HTTP Request¶
POST /v1/crossborder/hs-classification/items
Summary¶
This operation predicts the HS code for a parcel being shipped internationally and gives the level of confidence in the prediction.
Considerations¶
To use this API, the merchant must have provided a category tree to Pitney Bowes when onboarding with CBDS.
You can supply the HS code from another country to help with the prediction. To do so, include the following fields in the request:
item.hSTariffCode
: Set this to the HS code that another country uses for the commodity.item.hSTariffCodeCountry
: Set this to the country code of that country.
Request URLs¶
Sandbox: https://shipping-api-sandbox.pitneybowes.com/shippingservices/v1/crossborder/hs-classification/items
Production: https://shipping-api.pitneybowes.com/shippingservices/v1/crossborder/hs-classification/items
Request Header¶
Name |
Description |
---|---|
Authorization |
Required. OAuth token generated using the Generate an OAuth Token API. |
Content-Type |
Required. The media type of the request entity. Set this to |
X-PB-TransactionId |
Required. A unique identifier for the transaction, up to 25 characters. The following characters are allowed: letters, numbers, hyphens ( Important: Ensure this is a unique ID. |
Request Elements¶
Name |
Data Type |
Description |
---|---|---|
fromCountry |
String |
Required. The origin country for the shipment. |
toCountry |
String |
Required. The destination country for the shipment. |
customsInfo |
Object |
Required. |
customsInfo.currencyCode |
String |
Required. The type of currency referenced in the piece price. Use three uppercase letters, per ISO 4217. For example, use |
item |
Required. The item details used for classification. The following fields in the Customs Items Object are required:
|
|
shipmentOptions |
Array[Object] |
Required. Specifies the merchant’s CBDS Client ID. Pitney Bowes provided this ID when the merchant onboarded to use CBDS. |
shipmentOptions.name |
String |
Required. Set this to |
shipmentOptions.value |
String |
Required. Set this to the merchant’s CBDS Client ID. Pitney Bowes assigns the merchant the Client ID when the merchant onboards with CBDS. |
Response Elements¶
Name |
Data Type |
Description |
---|---|---|
classificationResult |
Object |
An object containing the predicted HS code and the level of confidence in the prediction. |
classificationResult.
|
String |
The predicted HS code for the item. |
classificationResult.
|
String |
The level of confidence in the prediction. Possible values:
|
classificationResult.
|
String |
The unique identifier supplied in the |
classificationResult.
|
String |
A Pitney Bowes-generated identifier for tracking the transaction. |
Sample Request¶
curl -X POST .../v1/crossborder/hs-classification/items \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: 49612270" \
-d '
{
"fromCountry": "CN",
"toCountry": "US",
"customsInfo": {
"currencyCode": "USD"
},
"item": {
"categories": [ {
"categoryCode": "CATEGORY_0345",
"categoryNamePath": "Apparel|Sportswear|Hiking",
"categoryCodePath": "CATEGORY_0009:CATEGORY_0055:CATEGORY_0345"
} ],
"description": "Men's Gore-Tex Ultralight Packable Windproof Insect Shield Jacket",
"itemId": "G_123456",
"unitPrice": 120.00,
"url": "http://www.example.com/shop/jackets/G_123456"
},
"shipmentOptions": [ {
"name": "CLIENT_ID",
"value": "ABCD
} ]
}'
Sample Response¶
{
"classificationResult": {
"hscode": "6201935220",
"qualityLevel": "MEDIUM",
"transactionId": "49612270",
"pbTransactionId": "d4f4ffb6-c518-4ad1-843b-5212b688be6c"
}
}
Error Codes¶
The HS Code API returns 70-Prefix Error Codes (Retrieve HS Code API).
For a list of all error codes returned by the Ecommerce APIs, please see Error Codes.