Label Batches
Batches are an advanced ShipEngine feature for generating hundreds or thousands of labels at a time. When ShipEngine generates labels, it relies on many carriers, their services, their dependencies, and multiple other variables to fulfill your requests. Combined, all of these requests can take a few minutes.
With our batch feature, you can process labels in bulk and receive a large number of labels and customs forms in bulk responses.
Common Use Cases
A primary use case for batching is printing bulk labels and customs forms. Essentially, it's easier send a single document with 100 "labels" to a label printer than it is to send 100 documents with one label each.
You can also use batches to group shipments for processing internally at your warehouse. For example, batch labels that ship from a specific warehouse or have specific packing or shipping requirements (like a morning pickup batch, a contains alcohol batch, etc).
Batch Lifecycle
The basic lifecylce of a batch includes these four tasks:
- Create a batch
- Add shipment_ids and/or rate_ids to the batch
- Process the batch
- Get batch details including batch status, list of errors (if any), and download the resources.
Requirements
- The shipments you add to a batch must use a
warehouse_id
instead of theship_from
address. - All shipments in a batch must be assigned the same
warehouse_id
. - All shipments in a batch, whether added with
shipment_id
orrate_id
must have acarrier_id
andservice_code
.
Error Handling
Errors in batches must be handled differently from synchronous requests. You must retrieve the status of your batch by getting a batch and getting an overview of the statuses, or by listing the batch errors.
Invalid or Completed with Errors
If the batch enters an Invalid or Completed with Errors state, you cannot re-use the batch.
- List the batch errors to extract the shipments and the reasons why they failed.
- Correct the errors in the shipments by updating the shipment.
- Create a new batch for the shipments and rates in the invalid or error state.
- Process the new batch.