Create a PB Presort Shipment¶
HTTP Request¶
POST /v1/shipments
Summary¶
This operation creates a post-paid label for a parcel that is part of a PB Presort pickup. Postage for a PB Presort label is not charged at the time of print.
Prerequisites¶
To use PB Presort, a merchant must be enrolled with a PB Presort facility and receive a Mailer ID, Job number, and other information required for shipping through PB Presort. To enroll a merchant, please see Onboard a Merchant to Print PB Presort Labels.
Considerations¶
The label generated is a post-paid label and incurs no charges unless used.
PB Presort labels are supported for domestic shipments only. Note that domestic destinations include US territories/possessions, Freely Associated States, and APO/FPO/DPO. PB Presort does not require a customs form for these destinations.
Pitney Bowes verifies addresses for accuracy against current USPS data and makes corrections to delivery lines and last lines when possible. You can optionally limit the extent of corrections by enabling minimal address validation through the MINIMAL_ADDRESS_VALIDATION option in the
shipmentOptions
array. For a comparison of complete and minimal address validation, see What is minimal address validation?IMPORTANT: If you enable minimal address validation, the shipper takes 100% responsibility for any undelivered packages due to violation of carrier-addressing guidelines and is responsible for any surcharge or adjustment fee levied by the carrier for such a violation.
For available services, parcel types, and labels, see the tables on the PB Presort reference page.
When issuing the API call, you must set the following:
Field
Requirement
fromAddress
,
toAddress
The following address fields are required:
addressLines
postalCode
countryCode
parcel.dimension
Set this to the correct dimensions. Dimensions are required for PB Presort shipments. For limits on parcel dimensions, see PB Presort Services and Parcels.
Important: Entering incorrect dimensions might result in an undeliverable package or an additional postage fee.
rates.carrier
Set this to:
PBPRESORT
rates.serviceId
See Services and Parcels on the PB Presort reference page.
rates.specialServices
See Special Services on the PB Presort reference page.
rates.parcelType
See Services and Parcels on the PB Presort reference page.
documents
See Labels on the PB Presort reference page.
shipmentOptions
The following options are required in the
shipmentOptions
array:SHIPPER_ID: The merchant’s Shipper ID.
PERMIT_NUMBER: The merchant’s permit number for flats.
Depending on the parcel type, you can print merchant-defined reference fields on shipping labels by setting the PRINT_CUSTOM_MESSAGE_1 and PRINT_CUSTOM_MESSAGE_2 options in the
shipmentOptions
array.For the
LGENV
parcel type, the label will have an IMb.For the
PKG
parcel type, the label will have an IMpb.PB Presort does not support the following:
Rating is not supported for PB Presort shipments. Instead, use the rate charts provided by Pitney Bowes.
Refund requests are not supported for PB Presort labels. A Void Shipment request for a PB Presort label will fail.
The Transaction Reports API does not retrieve PB Presort labels.
FUTURE_SHIPMENT_DATE is not supported.
Tracking events show up only after PB Presort uploads the Shipping Services File to USPS. Tracking information can take a while to appear.
You can use the Track a Package API to retrieve tracking events. You must set the
carrier
query parameter toUSPS
in the Tracking API request.You must provide the pickup driver with a physical pickup slip that identifies the parcels in the pickup (similar to a USPS manifest). You can optionally create the physical pickup slip using the Create a PB Presort Pickup Slip API.
Request URLs¶
Sandbox: https://shipping-api-sandbox.pitneybowes.com/shippingservices/v1/shipments
Production: https://shipping-api.pitneybowes.com/shippingservices/v1/shipments
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 a unique ID. |
X-PB-ShipmentGroupId |
Required. The job number that represents the agreement between the merchant and PB Presort. This was provided by Pitney Bowes during merchant onboarding for PB Presort. |
X-PB-Integrator-CarrierId |
Required. The merchant’s Mailer ID (MID), as provided by Pitney Bowes during merchant onboarding for PB Presort. |
X-PB-UnifiedErrorStructure |
Recommended. Set this to |
Request / Response Elements¶
The API call sends and receives a Shipment Object. The following table describes all possible fields in a Shipment Object.
Important
Some fields in the Shipment Object do not apply to this operation and are marked accordingly.
Important
Please see the Considerations on this page before creating the PB Presort shipment.
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. FedEx, UPS: If you are shipping with FedEx or UPS to Puerto Rico or an international destination, and if the importer is different from the final recipient, this is the address of the importer. Enter the recipient’s address in the |
|
altReturnAddress |
PB Expedited, 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] |
Conditional. 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 is required, except in the following cases:
|
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 |
Conditional. For shipments that use customs forms, this object contains the customs information. This field is 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. Required if the merchant prints the first-mile label prior to invoking the Create CBDS Shipment API. This object contains information about the first-mile leg of the shipment. |
|
soldToAddress |
FedEx, UPS Only. The final recipient of a the shipment. Required for a shipment from the U.S. to Puerto Rico or to an international destination. 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. Set this to |
references |
Array[Object] |
PB Standard, CBDS Only. Conditional. The merchant’s reference fields. Each object in the array includes a name-value pair that defines a reference field. This array applies only to the following two carriers:
To pass references for carriers other than the above, see Reference Fields. |
references.name |
String |
PB Standard, CBDS Only. The name of the reference field. |
references.value |
String |
PB Standard, CBDS Only. The value for the reference field. |
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 Request¶
curl -X POST .../v1/shipments \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: 24c7d104-31de-4f6f-8bd0" \
-H "X-PB-ShipmentGroupId: 123456789" \
-H "X-PB-Integrator-CarrierId: 987654321" \
-H "X-PB-UnifiedErrorStructure: true" \
-d '
{
"fromAddress": {
"company": "Supplies",
"name": "John Smith",
"phone": "303-555-0000",
"email": "john@example.com",
"residential": false,
"addressLines": [
"4750 Walnut Street"
],
"cityTown": "Boulder",
"stateProvince": "CO",
"postalCode": "80301",
"countryCode": "US"
},
"toAddress": {
"company": "Shop",
"name": "Mary Jones",
"phone": "620-555-0000",
"email": "mary@example.com",
"residential": false,
"addressLines": [
"4588 W Fulton"
],
"cityTown": "Garden City",
"stateProvince": "KS",
"postalCode": "67846",
"countryCode": "US"
},
"parcel": {
"weight": {
"unitOfMeasurement": "OZ",
"weight": 3
},
"dimension": {
"unitOfMeasurement": "IN",
"length": 12,
"width": 0.25,
"height": 9
}
},
"rates": [ {
"carrier": "PBPRESORT",
"serviceId": "BPM",
"parcelType": "LGENV",
"currencyCode": "USD"
} ],
"documents": [ {
"size": "DOC_6X4",
"printDialogOption": "NO_PRINT_DIALOG",
"type": "SHIPPING_LABEL",
"contentType": "URL",
"fileFormat": "PDF"
} ],
"shipmentOptions": [ {
"name": "SHIPPER_ID",
"value": "9024324564"
},{
"name": "PERMIT_NUMBER",
"value": "SHFL"
},{
"name": "MINIMAL_ADDRESS_VALIDATION",
"value": "false"
} ]
}'
Sample Response¶
{
"fromAddress": {
"company": "Supplies",
"name": "John Smith",
"phone": "303-555-0000",
"email": "john@example.com",
"residential": false,
"addressLines": [
"4750 Walnut St"
],
"cityTown": "Boulder",
"stateProvince": "CO",
"postalCode": "80301-2532",
"countryCode": "US",
"carrierRoute": "C033",
"deliveryPoint": "99"
},
"toAddress": {
"company": "Shop",
"name": "Mary Jones",
"phone": "620-555-0000",
"email": "mary@example.com",
"residential": false,
"addressLines": [
"4588 W Fulton St"
],
"cityTown": "Garden City",
"stateProvince": "KS",
"postalCode": "67846-9775",
"countryCode": "US",
"carrierRoute": "C007",
"deliveryPoint": "84"
},
"parcel": {
"weight": {
"unitOfMeasurement": "OZ",
"weight": 3.0
},
"dimension": {
"length": 12.0,
"width": 0.25,
"height": 9.0,
"unitOfMeasurement": "IN"
}
},
"rates": [ {
"carrier": "PBPRESORT",
"parcelType": "LGENV",
"inductionPostalCode": "80301",
"specialServices": [],
"serviceId": "BPM",
"baseCharge": 0.0,
"currencyCode": "USD",
"destinationZone": "4",
"totalCarrierCharge": 0.0
} ],
"documents": [ {
"contentType": "URL",
"contents": "https://.../6ad8a496574a4cc2ac66d9d9af31138e.pdf",
"fileFormat": "PDF",
"size": "DOC_6X4",
"type": "SHIPPING_LABEL"
} ],
"shipmentOptions": [ {
"name": "SHIPPER_ID",
"value": "9024324564"
},{
"name": "PERMIT_NUMBER",
"value": "SHFL"
},{
"name": "MINIMAL_ADDRESS_VALIDATION",
"value": "false"
} ],
"parcelTrackingNumber": "0070698765432100221106510123814",
"shipmentId": "PBPRESORT2200122647812392"
}
Sample PB Presort Label¶
The following is a sample label for a BPM Large Envelope.

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