Retry a Shipment

HTTP Request

GET /v1/shipments?originalTransactionId={transaction_id}&carrier={carrier}

Summary

If a Create Shipment request received no response or returned the HTTP 500 error, this operation checks whether the request succeeded and the label exists. If the label exists, the operation returns the label, except as noted in Things to Consider. If the label does not exist, the API returns an error message and you must create a new shipment with a new Transaction ID.

Important

If your Create Shipment request returned the 500 Internal Server Error, see Troubleshoot the 500 Internal Server Error before using this API operation.

Important

The number of retries of a label is scrutinized and restricted.

Things to Consider

  1. Use this operation in the following situations:
    • If the original Create Shipment request received no response at all and gave no indication of success or failure.
    • If your request returned the HTTP 500 Internal Server Error and you have followed the steps in Troubleshoot the 500 Internal Server Error.
  2. You can retrieve a label with the Retry Shipment API for up to 24 hours after the initial request to create the shipment.
  3. PB Standard (Newgistics): If you used APAC Services to print the original label, you cannot use this operation.
  4. CBDS: For the CBDS First-Mile Inclusive solution, this API returns the first-mile label. For the CBDS First-Mile Exclusive solution, this API returns the original Create Shipment response.
  5. Standard Return: If the original request returned a QR code, this API also returns a QR code.

Request URIs

Sandbox: https://api-sandbox.pitneybowes.com/shippingservices/v1/shipments?originalTransactionId={transaction_id}&carrier={carrier}
Production: https://api.pitneybowes.com/shippingservices/v1/shipments?originalTransactionId={transaction_id}&carrier={carrier}

Query Parameters

Name Description
originalTransactionId Required. The X-PB-TransactionId that was used when the original shipment was submitted.
carrier

The name of the carrier. The carrier query parameter is optional if the carrier is USPS. The query parameter is required for all other carriers.

Valid values are:

  • USPS
  • Newgistics (PB Standard)
  • PBPresort
  • PBI (CBDS)
  • FEDEX
  • UPS

The values are not case-sensitive.

Request Header

Name
Description
Authorization Required. OAuth token generated using the Generate an OAuth Token API.
X-PB-UnifiedErrorStructure Recommended. Set this to true to use the standard error object if an error occurs.

Response Elements: Shipment Object

If the label was created, the response returns a Shipment Object. The following table describes all possible fields in a Shipment Object.

Important

Some fields in the Shipment Object might not apply to your 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 soldToAddress object. If importer’s address is the same as the final recipient, the toAddress and soldToAddress must match.

altReturnAddress Address Object

Applies only to the following:

  • USPS: If you are sending an international shipment through USPS and if you have set the NON_DELIVERY_OPTION shipment option to redirect, then enter the address that a returned parcel should go to.
  • CBDS: For a Create Shipment request, this is the address used to return a parcel from the Pitney Bowes consolidation center. If omitted, the fromAddress is used. The altReturnAddress is not returned in the response.
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]

Conditional. Defines the label, manifest, or other shipping document created by the API call.

This field is required except in the following cases:

  • This field does not apply to Rate Parcel requests.
  • This field does not apply to CBDS First-Mile Exclusive shipments.
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 any additional requirements for a carrier or service, please see the Things to Consider section on the carrier’s Create Shipment page.

        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:

  • USPS: Required for shipments to international destinations and to APO/FPO/DPO, Territories/Possessions, and FAS
  • 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
        customsInfo Customs Info Object Customs clearance information used to fill out a commercial invoice.
        customsItems Array[Customs Items Object]

Information about each commodity in the shipment, used for customs clearance.

The maximum number of objects in this array is 30.

domesticShipmentDetails Domestic Shipment Details Object CBDS Only. Required if the merchant uses the CBDS First-Mile Exclusive solution. Contains information about the domestic leg of the shipment. This field does not apply to the First-Mile Inclusive solution.
soldToAddress Address Object

Applies only to FedEx and UPS. This contains the final recipient of a United Parcel Service shipment. Required for a shipment from the U.S. to Puerto Rico or to an international destination. 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. Set this to RETURN. Required for Expedited, Standard, and Scan-Based returns.
references Array[Object]

Enters shipper-generated values. Applies only to the following:

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 contains examples for the following carriers:

USPS Sample Retry Request

USPS Sample Retry Request
curl -X GET .../v1/shipments?originalTransactionId=12345678901234567890 \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
USPS Sample Retry Response
{
    "fromAddress": { ... },
    "toAddress": { ... },
    "parcel": { ... },
    "rates": [ ... ],
    "shipmentId": "USPS2200070298237396",
    "parcelTrackingNumber": "9405509898641491051189",
    "documents": [ {
        "fileFormat": "PDF",
        "contentType": "URL",
        "contents": "https://.../usps/872060188/outbound/label/208b56a6d2b84baeaa18dc23075bc1b4.pdf"
    } ],
    "shipmentOptions": [ ... ]
}

PB Standard (Newgistics) Sample Retry Request

PB Standard Sample Retry Request
curl -X GET .../v1/shipments?originalTransactionId=n6721a207a60867e6176&carrier=newgistics \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
PB Standard Sample Retry Response
{
    "fromAddress": { ... },
    "toAddress": { ... },
    "parcel": { ... },
    "rates": [ ... ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "contentType": "BASE64",
        "fileFormat": "ZPL2",
        "pages": [ {
            "contents": "XMwxNX5..."
        } ]
    } ],
    "shipmentOptions": [ ... ],
    "shipmentId": "NEWGISTICS2200115577794836",
    "parcelTrackingNumber": "4200651192612123456789000000225251"
}

PB Presort Sample Retry Request

PB Presort Sample Retry Request
curl -X GET .../v1/shipments?originalTransactionId=prs71480691704c91815&carrier=PBPresort \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
PB Presort Sample Retry Response
{
    "fromAddress": { ... },
    "toAddress": { ... },
    "parcel": { ... },
    "rates": [ ... ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "contentType": "URL",
        "fileFormat": "PDF",
        "contents": "https://.../pbpresort/198715841/outbound/label/c9a8140f4f4c440ab6a8775eb0c67730.pdf"
    } ],
    "shipmentOptions": [ ... ],
    "shipmentId": "PBPRESORT2203115777806755",
    "parcelTrackingNumber": "0070698765432100005006512253671"
}

CBDS Sample Retry Request

CBDS Sample Retry Request
curl -X GET .../v1/shipments?originalTransactionId=123456789012345678&carrier=PBI \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
CBDS Sample Retry Response
{
    "fromAddress": { ... },
    "toAddress": { ... },
    "parcel": { ... },
    "rates": [ ... ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "size": "DOC_8X11",
        "fileFormat": "PDF",
        "contentType": "URL",
        "contents": "https://.../9d1da50f82734ab9d4a41d5ffb9a19b.pdf"
    } ],
    "shipmentOptions": [ ... ],
    "customs": { ... },
    "parcelTrackingNumber": "UPGUS00164FC110CCA57",
    "shipmentId": "UPGUS00164FC110CCA57"
}

FedEx Sample Retry Request

FedEx Sample Retry Request
curl -X GET .../v1/shipments?originalTransactionId=21675246742&carrier=fedex \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
FedEx Sample Retry Response
{
    "fromAddress": { ... },
    "toAddress": { ... },
    "parcel": { ... },
    "rates": [ ... ],
    "documents": [ {
        "contentType": "URL",
        "contents": "https://.../52823dd60d354562a08533aa6cd98862.pdf",
        "fileFormat": "PDF",
        "size": "DOC_4X6"
    } ],
    "shipmentOptions": [ ... ],
    "parcelTrackingNumber": "79468785464190",
    "shipmentId": "FEDEX220216078962794"
}

UPS Sample Retry Request

UPS Sample Retry Request
curl -X GET .../v1/shipments?originalTransactionId=4e01a996dc2060f188&carrier=ups \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
UPS Sample Retry Response
{
    "fromAddress": { ... },
    "toAddress": { ... },
    "parcel": { ... },
    "rates": [ ... ],
    "documents": [ {
        "size": "DOC_4X6",
        "fileFormat": "PDF",
        "contentType": "URL",
        "contents": "https://.../ups/258459135/outbound/label/aba74cb1c830451fa29031611c15a658.pdf"
        }
    ],
    "shipmentId": "UPS2200169981629768",
    "parcelTrackingNumber": "<tracking-number>"
}

Error Codes

For a list of all PB Shipping APIs error codes, please see Error Codes.

The following error codes are specific to this API:

Error Code Message
1090001 Original Transaction not found.
1090006 Time limit has passed.