Create a CBDS Return Shipment

HTTP Request

POST /v1/shipments?carrier=PBI&includeDeliveryCommitment=true

Summary

This operation creates a CBDS Return. The operation prints a first-mile label for delivery from the local depot to a CBDS Hub. CBDS currently supports returns from Canada to the U.S.

Prerequisite

To use this operation, a merchant must be enabled for CBDS Returns. To request enablement, merchants should contact their Pitney Bowes implementation managers or email their requests to either ClientSupportTechServices@pb.com or ShippingAPIBusinessDevelopment@pb.com.

Considerations

  1. You cannot use the Rates API with CBDS Returns.

  2. If the seller’s address is different from the toAddress, enter the seller’s address in the additionalAddresses field.

  3. The address objects (fromAddress, toAddress, additionalAddresses) require the following fields:

    • addressLines

    • cityTown

    • postalCode

    • countryCode

    • company: Required only in toAddress and additionalAddresses.

    • name

  4. The rates object requires the following fields and values:

    Field

    Value

    carrier

    PBI

    serviceId

    One of the following:

    • PBXRCS: Return Standard Consolidated

    • PBXRS: Return Standard Per Piece

    parcelType

    PKG

  5. The documents object requires the following fields and values:

    Field

    Value

    type

    SHIPPING_LABEL

    size

    DOC_4X6

    fileFormat

    PDF

    contentType

    URL

    printDialogOption

    NO_PRINT_DIALOG

    Note: If the label size is not supported by the domestic carrier, the API will return the best-matched label size.

  6. In the shipmentOptions array, set the following shipment options:

    Field

    Value

    SHIPPER_ID

    Required. The merchant’s Shipper ID, which is found in the postalReportingNumber field returned by the Get Merchants API.

    CLIENT_ID

    Conditional. The merchant’s ID for access to CBDS. Contact your PB implementation manager to find out if this is required.

    CONTENT_VERIFICATION

    Recommended. Indicates whether the contents of the parcel should be verified. Takes a value of true or false.

    PRINT_RETURN_PACKSLIP

    Recommended. Indicates whether the packing slip should be printed. Takes a value of true or false.

    RETURN_DISPOSITION

    Recommended. Indicates the disposition of the parcel. Set this to RETURN_TO_SELLER.

    RETURN_REASON

    Recommended. The reason for the return. Enter up to 100 characters.

  7. The customs.customsInfo object requires the following fields:

    Field

    Value

    currencyCode

    Set this to: USD

    portOfClearance

    Enter the port of entry that was used to import the original shipment to the country of destination. Pass both the city and country. For example: Sarnia, CA

    importDate

    Enter date the original shipment was imported to the country of destination. Enter a string in the following format: YYYY-MM-DD

  8. The customs.customsItems array object requires the following fields. For field descriptions see Customs Items Object.

    • description

    • hSTariffCode

    • hSTariffCodeCountry

    • itemId

    • originCountryCode

    • quantity

    • unitPrice

    • url

  9. In the references array, define the following references and reference values:

    Name

    Value

    RMA_NUMBER

    Required. The Return Merchandise Authorization (RMA) number. The number cannot have spaces.

    ORDER_NUMBER

    Recommended. The merchant-generated order ID. The ID cannot have spaces.

    RETAILER_ORDER_NUMBER

    Recommended. The retailer-generated order ID.

    ORIGINAL_PARCEL_REFERENCE

    Recommended. The merchant-generated parcel reference number of the original shipment.

  10. Fuel charges are available as a downloadable spreadsheet. The following link downloads the most recent version of the spreadsheet:

    Download the Current Fuel Surcharge Spreadsheet

Request URLs

Sandbox: https://shipping-api-sandbox.pitneybowes.com/shippingservices/v1/shipments?carrier=PBI&includeDeliveryCommitment=true
Production: https://shipping-api.pitneybowes.com/shippingservices/v1/shipments?carrier=PBI&includeDeliveryCommitment=true

Query Parameter

Name

Description

carrier

Required. Set this to PBI.

includeDeliveryCommitment

Required. If set to true, returns estimated transit time. Transit times is returned as number of days.

Valid values:

  • true

  • false

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.

X-PB-TransactionId

Required. A unique identifier for the transaction, up to 25 characters. The following characters are allowed: letters, numbers, hyphens (-), and underscores (_).

Important: Ensure this is unique.

Request / Response Elements

This POST operation sends and receives the Shipment object, described here. Required fields are marked Required. All other fields are optional, with two exceptions: 1. Fields that are marked RESPONSE ONLY appear only in the response. 2. Fields that are marked as applying only to other label types do not apply to this one.

Name

Data Type

Description

shipmentType

String

Return Labels Only. For return labels, set this to RETURN.

  • Required: Expedited Returns, Standard Returns

  • Recommended: CBDS Returns

fromAddress

Address Object

Required. Origin address. If you want a different address to appear on the label from the one listed here, see this FAQ. The FAQ does not apply to PB Standard.

toAddress

Address Object

Required. Destination address.

If you are shipping to Puerto Rico or an international destination with FedEx or UPS, and if the importer is different from the final recipient, enter the address of the importer here in the toAddress object. For the address of the recipient, use the soldToAddress object. If the importer is the same as the final recipient, the toAddress and soldToAddress must match.

altReturnAddress

Address Object

For these carriers, sets an address for parcel returns:

  • PB Expedited: If you are sending an international shipment and if you have set the NON_DELIVERY_OPTION option to redirect, use this field to specify the address for a parcel return.

  • PB Presort

  • PMOD

  • CBDS Outbound & CBDS Domestic: By default, parcel returns are sent to a shipment’s fromAddress. (Parcel returns are sent from the CBDS Hub.) If the fromAddress is the wrong address for your returns, then you must use the altReturnAddress to enter the correct address for returns. Failure to do so will result returns to the wrong address.

  • FedEx

  • UPS

additionalAddresses

Array[Additional Addresses Object]

CBDS Returns Only. If the seller’s address is different from the toAddress, enter the seller’s address here.

Required if the toAddress and seller address are different.

parcel

Parcel Object

Required. Contains physical characteristics of the parcel.

rates

Array[Rates Object]

Required. Specifies the carrier, service, parcel, and other information. In a response, this field also contains the service charges.

Important: In a request, the rates array can contain only one rates object.

documents

Array[Documents Object]

Required, except as noted below. Defines the label, manifest, or other shipping document created by the API call. In a response, this array provides the URL or Base64 string for a document and in some cases can contain multiple objects.

This field does not apply to:
- Rate Parcel API.
- Create CBDS Shipment API if the merchant prints the first-mile label prior to invoking the API.

shipmentOptions

Array[Object]

Required. Each object in this array defines a shipment option. Specify each option as a name-value pair in the array.

The SHIPPER_ID option is required. For additional requirements for a carrier, see the Considerations section on the carrier’s Create Shipment page.

shipmentOptions.name

String

The name of the shipment option.

shipmentOptions.value

String

The value of the shipment option.

customs

Object

For shipments that use customs forms, this object contains the customs information.

Required in the following situations:

  • PB Expedited: Required for shipments to international destinations. Conditional for shipments to APO/FPO/DPO, U.S. Territories, and FAS, as explained in this FAQ.

  • CBDS: Required for all shipments.

  • FedEx: Required for shipments to international destinations and Puerto Rico.

  • UPS: Required for shipments to international destinations and Puerto Rico.

customs.customsInfo

Customs Info Object

Customs clearance information for the commercial invoice.

Required in the customs object.

customs.customsItems

Array[Customs Items Object]

Customs clearance information for each commodity.

Required in the customs object.

Maximum number of objects in the array: 30

domesticShipmentDetails

Domestic Shipment Details Object

CBDS Only. The first-mile label’s tracking number and other information about the first-mile leg.

Required if the merchant prints the first-mile label prior to invoking the API. Send the first-mile label’s tracking number and details.

RESPONSE ONLY for all other CBDS shipment requests.

references

Array[Object]

PB Standard & CBDS Only. Optional reference fields. Each object in the array includes a name-value pair that defines a reference field. See the following, depending on your carrier:

For carriers other than the above, see this FAQ.

hazmatDetails

Hazmat Details Object

PB Standard Only. If shipping hazardous materials with PB Standard, use this object.

carrierPayments

Array[Carrier Payments Object]

FedEx & UPS Only. If one or more of the shipment costs should be charged to a third-party account, enter the information in this array.

soldToAddress

Address Object

FedEx & UPS Only. The final recipient of a the shipment.

Required for shipments from the U.S. to Puerto Rico or international destinations. Otherwise optional.

This address must match the toAddress.countryCode, with the exception of shipments to Canada and to U.S. satellite countries.

If the final recipient’s address is the same as the importer’s address, the entries in the soldToAddress object must match the entries in the toAddress object.

shipmentId

String

RESPONSE ONLY. Unique identifier for the shipment, generated by the system in response to shipment purchase.

parcelTrackingNumber

String

RESPONSE ONLY. Tracking number assigned to the shipment by the system.

Sample Request

Sample Request for CBDS Returns
curl -X POST ".../v1/shipments?carrier=PBI&includeDeliveryCommitment=true" \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: <unique_transaction_id>" \
-d '
{
    "shipmentType": "RETURN",
    "fromAddress": {
        "name": "First Last",
        "addressLines": [
            "Street 1"
        ],
        "cityTown": "CITY",
        "stateProvince": "ON",
        "postalCode": "Postal 1",
        "countryCode": "CA"
    },
    "toAddress": {
        "name": "Retailer A",
        "addressLines": [
            "31st Avenue East"
        ],
        "cityTown": "Shelton",
        "stateProvince": "CT",
        "postalCode": "06618",
        "company": "Company Name",
        "countryCode": "US",
        "email": "retailerA@example.com",
        "phone": "12345678"
    },
    "additionalAddresses": [ {
        "addressType": "SELLER",
        "address": {
            "name": "Retailer A",
            "addressLines": [
                "31st Avenue East"
            ],
            "cityTown": "Shelton",
            "stateProvince": "CT",
            "postalCode": "06618",
            "company": "Company Name",
            "countryCode": "US",
            "email": "retailerA@example.com",
            "phone": "12345678"
        }
    } ],
    "parcel": {
        "weight": {
            "unitOfMeasurement": "Lb",
            "weight": "16"
        },
        "dimension": {
            "unitOfMeasurement": "in",
            "length": "5",
            "width": "2",
            "height": "3"
        },
        "currencyCode": "USD"
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBXRS",
        "parcelType": "PKG"
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "size": "DOC_4X6",
        "fileFormat": "PDF",
        "contentType": "URL",
        "printDialogOption": "NO_PRINT_DIALOG"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    },{
        "name": "CLIENT_ID",
        "value": "33999000"
    },{
        "name": "CONTENT_VERIFICATION",
        "value": "false"
    },{
        "name": "PRINT_RETURN_PACKSLIP",
        "value": "false"
    },{
        "name": "RETURN_DISPOSITION",
        "value": "RETURN_TO_SELLER"
    },{
        "name": "RETURN_REASON",
        "value": "[RETURN REASON]"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "USD",
            "portOfClearance": "Sarnia, CA",
            "importDate": "2022-08-01"
        },
        "customsItems": [ {
            "itemId": "commodity1",
            "description": "test123",
            "url": "www.test.com",
            "hSTariffCode": "610120",
            "hSTariffCodeCountry": "US",
            "originCountryCode": "US",
            "unitPrice": "500.00",
            "quantity": "1"
        } ]
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "MerchantOrder-1195"
    },{
        "name": "RETAILER_ORDER_NUMBER",
        "value": "1234567890"
    },{
        "name": "RMA_NUMBER",
        "value": "1234567877"
    },{
        "name": "ORIGINAL_PARCEL_REFERENCE",
        "value": "1234567899"
    } ]
}'
Sample Response
{
    "shipmentType": "RETURN",
    "fromAddress": {
        "name": "First Last",
        "addressLines": [
            "Street 1"
        ],
        "cityTown": "CITY",
        "stateProvince": "ON",
        "postalCode": "Postal 1",
        "countryCode": "CA"
    },
    "toAddress": {
        "name": "Retailer A",
        "addressLines": [
            "31st Avenue East"
        ],
        "cityTown": "Shelton",
        "stateProvince": "CT",
        "postalCode": "06618",
        "company": "Company Name",
        "countryCode": "US",
        "email": "retailerA@example.com",
        "phone": "12345678"
    },
    "additionalAddresses": [ {
        "addressType": "SELLER",
        "address": {
            "name": "Retailer A",
            "addressLines": [
                "31st Avenue East"
            ],
            "cityTown": "Shelton",
            "stateProvince": "CT",
            "postalCode": "06618",
            "company": "Company Name",
            "countryCode": "US",
            "email": "retailerA@example.com",
            "phone": "12345678"
        }
    } ],
    "parcel": {
        "weight": {
            "unitOfMeasurement": "Lb",
            "weight": "16"
        },
        "dimension": {
            "unitOfMeasurement": "in",
            "length": "5",
            "width": "2",
            "height": "3"
        },
        "currencyCode": "USD",
        "valueOfGoods": 801.76
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBXRS",
        "parcelType": "PKG",
        "baseCharge": 26.88,
        "totalCarrierCharge": 26.88,
        "deliveryCommitment": {
            "minEstimatedNumberOfDays": "6",
            "maxEstimatedNumberOfDays": "10"
        },
        "currencyCode": "USD",
        "destinationZone": 1.0
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "size": "DOC_4X6",
        "fileFormat": "PDF",
        "contentType": "URL",
        "printDialogOption": "NO_PRINT_DIALOG",
        "contents": "<url to pdf>"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    },{
        "name": "CLIENT_ID",
        "value": "33999000"
    },{
        "name": "CONTENT_VERIFICATION",
        "value": "true"
    },{
        "name": "PRINT_RETURN_PACKSLIP",
        "value": "true"
    },{
        "name": "RETURN_DISPOSITION",
        "value": "RETURN_TO_SELLER"
    },{
        "name": "RETURN_REASON",
        "value": "[RETURN REASON]"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "USD",
            "portOfClearance": "Sarnia, CA",
            "importDate": "2022-08-01"
        },
        "customsItems": [ {
            "itemId": "commodity1",
            "description": "test123",
            "url": "www.test.com",
            "hSTariffCode": "610120",
            "hSTariffCodeCountry": "US",
            "originCountryCode": "US",
            "unitPrice": "500.00",
            "quantity": "1"
        } ]
    },
    "domesticShipmentDetails": {
        "shipperTrackingNumber": "7624003CPC0000042004Z",
        "barCodeLabelNumber": "7624003CPC0000042004Z"
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "MerchantOrder-1195"
    },{
        "name": "RETAILER_ORDER_NUMBER",
        "value": "1234567890"
    },{
        "name": "RMA_NUMBER",
        "value": "1234567877"
    },{
        "name": "ORIGINAL_PARCEL_REFERENCE",
        "value": "1234567899"
    } ],
    "parcelTrackingNumber": "PBXGA001679CC18E3199",
    "shipmentId": "PBXGA001679CC18E3199"
}

Error Codes

For common error codes specific to this API call, please see 13-Prefix Error Codes.

For a list of all error codes returned by the Ecommerce APIs, please see Error Codes.