Creating a Manifest
If you need to manifest labels created using ShipEngine, you can do so with our **/v1/manifests/ endpoint. This guide will walk you through the steps for creating a daily manifest.
To learn more about what manifests are, why they are useful, and how they work in ShipEngine, you can review our Manifests overview page.
A common manifest workflow has three main tasks:
- Determine which labels to include in the manifest and how you want to specify them in your request to ShipEngine
- Create the manifest
- Download the manifest
Requirements
- You must create your manifest on the same calendar date as the date on which the labels included in the manifest were created.
- You must have either the
label_ids
(for explicit manifests) or the properties you wish to use as criteria (for implicit manifests) in your request.
Determine Which Labels to Manifest
The first step in creating a manifest is determining which labels to include in the manifest and the best way to specify them in your request to ShipEngine. In this example, we'll use the simple case of creating a manifest for all labels created today.
To get a list of the labels that were created today, we will use the list labels endpoint and pass some query parameters to filter the data.
Example Request & Response
GET /v1/labels
In this example, we'll use created_at_start
and created_at_end
query parameters. These parameters define a time range and allow us to get the list of labels that were created on a particular business day. Without these parameters, this endpoint will return all labels.
Response
Depending on how many labels were created in this time range, we could expect a very long response. In this example, we truncate the response to just two labels.
Create the Manifest
When creating a manifest, you can explicitly or implicitly specify which labels to include in a manifest.
- Explicit manifests specify exactly which labels to include in the manifest with an array of
label_ids
. You may specify up to 500 labels in a single manifest. - Implicit manifests specify criteria for including labels in the manifest by adding the desired properties to the request body.
We've included examples of both types below.
Explicit Manifest Example
Using the two labels from the above GET labels request + one additional label, this request creates a manifest explicitly for these three labels.
POST /v1/manifests
Response
Each manifest contains an href
property with a URL where you can downlaod the manifest. There is also a top-level href
property that will contain the URL for the first manifest if more than one is returned.
Implicit Manifest Example
You may instead want to create a manifest that includes all the labels that match specific criteria. Labels that do not meet the specified criteria will be excluded from the manifest.
You may specify values for one or more of the properties below. ShipEngine will create a manifest that includes all labels that match the criteria you specify.
Property | Type | Description |
---|---|---|
carrier_id | string | required The carrier ID you wish to create a manifest for. This will exclude labels that do not use this specified carrier_id . |
warehouse_id | string | required The Warehouse ID this manifest is being created for. This will exclude labels that do not use the specified warehouse_id . |
ship_date | date string | required, ISO 8601 Standard The ship date you want to include labels for. Example: 2019-07-25T15:24:46.657Z |
excluded_label_ids | string array | The label_ids that you do NOT wish to manifest, even if they meet the rest of the specified criteria. |
POST /v1/manifests
Response
As is the case with the explicit manifests, each manifest contains an href
property with a URL to downlaod the manifest.
About the Manifest Response
In the above examples, the responses included a single manifest. However, your response could include more than one manifest.
Each manifest includes labels with the same ship_date
, carrier_id
, and warehouse_id
. ShipEngine will create multiple manifests if you send labels with different values for those properties. For example, if you specify label_ids
for USPS and FedEx for the same warehouse and ship date, ShipEngine will return two manifests - one for USPS labels with the specified warehouse and ship date and one for FedEx labels with the specified warehouse and ship date.
You can also receive multiple manifests in the response if your request includes more than 500 labels since ShipEngine only includes 500 labels per manifest.
Response with Multiple Manifests
If the response you receive is split into multiple manifests, you'll notice that each manifest object contains an href
property with a URL where you can download a PDF version of the manifest. There is also a top-level href
that includes a URL where you can download the first manifest if multiple manifests are returned. Each manifest object indicates the specific label_ids
that are included in the manifest.
This example response includes two manifest objects.
Download the Manifest
Now that we've created the manifest(s), we have a URL to download the manifest PDF from.
We can enter this value directly in a web browser to view and download the file, or we can download it programmatically.
Example Request
This example downloads the manifest using the URL returned in the response above. Notice that you
must change the Content-Type
to Accept-type: application/pdf
.
Group Labels into Multiple Manifests
If you have multiple outgoing shipments per day, you may want to group your daily labels into more than one manifest.
You can use either the label_ids
property or the excluded_label_ids
property to group or control which labels are included in each manifest and avoid overlap. A label should be included in only one manifest.