Create a CBDS Domestic Shipment

HTTP Request

POST /v1/shipments?carrier=PBI

Summary

Use this operation to ship with CBDS within Canada. This shipment is a post-paid shipment.

This page describes domestic shipping within Canada. CBDS also provides international outbound shipping and international inbound shipping.

Prerequisites

To use this API, the shipper must first onboard with CBDS.

Considerations

  1. This operation uses the Canada Domestic Delivery Solutions.

  2. You cannot use the Rates API with domestic Canadian shipments.

  3. The fromAddress and toAddress require the following fields:

    • addressLines

    • cityTown

    • stateProvince. Use the 2-letter province code.

    • postalCode. Required if the API returns a label. However, this field is always recommended.

    • countryCode

    • name

  4. In the rates object, set the following fields to the specified values:

    rates.carrier

    PBI

    rates.serviceId

    PBDS or PBDE

    rates.parcelType

    PKG

  5. In the documents object, set the label options, including the file format of the returned label. If the options you provide in the request are not supported by the domestic carrier, the API will return the best-matched options for that carrier. This means that if you set the file format to PDF, the API might instead return the PNG format, or vice versa.

  6. In the shipmentOptions array, SHIPPER_ID is required.

  7. In customs.customsInfo, set currencyCode to CAD.

    The API does not use the other fields in the customs.customsInfo object. If you pass them, they will be ignored.

  8. In customs.customsItems, set fields as required by the object.

    Note that while the customs.customsItems.url field is required, you can enter an empty String if you do not have a URL.

  9. If the API returns a label, the label must be used within 25 days.

Request URLs

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

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.

X-PB-UnifiedErrorStructure

Recommended. Set this to true to use the standard error object if an error occurs.

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

fromAddress

Address Object

Required. Origin address.

If you want a different address to appear on the label from the one listed here, see How do I print a return address that is different from the origin address?

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

PB Expedited and CBDS Only. Sets the address for parcel returns. Use this in the following situations:

  • 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.

  • CBDS: 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 enter the correct address will result in parcels being returned to the wrong address.

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 for the following carriers 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. When using the Customs Info Object, make sure to include the fields marked Required.

customs.customsItems

Array[Customs Items Object]

Customs clearance information for each commodity. When using the Customs Items Object, make sure to include the fields marked Required.

The maximum number of objects in this array is 30.

domesticShipmentDetails

Domestic Shipment Details Object

CBDS Only. The tracking number and other information about the first-mile leg of the shipment. This does not apply if the Create Shipment API prints the first-mile label.

Required if the merchant prints the first-mile label prior to invoking the Create Shipment API.

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.

shipmentType

String

Return Labels Only. For PB Expedited Return labels and PB Standard Return labels, set this to RETURN.

Required for rating and creating Expedited Returns, and for creating Standard Returns. Note that you cannot rate Standard Returns.

references

Array[Object]

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

To pass references for carriers other than the above, see How do I Add Reference Fields for My Carrier?

hazmatDetails

Hazmat Details Object

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

carrierPayments

Array[Shipment: Carrier Payments Object]

FedEx, UPS Only. Indicates that one or more of the shipment costs should be charged to a third-party account.

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 Requests

This section provides the following sample requests:

For this solution:


See this example:


Drop Off to Local Depot

Sample Request for Drop Off to Local Depot

Drop-Off to CBDS, with Final-Mile Label

Sample Request for Drop Off to CBDS, with Final-Mile Label

Sample Request for Drop Off to Local Depot

This request uses the Drop Off to Local Depot solution.

Sample Request to Drop Off to Local Depot
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 '
{
    "fromAddress": {
        "addressLines": [
            "2233 South Millway"
        ],
        "cityTown": "Mississauga",
        "stateProvince": "ON",
        "postalCode": "L5L 3H7",
        "countryCode": "CA",
        "name": "Jill Smith"
    },
    "toAddress": {
        "addressLines": [
            "323 1st St East"
        ],
        "cityTown": "Brooks",
        "stateProvince": "AB",
        "postalCode": "T1R 0G9",
        "countryCode": "CA",
        "name": "Bruce Green"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "LB",
            "weight": "0.95"
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": 8,
            "width": 4,
            "height": 6
        }
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBDS",
        "parcelType": "PKG"
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "size": "DOC_4X6",
        "fileFormat": "PDF",
        "contentType": "URL",
        "printDialogOption": "EMBED_PRINT_DIALOG"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "CAD"
        },
        "customsItems": [ {
            "description": "vintage floral-print dress",
            "itemId": "4885-NJE",
            "originCountryCode": "CA",
            "quantity": 2,
            "unitPrice": 400,
            "url": "http://example.com/dresses/vintage/4885nje"
        } ]
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "1234-5678"
    } ]
}'
Sample Response
{
    "fromAddress": {
        "addressLines": [
            "2233 South Millway"
        ],
        "cityTown": "Mississauga",
        "stateProvince": "ON",
        "postalCode": "L5L 3H7",
        "countryCode": "CA",
        "name": "Jill Smith"
    },
    "toAddress": {
        "addressLines": [
            "323 1st St East"
        ],
        "cityTown": "Brooks",
        "stateProvince": "AB",
        "postalCode": "T1R 0G9",
        "countryCode": "CA",
        "name": "Bruce Green"
    },
    "parcel": {
        "dimension": {
            "length": 8.0,
            "height": 6.0,
            "width": 4.0,
            "unitOfMeasurement": "IN"
        },
        "weight": {
            "weight": 0.95,
            "unitOfMeasurement": "LB"
        },
        "valueOfGoods": 800.00
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBDS",
        "parcelType": "PKG",
        "baseCharge": 11.42,
        "totalCarrierCharge": 14.19,
        "deliveryCommitment": {
            "minEstimatedNumberOfDays": "3",
            "maxEstimatedNumberOfDays": "6"
        },
        "currencyCode": "CAD",
        "destinationZone": 1.0
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "size": "DOC_4X6",
        "fileFormat": "PDF",
        "contentType": "URL",
        "printDialogOption": "EMBED_PRINT_DIALOG",
        "contents": "https://.../a60674f0644044459c29ab873ca89d2b.pdf"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "CAD"
        },
        "customsItems": [ {
            "itemId": "4885-NJE",
            "description": "vintage floral-print dress",
            "quantity": 2,
            "unitPrice": 400.00,
            "url": "http://example.com/dresses/vintage/4885nje",
            "originCountryCode": "CA"
        } ]
    },
    "domesticShipmentDetails": {
        "shipperTrackingNumber": "329000000101",
        "barCodeLabelNumber": "329000000101"
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "1234-5678"
    } ],
    "parcelTrackingNumber": "PBXGA654A00000FDBC0E",
    "shipmentId": "PBXGA654A00000FDBC0E"
}


Sample Request for Drop Off to CBDS, with Final-Mile Label

This request uses the Drop-Off to CBDS, with Final-Mile Label solution.

Sample Request for Drop Off to CBDS, with Final-Mile Label
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 '
{
    "fromAddress": {
        "addressLines": [
            "123 Caravelle Drive"
        ],
        "cityTown": "Mississauga",
        "stateProvince": "ON",
        "postalCode": "L4V 1K9",
        "countryCode": "CA",
        "name": "Alan Jones"
    },
    "toAddress": {
        "addressLines": [
            "31st Avenue East"
        ],
        "cityTown": "Brooks",
        "stateProvince": "AB",
        "postalCode": "T1R 0A4",
        "countryCode": "CA",
        "name": "Victoria Anderson"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "LB",
            "weight": "0.5"
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": "12",
            "width": "6",
            "height": "10"
        }
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBDS",
        "parcelType": "PKG"
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "size": "DOC_4X6",
        "fileFormat": "PDF",
        "contentType": "URL",
        "printDialogOption": "EMBED_PRINT_DIALOG"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "CAD"
        },
        "customsItems": [ {
            "itemId": "OLCom_255",
            "description": "satin pleated waist skirts",
            "url": "http://example.com/skirts",
            "unitPrice": "300",
            "quantity": "3",
            "originCountryCode": "CA"
        } ]
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "45729-a80w"
    } ]
}'
Sample Response
{
    "fromAddress": {
        "addressLines": [
            "123 Caravelle Drive"
        ],
        "cityTown": "Mississauga",
        "stateProvince": "ON",
        "postalCode": "L4V 1K9",
        "countryCode": "CA",
        "name": "Alan Jones"
    },
    "toAddress": {
        "addressLines": [
            "31st Avenue East"
        ],
        "cityTown": "Brooks",
        "stateProvince": "AB",
        "postalCode": "T1R 0A4",
        "countryCode": "CA",
        "name": "Victoria Anderson"
    },
    "parcel": {
        "dimension": {
            "length": 12.0,
            "height": 10.0,
            "width": 6.0,
            "unitOfMeasurement": "IN"
        },
        "weight": {
            "weight": 0.5,
            "unitOfMeasurement": "LB"
        },
        "valueOfGoods": 900.00
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBDS",
        "parcelType": "PKG",
        "baseCharge": 26.43,
        "totalCarrierCharge": 26.43,
        "deliveryCommitment": {
            "minEstimatedNumberOfDays": "3",
            "maxEstimatedNumberOfDays": "6"
        },
        "currencyCode": "CAD",
        "destinationZone": 1.0
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "size": "DOC_4X6",
        "fileFormat": "PDF",
        "contentType": "URL",
        "printDialogOption": "EMBED_PRINT_DIALOG",
        "contents": "https://.../690cf25e9eae4ea49abd9b8b4050f4ba.pdf"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "CAD"
        },
        "customsItems": [ {
            "itemId": "OLCom_255",
            "description": "satin pleated waist skirts",
            "quantity": 3,
            "unitPrice": 300.00,
            "url": "http://example.com/skirts",
            "originCountryCode": "CA"
        } ]
    },
    "domesticShipmentDetails": {
        "barCodeLabelNumber": "329000000366"
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "45729-a80w"
    } ],
    "parcelTrackingNumber": "PBXGA03A2C000DB5E84F",
    "shipmentId": "PBXGA03A2C000DB5E84F"
}


Error Codes

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