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¶
This operation uses the Canada Domestic Delivery Solutions.
You cannot use the Rates API with domestic Canadian shipments.
The
fromAddress
andtoAddress
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
In the rates object, set the following fields to the specified values:
rates.carrier
PBI
rates.serviceId
PBDS
orPBDE
rates.parcelType
PKG
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.
In the
shipmentOptions
array, SHIPPER_ID is required.In customs.customsInfo, set
currencyCode
toCAD
.The API does not use the other fields in the
customs.customsInfo
object. If you pass them, they will be ignored.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.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 |
includeDeliveryCommitment |
Required. If set to true, returns estimated transit time. Transit times is returned as number of days. Valid values:
|
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 |
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 unique. |
X-PB-UnifiedErrorStructure |
Recommended. Set this to |
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 |
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 |
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 |
|
altReturnAddress |
PB Expedited and CBDS Only. Sets the address for parcel returns. Use this in the following situations:
|
|
parcel |
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 |
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:
|
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 |
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:
|
customs.customsInfo |
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 |
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 |
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 If the final recipient’s address is the same as the importer’s address, the entries in the |
|
shipmentType |
String |
Return Labels Only. For PB Expedited Return labels and PB Standard Return labels, set this to 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 |
PB Standard Only. If shipping hazardous materials with PB Standard, use this object. |
|
carrierPayments |
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: |
---|---|
Sample Request for Drop Off to Local Depot¶
This request uses the Drop Off to Local Depot solution.
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"
} ]
}'
{
"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.
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"
} ]
}'
{
"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.