Request CBDS Quotes for all Items in a Shopping Cart

HTTP Request

POST /v1/crossborder/checkout/quotes

Summary

This operation integrates with Pitney Bowes Cross-Border Delivery Service (CBDS) to provide an estimate of the duties, taxes, and transportation costs for each item in a buyer’s online shopping cart. The API returns quotes for all eligible items. If an item in the cart is ineligible—for example if an item is oversized—the API returns quotes for all eligible items and returns an item-specific error for the ineligible item.

CBDS estimates costs based on the destination address, the service level, and the item details. The more details provided in the API request, the more accurate is the estimate. The quotes are estimates and not guarantees.

For supported countries and services, see the Shipping Lanes for the Consolidation Center.

Prerequisites

  1. You must contact Pitney Bowes and request to be enabled to use this API. Contact Client Services Tech Support at ClientServicesTechSupport@pb.com.

  2. This API uses the commodity’s HS Code for tariff classification. Pitney Bowes provides two options for supplying an HS Code:

    • Provide the HS Code in the API request’s basketItems.hSTariffCode field whenever you issue this API call. If you choose this option, you must always provide an HS Code when invoking this API.

      Example:

      "basketItems": [ {
          "hSTariffCode": "4203100001",
          ...
      } ]
      
    • If will not be able to provide an HS Code every time you issue this API call, then you must provide Pitney Bowes a category tree before you first use this API. Pitney Bowes will use the category tree to assign HS Codes. If you do not have a category tree, Pitney Bowes can provide one.

Things to Consider

  1. The toAddress requires only the countryCode field (unless the destination is in Canada), but Pitney Bowes recommends including the full address for the most accurate quotes.

    For Canadian destinations, the toAddress also requires the postalCode and stateProvince fields.

  2. The fromAddress is optional but if specified in the request, it must include the following:

    • addressLines
    • cityTown
    • postalCode
    • countryCode
  3. If the merchant is also a PB Standard fulfillment or delivery customer, include the merchant’s PB Standard Client ID as the CLIENT_ID in the shipmentOptions array.

  4. The Quotes API’s response object is different from request object. The response object does not return all the elements passed in the request object.

  5. The Quotes API can return a successful response even if there are errors with one or more items in the shopping cart.

  6. If there is an error with an item in the shipping cart, the response body returns the error in the unitErrors or LineErrors field. An item would return an error if, for example, it were missing mandatory information or had restrictions.

  7. If an item is found to be restricted, the API returns error 1006009 for the item and returns the restriction information in the additionalInfo field. The API still returns quotes for remaining items in the cart.

Request URIs

Sandbox: https://api-sandbox.pitneybowes.com/shippingservices/v1/crossborder/checkout/quotes
Production: https://api.pitneybowes.com/shippingservices/v1/crossborder/checkout/quotes

Request Headers

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 application/json.
Accept-Language Language and country code. Default: en-US
X-PB-TransactionId A unique identifier for the transaction, up to 25 characters.

Note: This operation returns errors using the standard error object, and therefore it is not necessary to include the X-PB-UnifiedErrorStructure header in the API request.


Request Elements

Name
Data Type Description
quoteCurrency String Required. The currency to return the quotes in. Enter the currency of your (the developer’s) country. Use three uppercase letters, per ISO 4217. For example, use USD for US Dollars, use CAD for Canadian Dollars, use GDP for the Pound Sterling, and use EUR for Euros. For all currency codes, see https://www.iso.org/iso-4217-currency-codes.html.
basketCurrency String Required. The default currency of the shopping cart. Enter the currency of your (the developer’s) country. Use three uppercase letters, per ISO 4217. For example, for US Dollars use USD. For all currency codes, see https://www.iso.org/iso-4217-currency-codes.html.
fromAddress Address Object The origin address. Pitney Bowes recommends that you include this information to get more accurate quotes. The object requires following fields, as noted above in Things to Consider: addressLines, cityTown, postalCode, and countryCode.
toAddress Address Object Required. Destination address. This object requires only the countryCode field, except for Canadian destinations, which also require the postalCode and stateProvince fields. However, Pitney Bowes recommends that you include the full address to get more accurate quotes.
customsInfo Customs Info Object Customs clearance information.
basketItems Array[Custom Items Object] Required. The items in the buyer’s shopping cart. Each object in the array specifies a different item.
rates Array[Rates Object] Required. Specifies the carrier, service, parcel, and other information. In a response, this field also contains the service charges.
shipmentOptions Array[Object] Any shipment options to be applied. Each object in this array defines a different option.
        name String The name of the shipment option. The shipmentOptions array requires this field.
        value String The value of the shipment option. The shipmentOptions array requires this field.

Request Elements: Basket Items

The basketItems array takes the Customs Items Object. The following table describes all possible fields in the object. Fields that apply to CBDS are marked CBDS.

The table lists fields alphabetically.

Name
Data Type
Applies to these Carriers
Description
brand String CBDS The manufacturer’s brand name for the item. The maximum length is 255 characters.
categories Array[Categories Object] CBDS

Associated categories. The merchant’s category tree must have been provided to Pitney Bowes in advance. Do not use this array if the merchant did not provide a category tree.

Required for the HS Code API.

condition String CBDS

Condition of the commodity. If the merchant is using an eBay-specific category tree, enter the eBay item’s conditionId. Otherwise use one of the following values:

  • new
  • used
  • refurbished
  • damaged
  • unknown
description String USPS
CBDS
FedEx
UPS

Required. A detailed description of the commodity.

For CBDS, make the description as detailed as possible to facilitate assignment of the correct HS Code.

eccn String CBDS The Export Control Classification Number (ECCN) for the commodity. The maximum length is 10 characters.
hazmats Array[String] CBDS For a HAZMAT-flagged item, enter one or more of the HAZMAT classifications listed here.
hSTariffCode String USPS
CBDS
FedEx
UPS

The destination country’s tariff-classification number for the commodity. Most countries use the six-digit Harmonized System (HS) as the basis for their tariff classifications and add additional digits for more detail. The maximum length is 14 characters.

If you are issuing the HS Code API, you can use this field to help with the HS Code prediction by entering the commodity’s HS Code from another country, such as from the origin country. Enter the country that the code comes from in the hSTariffCodeCountry field.

Required by the CBDS Quotes API.

hSTariffCodeCountry String CBDS

The two-character ISO Country Code for the country supplying the HS Code. This is usually the destination country.

Required for a CBDS API call if the hSTariffCode field is used.

identifiers Array[Object] CBDS Additional identifiers for the item. Each object in the array defines a type of identifier and its value.
      source String CBDS The type of identifier, such as MPN, SKU, UPC, ISBN, or ISSN. Enter the identifier as a String of up to 10 characters. This field is required in the array object.
      number String CBDS The value of the identifier. Enter a String of up to 50 characters. This field is required in the array object.
imageURL Array[String] CBDS Enter one or more URLs that link to an image of the commodity. Enter the URLs as Strings, separated by commas.
itemDimension Object CBDS The dimensions for a single item.
      length BigDecimal CBDS The longest dimension. This field is required by the itemDimension object.
      height BigDecimal CBDS The second longest dimension. This field is required by the itemDimension object.
      width BigDecimal CBDS The shortest dimension. This field is required by the itemDimension object.
      unitOfMeasurement String CBDS

The unit of measurement. This field is required by the itemDimension object. Valid values are:

  • IN: Inches
  • FT: Feet
  • YD: Yards
  • CM: Centimeters
  • M: Meters
itemId String CBDS Required by CBDS. The merchant’s unique identifier for the commodity, such as the SKU. The maximum length is 50 characters.
manufacturer String CBDS The manufacturer of the item. The maximum length is 255 characters.
netCostMethod String UPS  
originCountryCode String USPS
CBDS
FedEx
UPS
The two-character ISO country code of the shipment’s origin country. Use ISO 3166-1 alpha-2 standard values.
originStateProvince String UPS  
preferenceCriterion String UPS  
pricing Object CBDS The pricing information for the commodity. If the information is not in the shopping cart, then this information is used.
      price BigDecimal CBDS List price of the item.
producerAddress Address Object UPS  
producerDetermination String UPS  
producerId String UPS  
quantity Integer USPS
CBDS
FedEx
UPS

Required, except for the HS Code API. Enter the total number of items of this type of commodity. For USPS, the number of items cannot exceed 9999. USPS limits the number of items of one commodity to 9999.

Note: This field is optional for the HS Code API.

quantityUOM String UPS  
unitPrice BigDecimal USPS
CBDS
FedEx
UPS
Required. The price of one item of this type of commodity.
unitWeight Object USPS
CBDS
FedEx
UPS
Required for all international shipments, except CBDS shipments. The weight and unit of measure of one item of the commodity. Note: For CBDS, this field is optional.
      weight Number USPS
CBDS
FedEx
UPS
The weight of the item. This field is required by the unitWeight object.
      unitOfMeasurement String USPS
CBDS
FedEx
UPS

The unit of measurement. This field is required by the unitWeight object. If the carrier is USPS, set this to OZ. This field can take the following values:

  • OZ: Ounces
  • GM: Grams
  • G: Grams. Available only for CBDS
  • LB: Pounds. Available only for CBDS
  • KG: Kilograms. Available only for CBDS
url String CBDS Recommended for CBDS. The commodity’s URL on the merchant’s site. Ensure the URL works. Providing an accurate URL helps Pitney Bowes assign the correct HS Code. The maximum length for this field is 1000 characters.


Response Elements

Name
Data Type Description
quote Array[CBDS Quote Object] The quotes. The array contains a quote for each available shipping method requested. Each object in the array is a separate quote.

Response Elements: CBDS Quote Object

Name
Data Type Description
errors Array[Error Object] Any quote-level errors.
quoteCurrency String The currency of the quote, returned as a three-character code per ISO 4217. For possible codes, see https://www.iso.org/iso-4217-currency-codes.html.
transactionId String The transaction ID supplied by the client as part of the X-PB-TransactionId header. Used for tracking the transaction.
pbTransactionId String A unique Pitney Bowes generated identifier used for tracking the transaction.
quoteLines Array[Object] The line-level detail of the quote. The lines are returned in the same order as the items are listed in the request’s basketItems array.
        lineId String The unique identifier for the line within the input basket. Maximum 50 characters.
        itemId String The merchant’s unique identifier for the commodity. Maximum 50 characters.
        quoteLineId String The unique identifier for the line within the quoteLines object. Maximum 50 characters.
        quantity Number The number of items of this commodity.
        unitRates Rates Object The international Transportation and Importation costs for one commodity.
        lineRates Rates Object Each of the elements of the unitRates multiplied by quantity.
        lineErrors Array[Error Object] Any errors on the quantity of the commodities on the line.
        unitErrors Array[Error Object] Any errors on the individual commodity.
totalPrice BigDecimal The total value of the commodities, returned in the currency listed in quoteCurrency.
totalRates Rates Object The rates for every requested service level.

Sample Request

See the following examples:

Sample CBDS Quotes Request

curl -X POST .../v1/crossborder/checkout/quotes \
-H "Authorization: Bearer olVCndjE5lFnQkXaNKHYwQajz8qB" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: 774318678" \
-d '
{
    "quoteCurrency": "USD",
    "basketCurrency": "USD",
    "fromAddress": {
        "addressLines": [ "2935 Lorne Avenue" ],
        "cityTown": "Saskatoon",
        "postalCode": "S7J 0S5",
        "countryCode": "CN"
    },
    "toAddress": {
        "countryCode": "US"
    },
    "customsInfo":{
        "currencyCode": "USD",
        "businessType": "B2C",
        "firstMileShippingAmount": 1.12,
        "firstMileInsuredAmount": 0.42,
        "shippingAmount": 4.12,
        "insuredAmount": 1.00,
        "customsDeclaredValue": 90.00
    },
    "basketItems": [ {
        "Attributes": {
            "type": "material",
            "name": "fabric",
            "value": "cotton"
        },
        "brand": "Acme Brand",
        "categories": [ {
            "categoryCode": "UNKNOWN",
            "parentCategoryCode": "6500",
            "descriptions": [ {
                "locale": "en_US",
                "name": "Shirts",
                "parentsNames": [ "Clothing", "Men" ]
            } ],
            "categoryNamePath": "Clothing|Men|Shirts",
            "categoryCodePath": "3400:6500:4356"
        } ],
        "condition": "new",
        "description": "clothing men shirt casual button-down slim fit cotton wrinkle-free single-needle construction",
        "eccn": "EAR99",
        "hSTariffCode": "6203221000",
        "hSTariffCodeCountry": "US",
        "identifiers": [ {
            "number": "841843",
            "source": "MPN"
        } ],
        "imageURL": [
            "http://www.example.com/shop/43953AE0/image01.png"
        ],
        "itemId": "43953AE0",
        "itemDimension": {
            "length": 14.0,
            "height": 10.0,
            "width": 4.0,
            "unitOfMeasurement": "IN"
        },
        "longDescription": "clothing men shirt casual button-down slim fit cotton wrinkle-free single-needle construction",
        "manufacturer": "Acme Inc.",
        "originCountryCode": "US",
        "quantity": 2,
        "unitPrice": 45.00,
        "unitWeight": {
            "weight": 12,
            "unitOfMeasurement": "OZ"
        },
        "url": "http://www.example.com/shop/43953AE0"
    } ],
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBXPS"
    } ],
    "shipmentOptions": [ {
        "name": "CLIENT_ID",
        "value": "01200340"
    },{
        "name": "CARRIER_FACILITY_ID",
        "value": "12349876"
    } ]
}'

Sample CBDS Quotes Response

{
    "quote": [ {
        "quoteCurrency": "USD",
        "transactionId": "774318678",
        "pbTransactionId": "5bb4d0e3-afde-46a5-922e-66256fc24c6c",
        "quoteLines": [ {
            "lineId": "1",
            "itemId": "43953AE0",
            "quoteLineId": "1",
            "quantity": 2,
            "unitRates": {
                "unitPrice": 45,
                "totalTaxAmount": 3.12,
                "totalDutyAmount": 0,
                "serviceId": "PBXPS",
                "baseCharge": 5.62,
                "deliveryCommitment": {},
                "totalCarrierCharge": 11.74
            },
            "lineRates": {
                "linePrice": 90,
                "totalTaxAmount": 6.24,
                "totalDutyAmount": 0,
                "serviceId": "PBXPS",
                "baseCharge": 11.24,
                "deliveryCommitment": {},
                "totalCarrierCharge": 17.48
            }
        } ],
        "totalPrice": 90,
        "totalRates": {
            "serviceId": "PBXPS",
            "baseCharge": 0,
            "deliveryCommitment": {},
            "totalCarrierCharge": 0,
            "totalDutyAmount": 0,
            "totalTaxAmount": 0
        }
    } ]
}

Sample CBDS Quotes Response with Errors

{
    "quote": [ {
        "quoteCurrency": "USD",
        "quoteLines": [ {
            "lineId": "1",
            "merchantComRefId": "13MS-1234567",
            "quantity": 1,
            "unitErrors": [ {
                "error": 1006012,
                "message": "Categories associated with the commodity are not available for quoting"
            } ]
        } ],
        "errors": [ {
            "error": 1005011,
            "message": "There are errors at the Quote Item Level"
        } ]
    } ]
}

Error Codes

This operation returns errors using the standard error object and returns the following errors. For all error codes returned by the PB Shipping APIs, see Error Codes.

1005### - Quote Level Error Codes

Error Code
Error Description  
1005001 The address is invalid.  
1005002 The consignee information is invalid.  
1005003 The COP transportation information is invalid.  
1005004 The requested return currency is invalid.  
1005005 The request currency is not supported for the target country.  
1005006 The order cannot be shipped by the method selected.  
1005007 The order value has exceeded the allowed value.  
1005010 There are errors at the Quote Line Level  
1005011 There are errors at the Quote Item Level  
1005013 The address has missing fields  
1005014 Missing fields in basket  
1005015 Invalid fields in basket  
1005016 The consignee information is missing  
1005017 The COP transportation information is missing  
1005018 Shipping Speed or service unavailable  
1005019 Missing Basket  
1005020 Missing Parcel Fields  
1005021 Missing fields in the basket commodity source  
1005022 Seller has missing fields  
1005023 Seller has invalid fields  
1005103 Invalid/Missing User Id.  
1005555 Fedex Rating is not responding at this moment. Please try again later SOLUTION

1006### - Unit Errors

The following errors are returned in the quote.quoteLines.unitErrors array.

Error Code
Error Description  
1006001 The commodity is invalid  
1006002 The commodity is too large to ship (length, width or height)  
1006004 The commodity has a negative price  
1006005 The commodity’s price was too low and did not have a dutiable value.  
1006006 The item price exceeds maximum  
1006007 Item weight exceeds maximum  
1006009 The Commodity is restricted for this Country of Destination  
1006010 Commodity cannot be quoted.  
1006012 Categories associated with the commodity are not available for quoting  
1006013 Categories associated with the commodity are restricted for this country of destination  
1006014 Category associated with commodity is invalid  

1007### - Line Errors

The following errors are returned in the quote.quoteLines.lineErrors array.

Error Code
Error Description  
1007001 Order value exceeded on this line  
1007003 The quantity is invalid or missing  
1007006 Missing fields in basket line  
1007007 Invalid fields in basket line  
1007123 Invalid/Missing Password.  

PB-APIM-ERR Errors

This operation can return PB-APIM-ERR-#### errors:

Error Code Error Description  
PB-APIM-ERR-0401 Invalid client ID or secret  
PB-APIM-ERR-0402 Invalid Subscription Id  
PB-APIM-ERR-0403 Developer App is not enriched with DOMAIN_INFO SOLUTION
  Developer App is not enriched with METER_POOL  
  Invalid ProductId Attribute value  
  Invalid SHIPPER_RATE_PLAN SOLUTION
  User exceeded configured monetization limits  
PB-APIM-ERR-0404 User not allowed to access the requested resource SOLUTION
PB-APIM-ERR-1000 GCS Domain Info: Invalid JSON  
  Internal Error Occurred SOLUTION
PB-APIM-ERR-1002 Invalid Access Token SOLUTION
PB-APIM-ERR-1003 Access Token Expired  
PB-APIM-ERR-1004 Invalid API Call SOLUTION
PB-APIM-ERR-1005 Invalid or Missing Client Credentials  
PB-APIM-ERR-1006 Spike arrest violation SOLUTION
  X-PB-IntegratorId Not Found  
PB-APIM-ERR-1008    
PB-APIM-ERR-1010 The Service is temporarily unavailable  
PB-APIM-ERR-1404 Invalid or missing resource  
PB-APIM-ERR-1500 Quota limit exceeded.  
PB-APIM-ERR-4001 X-PB-TransactionId Length cannot be greater than 25 chars  
PB-APIM-ERR-4002 X-PB-TransactionId is missing