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

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

  2. The carrier query parameter is optional if the original shipment used a rates.carrier value of USPS. The query parameter is otherwise required.

  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/{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 rates.carrier value of USPS. The parameter is otherwise required.

Valid values are:

  • USPS (PB Expedited)

  • Newgistics (PB Standard)

  • PBPresort

  • PBI (CBDS)

  • FedEx

  • UPS

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

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

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.

        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:

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

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

Conditional. The merchant’s reference fields. Each object in the array includes a name-value pair that defines a reference field. The array applies to the following carriers:

        name

String

The name of the reference field.

        value

String

The value for the reference field.

hazmatDetails

Hazmat Details Object

PB Standard Only. If shipping hazardous materials with PB Standard, use this object. See Hazmat Details 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:

PB Expedited Sample Reprint Request

PB Expedited Sample Reprint Request
curl -X GET .../v1/shipments/USPS2200171406955211 \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
PB Expedited Sample Reprint Response
{
    "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

PB Standard Delivery Sample Reprint Request
curl -X GET .../v1/shipments/NGST2200171328057769?carrier=Newgistics \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
PB Standard Delivery Sample Reprint Response
{
    "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

PB Presort Sample Reprint Request
curl -X GET .../v1/shipments/PBPRESORT2200171406981881?carrier=PBPresort \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
PB Presort Sample Reprint Response
{
    "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.

CBDS Sample Reprint Request
curl -X GET .../v1/shipments/UPGUS00164FC110CCA57?carrier=PBI \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
CBDS Sample Reprint Response
{
    "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

FedEx Sample Reprint Request
curl -X GET .../shipments/FEDEX2200287696247364?carrier=fedex \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
FedEx Sample Reprint Response
{
    "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

UPS Sample Reprint Request
curl -X GET .../v1/shipments/UPS2200170731892828?carrier=UPS \
-H "Authorization: Bearer <oauth_token>" \
-H "X-PB-UnifiedErrorStructure: true"
UPS Sample Reprint Response
{
    "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 PB Shipping APIs error codes, please see Error Codes.