> ## Documentation Index
> Fetch the complete documentation index at: https://docs.genlook.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Batches

> Run many try-ons at half price, delivered within 4 hours.

A batch runs up to 500 try-ons in one request at **half a credit each**. Batches run on spare capacity, so results come in over the following minutes or hours, always within 4 hours. Use them for catalog shoots, lookbooks, pre-generating results for your own models, or anything that does not need an answer right away.

For a shopper waiting on screen, use [Create Try-On](/docs/tryon-api/endpoints/create-try-on) instead.

## Who can use them

Accounts that have bought credits or subscribed to a plan. Free signup credits do not work for batches.

## Pricing

| | Credits |
| - | - |
| At submit | Half a credit per item, rounded up for the batch, is held. |
| When the batch is done | Half a credit per **completed** item, rounded up. The rest goes back to your balance. |

Failed, cancelled and expired items are never charged. A batch of 3 completed items costs 2 credits. An item with [several products](/docs/tryon-api/multi-product) counts once per product.

## What an item looks like

Each item is the [Create Try-On](/docs/tryon-api/endpoints/create-try-on#body) body, plus an optional `customId` of your own. Two differences:

* **JSON only.** Images go by `url`, or for the person by the `id` of a prior [Upload Image](/docs/tryon-api/endpoints/upload-image). No file uploads in a batch.
* **Garments only.** Items whose product is not clothing fail with `BATCH_PRODUCT_NOT_SUPPORTED`, at no charge. Send those through Create Try-On.

## Getting the results

* **Webhooks.** Every item sends its own `generation.completed` or `generation.failed`. Subscribe to `batch.completed` to hear when the whole batch is done.
* **Polling.** [Get Batch](/docs/tryon-api/endpoints/get-batch) works at any time, not only at the end: it returns the progress counts and every item so far, page by page, with `resultImageUrl` on the ones already done.

## Cancelling and expiry

[Cancel Batch](/docs/tryon-api/endpoints/cancel-batch) stops every item that has not started; they fail with `BATCH_CANCELLED`. Items already running finish and are charged.

An item that has not run 4 hours after the batch was created fails with `BATCH_EXPIRED`, and the batch ends as `EXPIRED`.

## With the SDK

```ts theme={null}
const batch = await client.batches.create({
  items: looks.map((look) => ({
    customId: look.sku,
    products: [{ externalId: look.sku }],
    person: { image: { source: { id: modelImageId } } },
  })),
});

// Later, or from your batch.completed webhook:
const items = await client.batches.items(batch.batchId);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.