Create a PB Standard Returns Label¶
HTTP Request¶
POST /v1/shipments
Summary¶
This operation creates a Pitney Bowes Standard Returns label for a buyer to use if returning a parcel. The label is a post-paid label and incurs no charges unless used. The label contains a USPS-compliant barcode and can be tracked via the Track a Package API. The label also contains a PB Standard Returns barcode. The label might also contain a third, custom barcode.
The API provides the option to create a QR code instead of a label. A QR code allows a buyer without a printer to print the label at a Post Office or other shipping facility. To provide the buyer with nearby facilities that print labels, issue the Carrier Facilities API.
A buyer who has a printer can also print the label by entering the QR code’s Label ID at the USPS Label Broker™ website: https://tools.usps.com/label-broker.htm
Prerequisites¶
To create a PB Standard Returns label, a merchant must first onboard with PB Standard. When a merchant onboards, the merchant is enrolled with a PB Standard facility and receives a set of PB Standard IDs.
Testing in Sandbox¶
To test this API in the Sandbox environment, use the following values in the
shipmentOptions
array:
Shipment Option:
|
Value: |
SHIPPER_ID |
Use any Shipper ID. If you have not yet onboarded a merchant, use the default Shipper ID that comes with your Developer Account. |
CLIENT_ID |
NGST |
RETURN_ID |
123456789a |
Things to Consider¶
The PB Standard Returns service is a post-paid service. Postage is not charged at the time of label creation.
PB Standard Returns are supported for domestic shipments only.
PB Standard Returns use Pitney Bowes as the carrier.
Standard Returns use the Parcel Select Return (
PRCLSEL
) mail class and the package (PKG
) parcel type. Standard Returns do not support special services.When issuing the API, you specify whether to create a label or QR code by specifying either
SHIPPING_LABEL
orQR_CODE
in thedocuments.type
field.If you choose to create a QR code, you can use the Carrier Facility API to provide the buyer with nearby USPS facilities that accept QR codes.
When issuing the API, you must set the following:
Field
Value shipmentType
RETURN
fromAddress
The address of the buyer who is returning the parcel. The fromAddress must include the following:
addressLines
- Either:
cityTown
andstateProvince
, orpostalCode
toAddress
The merchant’s address. The API will replace this address with the closest PB Standard facility. The toAddress requires the following fields:
postalCode
: This can be populated with any five numerical digits. For example00000
.countryCode
: Set this toUS
.
Note that the response returns a different toAddress than the one you send in the request. The response specifies PITNEY BOWES RETURNS in the toAddress.
parcel.weight
The parcel.weight
object is required, but the object can contain any number for the weight value. The actual weight value is determined during handling and need not be accurate in this object.rates.carrier
NEWGISTICS
(which indicates PB Standard)rates.serviceId
PRCLSEL
rates.parcelType
PKG
documents.type
- To create a label, set this to:
SHIPPING_LABEL
- To create a QR code, set this to:
QR_CODE
documents.size
- To create a label, see this table.
- To create a QR code, do not use this field.
documents.fileFormat
- To create a label, see this table.
- To create a QR code, set this to:
GIF
documents.contentType
- To create a label, see this table.
- To create a QR code, set this to:
BASE64
shipmentOptions
The following shipment options are required:
SHIPPER_ID: The merchant’s Shipper ID.
CLIENT_ID: The merchant’s unique PB Standard client ID assigned when the merchant onboarded with PB Standard.
If testing in Sandbox, set this to
NGST
.RETURN_ID: A merchant-generated identifier for the label. The identifier does not appear on the label.
If testing in Sandbox, set this to
123456789a
.CLIENT_SERVICE_FLAG: Set this to
Standard
.DISPOSITION_RULESET_ID: The ruleset (sort code) assigned to the merchant during onboarding for PB Standard Returns.
Note: For the optional shipment options that apply to PB Standard Returns, see the Shipment Options page.
To add a custom barcode to the label, use the
documents.customerData.labelDetails
array. See Custom Barcodes on this page.The
documents.customerData.labelDetails
array also allows merchants to perform additional custom functions, such as printing additional text or applying business rules. Merchants must set up the customizations in advance with their PB implementation teams.To optionally apply minimal address validation to the
fromAddress
, which is the address of the buyer who is returning the item, set MINIMAL_ADDRESS_VALIDATION totrue
in theshipmentOptions
array.If you choose to retrieve the label through a URL, the label is available for 24 hours after label creation.
The API returns a parcel tracking number you can use to track the label via the Track a Package API.
If the API call returns the HTTP 500 Internal Server Error, see Troubleshoot the 500 Internal Server Error.
For other errors, do not resubmit the request without first checking whether the label was created through the Retry API.
PB Standard Returns labels are not manifested.
Custom Barcodes¶
When creating a PB Standard Returns label, you can add an optional custom barcode,
as shown in the sample Standard Returns label. To add a custom barcode, include the following
parameters in the documents.customerData.labelDetails
array:
Parameter | Value |
barcodeValue |
Set this to the information to be encoded in the barcode. |
barcodeType |
Set this to CODE128 to indicated the barcode uses the 128 barcode symbology. |
barcodeHumanReadable |
Set this to any human-readable information that is to accompany the barcode on the label. |
For example:
"documents": [ {
"customerData": {
"labelDetails": [ {
"name": "barcodeValue",
"value": "10202"
},{
"name": "barcodeType",
"value": "CODE128"
},{
"name": "barcodeHumanReadable",
"value": "Order: 10202"
} ]
}
} ]
Request URLs¶
Sandbox: https://api-sandbox.pitneybowes.com/shippingservices/v1/shipments
Production: https://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 application/json . |
Accept-Language | Language and country code. Default: en-US |
X-PB-TransactionId | Required. A unique identifier for the transaction, up to 25 characters. Important: You must ensure this is a unique id. |
X-PB-Use-Merchant-Logo | If a merchant is configured to print a custom logo on PB Standard Returns
labels, the custom logo is printed on the label by default. You can
optionally leave the logo off a given label by setting this header to
To be configured to print custom logos on PB Standard Returns labels, merchants should contact their Pitney Bowes implementation teams. |
Request / Response Elements¶
Important
The API call sends and receives a Shipment Object. The following table describes all possible fields in a Shipment Object. Some fields do not apply to this operation and are marked accordingly.
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. 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 | Address Object | PB Expedited, CBDS Only. Applies as follows:
|
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 |
documents | Array[Documents Object] | Conditional. Defines the label, manifest, or other shipping document created by the API call. 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 |
name | String | The name of the shipment option. |
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:
|
customsInfo | Customs Info Object | Customs clearance information used to fill out a commercial invoice. In the Customs Info Object, make sure to include the fields marked Required. |
customsItems | Array[Customs Items Object] | Information about each commodity in the shipment, used for customs clearance. In 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. 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 | Address Object | 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 RETURN . Required for Expedited Returns and Standard Returns. |
references | Array[Object] | Merchant-defined values. Applies to the following:
|
hazmatDetails | Hazmat Details Object | PB Standard Only. If shipping hazardous materials with PB Standard, use this 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 Requests¶
See the following examples:
Create Standard Returns Label¶
The following request creates a Standard Returns label. For a sample label, click here.
curl -X POST .../v1/shipments \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-H "Accept-Language: en-US" \
-H "X-PB-TransactionId: <unique_transaction_id>" \
-d '
{
"shipmentType": "RETURN",
"fromAddress": {
"company": "Shop",
"name": "Kathryn Smith",
"phone": "334-000-0000",
"email": "kathryn@example.com",
"addressLines": [ "2352 Bent Creek Rd" ],
"cityTown": "Auburn",
"stateProvince": "AL",
"postalCode": "36830",
"countryCode": "US"
},
"toAddress": {
"postalCode": "00000",
"countryCode": "US"
},
"parcel": {
"weight": {
"unitOfMeasurement": "OZ",
"weight": 0
}
},
"rates": [ {
"carrier": "NEWGISTICS",
"serviceId": "PRCLSEL",
"parcelType": "PKG"
} ],
"documents": [ {
"type": "SHIPPING_LABEL",
"size": "DOC_4X6",
"contentType": "URL",
"fileFormat": "PDF",
"resolution": "DPI_300",
"customerData": {
"labelDetails": [ {
"name": "<custom_value>",
"value": "<custom_value>"
} ]
},
"printDialogOption" : "NO_PRINT_DIALOG"
} ],
"shipmentOptions": [ {
"name": "SHIPPER_ID",
"value": "9024324564"
},{
"name": "CLIENT_ID",
"value": "NGST"
},{
"name": "RETURN_ID",
"value": "123456789a"
},{
"name": "CLIENT_SERVICE_FLAG",
"value": "Standard"
},{
"name": "DISPOSITION_RULESET_ID",
"value": "1"
} ]
}'
{
"fromAddress": {
"company": "Shop",
"name": "Kathryn Smith",
"phone": "334-000-0000",
"email": "kathryn@example.com",
"residential": false,
"addressLines": [
"2352 Bent Creek Rd"
],
"cityTown": "Auburn",
"stateProvince": "AL",
"postalCode": "36830-6433",
"countryCode": "US",
"deliveryPoint": "52"
},
"toAddress": {
"name": "PITNEY BOWES RETURNS",
"addressLines": [
"PARCEL RETURN SERVICE",
"",
""
],
"postalCode": "56901"
},
"parcel": {
"weight": {
"unitOfMeasurement": "OZ",
"weight": 0.0
}
},
"rates": [ {
"carrier": "NEWGISTICS",
"parcelType": "PKG",
"specialServices": [],
"serviceId": "PRCLSEL"
} ],
"documents": [ {
"contentType": "URL",
"contents": "https://.../f42be533cef48c09f76c1908c78a074.pdf",
"customerData": {
"labelDetails": [ {
"name": "<custom_value>",
"value": "<custom_value>"
} ],
},
"fileFormat": "PDF",
"size": "DOC_4X6",
"type": "SHIPPING_LABEL"
} ],
"shipmentOptions": [ {
"name": "SHIPPER_ID",
"value": "9024324564"
},{
"name": "CLIENT_ID",
"value": "NGST"
},{
"name": "RETURN_ID",
"value": "123456789a"
},{
"name": "CLIENT_SERVICE_FLAG",
"value": "Standard"
},{
"name": "DISPOSITION_RULESET_ID",
"value": "1"
},{
"name": "SMART_LABEL_BARCODE",
"value": "7225108105012404020000000195465722I"
} ],
"parcelTrackingNumber": "9202390100763900000012487",
"shipmentId": "NGST220023889032700"
}
Create a Standard Returns Label QR Code¶
The following request creates a QR code that can be used to print a Standard Returns label. For a sample QR code, click here.
curl -X POST .../v1/shipments \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-H "Accept-Language: en-US" \
-H "X-PB-TransactionId: <unique_transaction_id>" \
-d '
{
"shipmentType": "RETURN",
"fromAddress": {
"company": "Shop",
"name": "Kathryn Smith",
"phone": "334-000-0000",
"email": "kathryn@example.com",
"addressLines": [ "2352 Bent Creek Rd" ],
"cityTown": "Auburn",
"stateProvince": "AL",
"postalCode": "36830",
"countryCode": "US"
},
"toAddress": {
"postalCode": "00000",
"countryCode": "US"
},
"parcel": {
"weight": {
"unitOfMeasurement": "OZ",
"weight": 0
}
},
"rates": [ {
"carrier": "NEWGISTICS",
"serviceId": "PRCLSEL",
"parcelType": "PKG"
} ],
"documents": [ {
"type": "QR_CODE",
"fileFormat": "GIF",
"contentType": "BASE64"
} ],
"shipmentOptions": [ {
"name": "SHIPPER_ID",
"value": "9024324564"
},{
"name": "CLIENT_ID",
"value": "NGST"
},{
"name": "RETURN_ID",
"value": "123456789a"
},{
"name": "CLIENT_SERVICE_FLAG",
"value": "Standard"
},{
"name": "DISPOSITION_RULESET_ID",
"value": "1"
} ]
}'
{
"fromAddress": {
"company": "Shop",
"name": "Kathryn Smith",
"phone": "334-000-0000",
"email": "kathryn@example.com",
"residential": false,
"addressLines": [
"2352 Bent Creek Rd"
],
"cityTown": "Auburn",
"stateProvince": "AL",
"postalCode": "36830-6433",
"countryCode": "US",
"deliveryPoint": "52"
},
"toAddress": {
"name": "PITNEY BOWES RETURNS",
"addressLines": [
"PARCEL RETURN SERVICE",
"",
""
],
"postalCode": "56901"
},
"parcel": {
"weight": {
"unitOfMeasurement": "OZ",
"weight": 0.0
}
},
"rates": [ {
"carrier": "NEWGISTICS",
"parcelType": "PKG",
"specialServices": [],
"serviceId": "PRCLSEL"
} ],
"documents": [ {
"contentType": "BASE64",
"contents": "R0lGODlhWAJYAvAAAAAAAP///ywAAAAAWAJYAkAC/4yPqcvtD6OctNq...",
"fileFormat": "GIF",
"type": "QR_CODE"
} ],
"shipmentOptions": [ {
"name": "SHIPPER_ID",
"value": "9024324564"
},{
"name": "CLIENT_ID",
"value": "NGST"
},{
"name": "RETURN_ID",
"value": "123456789a"
},{
"name": "CLIENT_SERVICE_FLAG",
"value": "Standard"
},{
"name": "DISPOSITION_RULESET_ID",
"value": "1"
},{
"name": "SMART_LABEL_BARCODE",
"value": "7281006105012404002030000019584657I"
},{
"name": "LABEL_ID",
"value": "93R64M6C"
} ],
"parcelTrackingNumber": "9204490188763900000012107",
"shipmentId": "NGST220023818484327"
}
PB Standard Returns Label¶

QR Code¶
A QR code is a two-dimensional barcode a buyer can use to print a PB Standard Returns label at a Post Office or other label-printing facility. The buyer either scans the QR code or enters the QR code label ID. To provide a buyer with a list of nearby facilities that print labels from QR codes, use the Carrier Facility API. A buyer who has a printer can print a label by entering the QR code’s Label ID at the USPS Label Broker™ site: https://tools.usps.com/label-broker.htm
The following is a sample QR code:
