Reprint a Shipment Label¶
HTTP Request¶
GET /v1/shipments/{shipmentId}?carrier={carrier}
Summary¶
This operation retrieves an existing shipping label or QR code. The API sends the shipmentId
returned by the original Create Shipment request. Use this only if the shipping label or QR code in the Create Shipment response was spoilt or lost. The APIs allow three attempts to reprint a label.
Important: Reprints should be used only in the case of spoilt or lost data. The number of reprints of a shipment label is scrutinized and restricted.
Considerations¶
You cannot use this operation if the initial Create Shipment request returned no response or returned an error. If that’s the case, do one of the following:
If the initial request returned no response at all, use the Retry Shipment API to check whether the label exists. If it does not, issue a new Create Shipment request with a new Transaction ID.
If the initial request returned the HTTP 500 error, follow the steps in Troubleshoot the 500 Internal Server Error.
If the initial request returned an error other than the HTTP 500 error, you cannot reprint the label but must instead issue a new Create Shipment request with a new Transaction ID.
The
carrier
query parameter is optional if the original shipment used arates.carrier
value ofUSPS
. The query parameter is otherwise required.PB Standard Delivery: If you used APAC Services to print the original label, you cannot use this operation.
PB Standard Returns: If the original request returned a QR code, this API also returns a QR code.
CBDS: This returns a label only if the original Create Shipment request returned a label. The merchant’s delivery solution determines whether the Create Shipment API returns a label.
Request URLs¶
Sandbox: https://shipping-api-sandbox.pitneybowes.com/shippingservices/v1/shipments/{shipmentId}?carrier={carrier}
Production: https://shipping-api.pitneybowes.com/shippingservices/v1/shipments/{shipmentId}?carrier={carrier}
Path Parameter¶
Name |
Description |
---|---|
shipmentId |
Required. The shipment ID that was issued when shipment label was generated. |
Query Parameter¶
Name |
Description |
---|---|
carrier |
Conditional. The name of the carrier. This parameter is optional if the original shipment used a Valid values are:
|
Request Header¶
Name |
Description |
---|---|
Authorization |
Required. OAuth token generated using the Generate an OAuth Token API. |
X-PB-UnifiedErrorStructure |
Recommended. Set this to |
Response Elements¶
The response returns a Shipment Object. The following table describes all possible fields in a Shipment Object.
Important
Some fields might not apply to your operation.
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 Requests¶
See the following examples:
PB Expedited Sample Reprint Request¶
curl -X GET ../v1/shipments/USPS2200171406955211 \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
{
"fromAddress": { ... },
"toAddress": { ... },
"parcel": { ... },
"rates": [ ... ],
"documents": [ {
"contentType": "URL",
"fileFormat": "PDF",
"contents": "https://.../usps/198715941/outbound/label/c95b3716623646178ce5e0ba574d78ff.pdf"
} ],
"shipmentOptions": [ ... ],
"shipmentId": "USPS2200171406955211",
"parcelTrackingNumber": "9405509898641490995613"
}
PB Standard Delivery Sample Reprint Request¶
curl -X GET ../v1/shipments/NGST2200171328057769?carrier=PBCS \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
{
"fromAddress": { ... },
"toAddress": { ... },
"parcel": { ... },
"rates": [ ... ],
"documents": [ {
"type": "SHIPPING_LABEL",
"contentType": "URL",
"fileFormat": "PDF",
"contents": "https://.../2de2104c18de4110885a348fded42939.pdf"
} ],
"shipmentOptions": [ ... ],
"shipmentId": "NGST2200171328057769",
"parcelTrackingNumber": "4206740192612123456789000000225206"
}
PB Presort Sample Reprint Request¶
curl -X GET ../v1/shipments/PBPRESORT2200171406981881?carrier=PBPresort \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
{
"fromAddress": { ... },
"toAddress": { ... },
"parcel": { ... },
"rates": [ ... ],
"documents": [ {
"type": "SHIPPING_LABEL",
"contentType": "URL",
"fileFormat": "PDF",
"contents": "https://.../pbpresort/904011236/outbound/label/c004299c6f524b0db59f44425fc5047e.pdf"
} ],
"shipmentOptions": [ ... ],
"shipmentId": "PBPRESORT2200171406981881",
"parcelTrackingNumber": "0070698765432100004506511253671"
}
CBDS Sample Reprint Request¶
The following is a sample retry request for a Create Shipment operation that had printed a first-mile label.
curl -X GET ../v1/shipments/UPGUS00164FC110CCA57?carrier=PBI \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
{
"fromAddress": { ... },
"toAddress": { ... },
"parcel": { ... },
"rates": [ ... ],
"documents": [ {
"type": "SHIPPING_LABEL",
"size": "DOC_8X11",
"fileFormat": "PDF",
"contentType": "URL",
"contents": "https://.../usps/352584758/outbound/label/9d1da50f82734ad9d4a41d5fb9a19b.pdf"
} ],
"shipmentOptions": [ ... ],
"customs": { ... },
"references": [ ... ],
"parcelTrackingNumber": "UPGUS00164FC110CCA57",
"shipmentId": "UPGUS00164FC110CCA57"
}
FedEx Sample Reprint Request¶
curl -X GET ../shipments/FEDEX2200287696247364?carrier=fedex \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
{
"fromAddress": { ... },
"toAddress": { ... },
"parcel": { ... },
"rates": [ ... ],
"documents": [ {
"contentType": "URL",
"contents": "https://.../87d8a4f658864a4c829e8924f7843b46.pdf",
"fileFormat": "PDF",
"size": "DOC_4X6"
} ],
"shipmentOptions": [ ... ],
"parcelTrackingNumber": "<tracking-number>"
"shipmentId": "FEDEX2200287696247364"
}
UPS Sample Reprint Request¶
curl -X GET ../v1/shipments/UPS2200170731892828?carrier=UPS \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
{
"fromAddress": { ... },
"toAddress": { ... },
"parcel": { ... },
"rates": [ ... ],
"documents": [ {
"size": "DOC_4X6",
"fileFormat": "PDF",
"contentType": "URL",
"contents": "https://.../ups/258459135/outbound/label/2467dad3127a49048a99fa097de6535a.pdf"
} ],
"shipmentOptions": [ ... ],
"shipmentId": "UPS2200170731892828",
"parcelTrackingNumber": "<tracking-number>"
}
Error Codes¶
For a list of all error codes returned by the Ecommerce APIs, please see Error Codes.