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 aPOST request to the batch analyses endpoint with an array of images:
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
images | array | Yes | Array of image objects. Max size depends on your plan tier (see Limits). |
images[].imageUrl | string | Yes | Publicly accessible URL of the shelf image. |
images[].externalId | string | No | Your own reference ID for this image (e.g., customer ID, campaign ID). |
images[].metadata | object | No | Arbitrary key-value pairs (max 10 keys, string values, 500 chars each). |
images[].placeId | string | No | Shelfforce place ID to associate with this image. |
images[].taskId | string | No | Shelfforce task ID to associate with this image. |
callbackUrl | string | No | HTTPS URL to receive a POST for each completed/failed analysis. A callbackSecret is returned per analysis for signature verification. |
Response
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: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: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:| Plan | Max images per batch |
|---|---|
| Free | 20 |
| Starter | 20 |
| Growth | 50 |
| Pro | 100 |
| Scale | 200 |
GET /api/v1/usage — the response includes a maxBatchSize field.
| Constraint | Value |
|---|---|
| Maximum image file size | 20 MB |
| Supported formats | JPEG, PNG, WebP |