# Batches

Group shipments for bulk processing.

## List batches

 - [GET /batches](https://docs.stallion.ca/openapi/batches/paths/~1batches/get.md)

## Create a batch

 - [POST /batches](https://docs.stallion.ca/openapi/batches/paths/~1batches/post.md)

## Get a batch by ID

 - [GET /batches/{batch_id}](https://docs.stallion.ca/openapi/batches/paths/~1batches~1%7Bbatch_id%7D/get.md): Returns the batch with its current status, shipment / processed /
error counts, and (when processed) embedded labels and errors
arrays. Use /batches/{id}/errors for just the error list.

## Update a batch

 - [PUT /batches/{batch_id}](https://docs.stallion.ca/openapi/batches/paths/~1batches~1%7Bbatch_id%7D/put.md)

## Process a batch

 - [POST /batches/{batch_id}/process](https://docs.stallion.ca/openapi/batches/paths/~1batches~1%7Bbatch_id%7D~1process/post.md): Purchases labels for every valid shipment in the batch. Returns
immediately with { "status": "processing" }; poll GET /batches/{id}
for completion and to retrieve labels and errors.

## Get batch errors

 - [GET /batches/{batch_id}/errors](https://docs.stallion.ca/openapi/batches/paths/~1batches~1%7Bbatch_id%7D~1errors/get.md): Returns shipments in the batch that failed to process.

## Add shipments to a batch

 - [POST /batches/{batch_id}/shipments](https://docs.stallion.ca/openapi/batches/paths/~1batches~1%7Bbatch_id%7D~1shipments/post.md)

## Remove shipments from a batch

 - [DELETE /batches/{batch_id}/shipments](https://docs.stallion.ca/openapi/batches/paths/~1batches~1%7Bbatch_id%7D~1shipments/delete.md)

