Skip to main content
When you need to analyze multiple shelf photos — for example, every aisle in a store or photos from a field team’s daily route — use the batch endpoint to submit up to 20 images in a single request.

When to use batch

  • Processing a set of photos from a single store visit
  • Analyzing images uploaded by field teams throughout the day
  • Running periodic audits across multiple locations
  • Any workflow where you have multiple images ready to submit at once

Submitting a batch

Send a POST request to the batch analyses endpoint with an array of images:

Request parameters

Response

Each image in the batch creates a separate analysis with its own ID. The analyses run in parallel.

Credit handling

Batch analysis uses an all-or-nothing credit check:
  • Each image costs 1 credit (same as a single analysis).
  • Before processing begins, Shelfforce verifies you have enough credits for the entire batch.
  • If you do not have enough credits, the entire request is rejected — no images are analyzed and no credits are consumed.

Retrieving results

Each analysis in the batch has its own ID. Poll individual analyses for results:
Or use webhooks to be notified as each analysis completes. If you provided a callbackUrl in the batch request, you will receive a separate webhook for each image as it finishes.

Checking batch status

You can also query the batch endpoint to see the status of all analyses in the batch:
The batch status is one of:
  • processing — All analyses are still running.
  • partial — Some analyses have completed, others are still running.
  • completed — All analyses have finished (either completed or failed).

Idempotency keys

Use idempotency keys to safely retry batch requests without creating duplicate analyses. If a request with the same idempotency key is submitted again, Shelfforce returns the existing analysis instead of creating a new one.
Idempotency keys are scoped to your organisation and expire after 24 hours. Use a combination of store, location, and date to create meaningful keys.

Best practices

Group by store visit

Submit all photos from a single store visit in one batch. This makes it easy to correlate results and reduces API calls.

Use metadata

Attach store IDs, aisle numbers, and dates as metadata so you can filter and group results later.

Use idempotency keys

Always include idempotency keys, especially when retrying failed requests or when your pipeline might submit the same image twice.

Combine with webhooks

Set a callbackUrl on the batch or register a persistent webhook for analysis.completed to avoid polling each analysis individually.

Limits

The maximum number of images per batch depends on your plan tier: You can check your current batch limit programmatically via GET /api/v1/usage — the response includes a maxBatchSize field.
If you need to process more images than your tier allows, split them into multiple batch requests. Use idempotency keys to prevent duplicates if you are retrying.