# Reprint Shipment

This operation retrieves an existing shipping label associated with a shipment. The API uses the shipmentId returned by the original Create Shipment request. Use this API only if the original shipping label has been lost or damaged. <br>
**Key Considerations**:<br>
- This operation is applicable only if the original shipment was successfully created. It cannot be used if the initial Create Shipment request resulted in no response or encountered an error.
- USPS allows only 1 reprint.
- GoFor does not allow reprint.
- RMG allows 3 reprints.
- All other carriers allow up to 8 reprints.
- Reprints are valid for 24 hours from the time the label was first created.
- Reprinting should only be used when necessary. Excessive reprint attempts are restricted and monitored.
- Follow the [Troubleshooting](/docs/support/troubleshooting) section in case you are facing any issues creating a shipment.

Endpoint: POST /api/v2/shipments/reprint
Version: 1.0.0
Security: bearerAuth

## Header parameters:

  - `X-PB-Developer-Partner-Id` (string)
    The Developer Partner ID is assigned by PB to uniquely identify a Developer's strategic business partners. If the developer is the sole business partner, this field isn't required.

  - `X-PB-LocationId` (string)
    The X-PB-LocationId header identifies the enterprise, developer, or partner location under which a shipment is processed and billed.
If the header is not provided, the system defaults to the enterprise-level location that was created during developer account onboarding. This default location is automatically used for shipment processing and billing. <br/>

**Requirement Rules**

- The `X-PB-LocationId` header is optional when the shipment origin country code matches the enterprise's default address country code.
- The `X-PB-LocationId` header is required when the shipment origin country code differs from the enterprise's default address country code.
- If the header is required but not provided, the API will return a validation error *"invalid origin countryCode"*.

  - `X-PB-TransactionId` (string)
    A unique transaction Id provided by the partner which is used to enable debugging and linking between the client's transaction and the system.

## Request fields (application/json):

  - `shipmentId` (string, required)
    The shipmentId is a unique identifier for an individual Shipment.
    Example: PUROLATOR2200626353009030

  - `printerAliasName` (string)
    Refers to a printer connected (directly or via network) to a computer. `Max length = 60`
    Example: ZPLtoSheltonTest

  - `references` (object)
    Contains key value map for passing references which is printed on Shipping Label. For example Department Name, Invoice No., PO No., Package description, Order No./ Purchase Order No., Carrier note, Cost Account No., Transportation No., etc. . Max references allowed here is 2.

  - `references.additionalReference1` (string)
    Additional Reference is hardly used, but sender can mention anything as per requirement, just for Recipient's information.  `Max length = 50`.
    Example: 612987641

  - `references.additionalReference2` (string)
    Any tags or information that to be shown to Recipient, can be mentioned by Sender, which is not indicated on AdditionalReference1 field, e.g., PO No, Order No. etc. `Max length = 50`.
    Example: 989

## Response 200 fields (application/json):

  - `shipmentId` (string)
    The shipmentId, a unique identifier for an individual Shipment, which is used for Reprint or Cancel.
    Example: PUROLATOR2200626443337314

  - `parcelTrackingNumber` (string)
    The Tracking number given to the Parcel for tracking purpose.
    Example: 329039098457

  - `labelLayout` (array)
    It defines the layout of the shipping label.

  - `labelLayout.contentType` (string)
    This is used to encode binary data as printable text. ContentType of the document is URL if the fileformat is PDF, while it will be BASE64 if the fileFormat is ZPL2.
    Enum: "URL", "BASE64"

  - `labelLayout.contents` (string)
    Content/Identifier of document e.g., DOCUMENT_REFERECE_ID. Actual document name e.g., abc.pdf. [IN].
    Example: Xhsafiuis

  - `labelLayout.fileFormat` (string)
    Defines the format of the document file the print takes.
    Enum: "PDF", "ZPL2"

  - `labelLayout.size` (string)
    Defines the label size of the Shipment, that is, the Shipping Label is available in different Doc Size.
    Enum: "DOC_8X11", "DOC_4X6"

  - `labelLayout.type` (string)
    Defines the type of the Shipment.
    Enum: "SHIPPING_LABEL"

  - `parcel` (object)
    The details of the Parcel.

  - `parcel.length` (number)
    Length is always the greatest of the three dimensions. The other two dimensions are used in the calculation of the girth.
    Example: 2

  - `parcel.width` (number)
    There is no strict rule as to which element is the width or the height, but the width is the second greatest dimension of a parcel by convention.
    Example: 1

  - `parcel.height` (number)
    By convention, the height is the smallest dimension of the parcel.
    Example: 1

  - `parcel.dimUnit` (string)
    DimUnit is a standard for measuring the physical quantities of specified dimension parameters. The valid values are: Inch and Centimeter.
    Enum: "IN", "CM"

  - `parcel.weightUnit` (string, required)
    WeightUnit is a standard for measuring the physical quantities of specified weight. The valid values are: Ounces and Grams. For USPS shipments, set this to OZ.
    Enum: "OZ", "GM"

  - `parcel.weight` (number)
    Weight measures the heaviness of an object (how heavy an object is) .
    Example: 2

  - `parcel.packageValue` (number)
    Indicates value of the package.
    Example: 2

  - `rate` (object)

  - `rate.baseCharge` (number)
    The base service charge is payable to the carrier, excluding special service charges.
    Example: 16.15

  - `rate.carrier` (string)
    Carrier is a service used to transport the parcels or couriers from one place to another.
    Example: PUROLATOR

  - `rate.currencyCode` (string)
    A three-character (all uppercase letter) symbol of a currency according to the international ISO standard. As a rule, the first two letters denote the name of the country, and the third letter, the name of the currency thereof. For example, for US - the currency is Dollars and code is USD. Similarly for Canada, the currencycode is CAD, and for India, it is INR.
    Example: CAD

  - `rate.parcelType` (string)
    Parcel Type is required for creating a shipment while rating a parcel, which varies as per Carrier selection. ParcelType have categories like Package, Envelopes, Paks, Boxes, Tube, etc.
    Example: PKG

  - `rate.serviceId` (string)
    The unique identifier given to the carrier specific service.
    Example: GRD

  - `rate.surcharges` (array)
    Additional fees or surcharges applied to the shipment. Each object in the array represents a specific surcharge and its associated fee.
The `name` field must be one of the supported surcharge types from the respective carrier.
**Supported Surcharge Names by Carrier:**
| Carrier | Surcharge Names |
|  --- | --- |
| DHL Express | FUEL, GO_GREEN_BASIC, OVERSIZE, PREMIUM, RURAL, TOLL |
| FedEx | ANCILLARY_FEE, CANADIAN_DESTINATION, DELIVERY_AREA, DELIVERY_CONFIRMATION, FUEL, NON_MACHINABLE, OTHER, OUT_OF_DELIVERY_AREA, OUT_OF_PICKUP_AREA, OVERSIZE, RESIDENTIAL_DELIVERY, RESIDENTIAL_PICKUP |
| UPS | DELIVERY_AREA, EXTENDED_AREA, FUEL, LARGE_PACKAGE, RESIDENTIAL, SHIPPER_PAYS_DUTY_TAX |
| USPS | nonmachinable, oversize |

  - `rate.surcharges.fee` (number)
    The amount of the surcharge.
    Example: 2.95

  - `rate.surcharges.name` (string)
    The name of surcharge.
    Example: ResidentialDelivery

  - `rate.totalCarrierCharge` (number)
    The total amount payable to the carrier, including special service fees, surcharges, and any international taxes and duties, except as noted below:
    Example: 22.46

  - `rate.deliveryCommitment` (object)
    Check for estimated delivery date, guarantee (if any), and number of days for shipment to be delivered.

  - `rate.deliveryCommitment.estimatedDeliveryDateTime` (string)
    Estimated Delivery Date.
    Example: 2024-03-25

  - `rate.deliveryCommitment.maxEstimatedNumberOfDays` (string)
    Max days to deliver shipment.
    Example: 5

  - `rate.deliveryCommitment.guarantee` (string)
    Checks if there is any guarantee or committment for shipment delivery.
    Example: None

  - `rate.inductionPostalCode` (string)
    The postal code where the shipment is tendered to the carrier. If an induction postal code is specified in the "fromAddress", it will be used for rate calculations and determining manifest eligibility instead of the standard postal code. If not specified, the postal code from the "fromAddress" will be used.
    Example: 06905

  - `rate.destinationZone` (string)
    This is the postal or delivery zone assigned to the shipment's destination by the carrier. This field is returned for USPS as of now.
    Example: 1

  - `references` (object)
    Contains key value map for passing references which is printed on Shipping Label. For example Department Name, Invoice No., PO No., Package description, Order No./ Purchase Order No., Carrier note, Cost Account No., Transportation No., etc. . Max references allowed here is 2.

  - `references.additionalReference1` (string)
    Additional Reference is hardly used, but sender can mention anything as per requirement, just for Recipient's information.  `Max length = 30`.
    Example: 612987641

  - `references.additionalReference2` (string)
    Any tags or information that to be shown to Recipient, can be mentioned by Sender, which is not indicated on AdditionalReference1 field, e.g., PO No, Order No. etc. `Max length = 30`.
    Example: 989

  - `printStatus` (string)
    Status of the Printed Label.
    Example: submitted

## Response 400 fields (application/json):

  - `errorCode` (string)
    Error code(s) that appear due to HTTP  400- Invalid or Bad Request, e.g., validation-error.
    Example: validation_error

  - `errorDescription` (string)
    The HTTP 400 Bad Request response status code indicates that the server cannot process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
    Example: string

  - `additionalCode` (string)
    A unique identifier for the error, for example 1101055, 0100008, or 1021126.

  - `additionalInfo` (string)
    This is an additional information about the error. This error 'Invalid Request' might appear due to invalid dimension, weight, or serviceID, or if the information is missing.

  - `additionalParameters` (array)

## Response 401 fields (application/json):

  - `message` (string, required)
    This is HTTP 401 Unauthorized response status code, which indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.

## Response 404 fields (application/json):

  - `errorCode` (string)
    Error code(s) that appear due HTTP 404 Page or File not found.
    Example: not_found

  - `errorDescription` (string)
    The HTTP 404 Not Found response status code indicates that the server cannot find the requested resource.
    Example: resource not found

  - `additionalCode` (string)
    A unique identifier for the error, for example 0100025, 1110017, or 1090001.

  - `additionalInfo` (string)
    Additional information about the error. This error 'Not Found' might appear due to `Shipment Not Found`, `No Shipments to close`, or `Original Transaction not found`.

  - `additionalParameters` (array)

## Response 500 fields (application/json):

  - `message` (string, required)
    This is HTTP 500 Internal Server Error response status code, which indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

