Tutorial: Retrieve Previously Generated Shipment Documents

How to return previously generated shipping documents for a single package.

API Version: v2

This tutorial shows how to return previously generated shipping documents for a single package. For example, you might retrieve a previously generated label for reprinting.

Note: The getShipmentDocuments operation returns shipping documents in the document format originally requested. For instance, if you request a label in PNG format when you purchase a shipment, a subsequent call to getShipmentDocuments returns the original PNG format label. If you need a different document type, you must cancel the shipment and generate a new shipment with the desired document type.

Note: This operation is not unavailable for Direct Fulfillment shipments.

Prerequisites

To complete this tutorial, you will need:

  • Enrollment in an eligible program.
  • A selling-partner account if you are an Amazon seller or are working with an Amazon seller to create and manage shipments.
  • Authorization from the selling-partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.

Step 1. Retrieve previously generated shipping documents

To return previously generated shipment documents, call the getShipmentDocuments operation for a shipment, passing the following parameters:

Request path parameter

Name Description Required
shipmentID The shipment identifier originally returned by the purchaseShipment operation.

Type: string

Yes

Request query parameters

Name Description Required
packageClientReferenceID The package client reference identifier originally provided in the request body parameter for the getRates operation.

Type: string

Yes
format The file format of the document. Must be one of the supported formats returned by the getRates operation.

Type: string

No
dpi The resolution of the document (for example, 300 means 300 dots per inch).

Type: number

No

Request header parameters

Name Description Required
x-amzn-shipping-business-id Amazon shipping business to assume for this request. The default is AmazonShipping_UK.

Type: enum (X-amzn-shipping-business-id)

Yes
x-amzn-access-token Amazon shipping request token Yes

Response

A successful response includes the following:

Name Description Required
shipmentId Returns the unique shipment identifier for a given shipment.

Type: string

Yes
packageDocumentDetail Container for package document details.

Type: PackageDocumentDetail

Yes

Sample API Request

GET https://sellingpartnerapi-eu.amazon.com/shipping/sandbox/v2/shipments/amzn1.dd2b0cec-b215-4504-b94d-d6469b0c4a63/documents?packageClientReferenceId=abcd&format=PNG&dpi=300
x-amzn-shipping-business-id: [x-amzn-shipping-business-id](https://developer-docs.amazon.com/amazon-shipping/docs/frequently-asked-questions#which-x-amzn-shipping-business-id-to-use-as-request-header-while-calling-shipping-v2-api)
x-amz-access-token: Atza|IwEBIGorlXXX

API Response examples

{
  "payload": {
    "shipmentId": "amzn1.dd2b0cec-b215-4504-b94d-d6469b0c4a63",
    "packageDocumentDetail": {
      "packageClientReferenceId": "ASUSDI-45343854",
      "packageDocuments": [
        {
          "type": "LABEL",
          "contents": "iVBORw0KGgoAAAANSUhEUgAABLAAAAcIAgAAAABDi383AAAACXBIWXMAAC4jAA4/JrkGaSNZARsAAAAASUVORK5CYII=",
          "format": "PNG"
        }
      ],
      "trackingId": "90171138606915760111801497834333303801954"
    }
  }
}