---
title: "Get batches"
description: "Read the batch settings of a preorder offer: release strategy, advance schedule, labels, storefront widget and the kept batches in order."
url: https://docs.stoqapp.com/v2-reference/preorders-offers/get-batches/
api: "API v2 reference"
method: GET
path: "/preorders/offers/{id}/batches"
---

# Get batches

`GET https://app.stoqapp.com/api/v2/external/preorders/offers/{id}/batches`

Read the batch settings of a preorder offer: release strategy, advance schedule, labels, storefront widget and the kept batches in order.

**Note:** Batches only run while `release_strategy` is `sequential`, which needs a paid plan, at least two items and an offer not scoped to markets. With `advance_schedule` `automatic` a variant moves to the next batch once it sells that batch's `quantity_limit`; with `manual` it waits for [`POST /preorders/offers/:id/products/advance_batches`](https://docs.stoqapp.com/v2-reference/preorders-offers/advance-an-offers-batches/). Each item's `label` comes from `label_format` and is read-only. Per-variant batch limits and progress are on [`GET /preorders/offers/:id/products/variants`](https://docs.stoqapp.com/v2-reference/preorders-offers/list-an-offers-variants/). Edit with [`PATCH /preorders/offers/:id/batches`](https://docs.stoqapp.com/v2-reference/preorders-offers/update-batches/).

## Path parameters

- `id` (string, required): The offer's ID, from [`GET /preorders/offers`](https://docs.stoqapp.com/v2-reference/preorders-offers/list-offers/).

## Returns

- `release_strategy` (string): sequential sells the batches one after another; all_at_once means batches are off. One of: `sequential`, `all_at_once`.
- `advance_schedule` (string): automatic moves to the next batch when one sells its quantity_limit; manual waits for the merchant. One of: `automatic`, `manual`.
- `label_format` (string): Batch name format; {{ n }} is replaced by the position. Null uses &quot;Batch {{ n }}&quot;.
- `status_text` (object): Words shown on the storefront for past, live and upcoming batches.
  - `past` (string): Word shown for a batch that has passed.
  - `live` (string): Word shown for the batch on sale now.
  - `upcoming` (string): Word shown for a batch still to come.
- `widget` (object): Layout and content of the storefront batch widget.
  - `style` (string): Batch widget layout: roadmap, stacked, compact or segmented.
  - `progress` (string): counts shows units sold of the limit; percent shows a percentage. One of: `counts`, `percent`.
  - `show_other_ship_dates` (boolean): Whether the other batches' ship dates show on the storefront.
  - `show_names` (boolean): Whether batch names show on the storefront.
- `items` (array of objects): The batches, in selling order. Archived batches are left out.
  - `id` (string): Batch ID, used as the key in a variant's batch_limits and batch_ship_texts.
  - `position` (integer): Place in the selling order, from 1.
  - `quantity_limit` (integer): Units the batch can sell. Null when unlimited.
  - `shipping_text` (string): Ship text shown while this batch is on sale.
  - `label` (string): Batch name, from label_format with its position filled in.

Rate limit: this call costs 1 point ([rate limits](https://docs.stoqapp.com/docs/rate-limits/)).

## Example request

```sh
curl "https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/batches" \
  -H "X-Auth-Token: $STOQ_API_KEY"
```

## 200

Success: the requested resource.

```json
{
  "release_strategy": "sequential",
  "advance_schedule": "automatic",
  "label_format": "string",
  "status_text": {
    "past": "string",
    "live": "string",
    "upcoming": "string"
  },
  "widget": {
    "style": "string",
    "progress": "counts",
    "show_other_ship_dates": true,
    "show_names": true
  },
  "items": [
    {
      "id": "string",
      "position": 1,
      "quantity_limit": 1,
      "shipping_text": "string",
      "label": "string"
    }
  ]
}
```

## 401

Missing or invalid `X-Auth-Token`.

```json
{
  "errors": [
    "Invalid API key"
  ],
  "code": "auth_invalid",
  "details": [
    {
      "code": "auth_invalid",
      "message": "Invalid API key",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 404

The resource does not exist for this shop, or the action path is not registered.

```json
{
  "errors": [
    "Offer not found"
  ],
  "code": "not_found",
  "details": [
    {
      "code": "not_found",
      "message": "Offer not found",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 422

The request failed validation.

```json
{
  "errors": [
    "name is required"
  ],
  "code": "validation_failed",
  "details": [
    {
      "code": "validation_failed",
      "message": "name is required",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 429

Rate limited: cost-weighted per token (read 1, write 2; 360 points / 60s). Check `Retry-After`.

```json
{
  "errors": [
    "Rate limit exceeded"
  ],
  "code": "rate_limited",
  "details": [
    {
      "code": "rate_limited",
      "message": "Rate limit exceeded",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

