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 the Considerations. 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 for a Create Shipment Request before using this API operation.

Important

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

Considerations

  1. Use this operation in the following situations:

  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 Delivery: If you used APAC Services to print the original label, you cannot use this operation.

  4. PB Standard Returns: If the original request returned a QR code, this API also returns a QR code.

  5. CBDS: This API returns a label only if the original Create Shipment request returned a label.

Request URLs

Sandbox: https://shipping-api-sandbox.pitneybowes.com/shippingservices/v1/shipments?originalTransactionId={transaction_id}&carrier={carrier}
Production: https://shipping-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 original shipment used a rates.carrier value of USPS. The query parameter is otherwise required.

Valid values are:

  • USPS: PB Expedited (default)

  • PBCS: PB Standard

  • PBPresort

  • PBI: PB Cross-Border Delivery Service (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

This GET operation returns the Shipment object. The table below describes the object for all operations that use it. Some fields are labeled Required, which means they are required in the request for operations that send a payload. Some fields are marked as applying only to other label types. They do not apply to this operation.

Name


Data Type

Description

shipmentType

String

Return Labels Only. For return labels, set this to RETURN.

Required for Expedited Returns , Standard Returns, and when rating return labels. Note that you cannot rate Standard Returns.

Recommended for CBDS Returns.

fromAddress

Address Object

Required. Origin address.

If you want a different address to appear on the label from the one listed here, see this FAQ. The FAQ does not apply to PB Standard.

toAddress

Address Object

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 toAddress object. For the address of the recipient, use the soldToAddress object. If the importer is the same as the final recipient, the toAddress and soldToAddress must match.

altReturnAddress

Address Object

For these carriers, sets an address for parcel returns:

  • PB Expedited: If you are sending an international shipment and if you have set the NON_DELIVERY_OPTION option to redirect, use this field to specify the address for a parcel return.

  • PB Presort

  • PMOD

  • CBDS Outbound & CBDS Domestic: By default, parcel returns are sent to a shipment’s fromAddress. (Parcel returns are sent from the CBDS Hub.) If the fromAddress is the wrong address for your returns, then you must use the altReturnAddress to enter the correct address for returns. Failure to do so will result returns to the wrong address.

  • FedEx

  • UPS

additionalAddresses

Array[Additional Addresses Object]

CBDS Returns Only. If the seller’s address is different from the toAddress, enter the seller’s address here.

Required if the toAddress and seller address are different.

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]

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:
- Rate Parcel API.
- Create CBDS Shipment API if the merchant prints the first-mile label prior to invoking the API.

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 additional requirements for a carrier, see the Considerations section on the carrier’s Create Shipment page.

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 in the following situations:

  • PB Expedited: Required for shipments to international destinations. Conditional for shipments to APO/FPO/DPO, U.S. Territories, and FAS, as explained in this FAQ.

  • 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.

customs.customsInfo

Customs Info Object

Customs clearance information for the commercial invoice.

Required in the customs object.

customs.customsItems

Array[Customs Items Object]

Customs clearance information for each commodity.

Required in the customs object.

Maximum number of objects in the array: 30

domesticShipmentDetails

Domestic Shipment Details Object

CBDS Only. The first-mile label’s tracking number and other information about the first-mile leg.

Required if the merchant prints the first-mile label prior to invoking the API, as is the case with the Drop-Off to CBDS solution. Send the first-mile label’s tracking number and details.

RESPONSE ONLY for all other CBDS shipment requests.

references

Array[Object]

PB Standard & 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

Hazmat Details Object

PB Standard Only. If shipping hazardous materials with PB Standard, use this object.

carrierPayments

Array[Shipment: Carrier Payments Object]

FedEx & UPS Only. Indicates that one or more of the shipment costs should be charged to a third-party account.

soldToAddress

Address Object

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 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.

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:

PB Expedited (USPS) Sample Retry Request

PB Expedited Sample Retry Request
curl -X GET ../v1/shipments?originalTransactionId=12345678901234567890 \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
PB Expedited 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 Delivery Sample Retry Request

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

The following error codes are specific to this API:

Error Code

Message

1090001

Original Transaction not found.

1090006

Time limit has passed.

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