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

    • 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 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 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?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. Note that the deprecated value Newgistics still works.

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

PB Expedited, CBDS Only. Applies as follows:

  • PB Expedited: If you are sending an international shipment 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 CBDS 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. 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:

  • This field does not apply to Rate Parcel requests.

  • This field does not apply to the Create CBDS Shipment request if the merchant prints the first-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

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:

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

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 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 Rate Expedited Returns, Create Expedited Returns, and Create Standard Returns. Note: You cannot rate Standard Returns.

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

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

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.