Skip to main content
The Batch endpoint allows you to create and purchase up to 10,000 shipments in a single API request. There are three main steps to the Batch workflow: step 1 icon Create the batch: POST a list of shipments to be purchased with one API call step 2 icon Fix validation issues , if any: after creating a batch, Shippo validates the shipment data. Any shipments that failed validation need to be fixed step 3 icon Purchase the batch: purchase labels for all shipments in the batch with one API call

Creating the batch

The Batch Object contains an array of BatchShipment. The BatchShipment Object acts as a wrapper around the Shipment Object, containing shipment-specific service level information such as carrier and service level. To create a batch, send a JSON request to the Batch endpoint with an array of BatchShipment objects. The following is an example of the request.
This request is done asynchronously. An empty Batch object is returned first while BatchShipments are created in the background. Since creating many Shipments can take some time, asynchronous requests will let you process other tasks in the meantime. You can opt to be notified when the Shipment creation is complete through a webhook or polling. You can set up your webhooks from your Shippo dashboard, by setting the event type to batch_created. For more information, see our Webhooks tutorial. Here is a sample of the empty response.

Default service levels vs. per-shipment service levels

When creating your Batch, you can choose to apply one carrier service level for all your Shipments, or specify the service level on a per-shipment bases. Please see our service level tokens in the API reference guide. If you want to set one service levels for all the Shipments in your batch, you can specify the service level token with default_servicelevel_token field in your Batch request. This field can be overridden on a per-shipment basis by filling out the optional servicelevel_token field on the BatchShipment object. The following is an example of this behavior:

Fix validation issues

Once the Batch Object is created, the status will change from VALIDATING to either VALID or INVALID. If the status is INVALID, that means some BatchShipments in the Batch have errors that need to be fixed before you can purchase labels. To find invalid BatchShipments in the Batch, set the object_results query parameter on the Batch endpoint to filter by Shipments that have failed. The following is an example of using the object_results query parameter:
The object_results query parameter accepts the following values:
  • creation_failed
  • creation_succeeded
  • purchase_succeeded
  • purchase_failed
You can remove invalid BatchShipment objects by sending a PUT request with the invalid BatchShipment object IDs to the following endpoint:
Here is what the sample request should look like:
Or you can add fixed or new shipments to the batch by passing a POST request with a list of BatchShipment objects to the endpoint:
Here’s a sample of what the request payload should look like:
Once all shipments have been fixed, identified by the VALID Batch status, you can then proceed to purchase the Batch.

Purchase the batch

To purchase the batch, simply send an empty POST request to the endpoint:
Here’s the purchase response:
This step is done asynchronously as well. You can register a webhook with the event type batch_purchased to get push notifications when your labels are ready. Again, for more information, see our Webhooks tutorial. If there are any failed transactions, you can find them directly with the object_results=purchase_failedquery parameter. When the purchase is complete, you can download the labels as merged files. Each file contains a maximum of 100 labels. The label_url field contains an array of URLs, one URL for each file. Each file is a PDF file or a ZIP file. The label_filetype of the batch sets the file type. If the batch has no label_filetype, Shippo uses the default label format of your account.
  • If label_filetype is PDF, PDF_2.3x7.5, PDF_4x6, PDF_4x8, PDF_A4, or PDF_A6, the file is one PDF file that contains all the labels.
  • If label_filetype is PNG, PNG_2.3x7.5, PDF_A5, or ZPLII, the file is a ZIP file. The ZIP file contains one file for each label.
  • If one or more labels in the file are ZPL labels, the file is a ZIP file for all values of label_filetype.
To find the file type before download, read the file extension in the URL path (.pdf or .zip). Each URL in label_url expires. Before you download a file, read the Expires query parameter on the URL. If Expires is in the past, read the object_created value of the batch:
  • If object_created is more than one year ago, the file is no longer available. Do not call GET /batches/{BatchId}.
  • If object_created is less than one year ago, call GET /batches/{BatchId} to get new label_url values.
Last modified on November 19, 2026