Retrying a bulk Format queue: same Idempotency-Key, same queue
Resend a Sume bulk queue with the same Idempotency-Key and payload and you get 202 and the original queue. Change one item and you get 409. How to retry safely.

Reuse the key. On Sume bulk runs, the same Idempotency-Key with the same concurrency and items returns 202 and the existing queue, so a network timeout on create cannot start your 100 items twice. A different payload under that key returns 409 idempotency_conflict, and details.queue_id names the original queue.
The two outcomes
| Replay | Result | What to do |
|---|---|---|
| Same key, same concurrency and items | 202 and the existing queue | Continue polling |
| Same key, different payload | 409 idempotency_conflict | Read details.queue_id |
| New key, same items | A second queue | Only if you want duplicates |
What is different from a single run
A single Format run signals a replay. A bulk replay does not: it stays 202, and the queue object has no idempotency_hit field. You cannot tell a replay from a first create by the response alone, so decide it on your side: store the key and queue id together before you send.
Rules that follow
- Mint a fresh key per batch, for example a UUID, not one key per client name.
- Keys are scoped to one Format, so the same key on a different Format is a different queue.
- The key can go in the Idempotency-Key header or an idempotency_key body field. The header wins.
- Appending an item to a retried payload is a change: expect 409, not an updated queue.
Safe retry in Python
import json, os, urllib.request
URL = "https://api.sume.com/v1/formats/your-handle/product-promo/bulk-runs"
body = json.dumps({"concurrency": 2, "items": [{"instruction": "clip 1"}, {"instruction": "clip 2"}]}).encode()
def create(key):
req = urllib.request.Request(URL, data=body, method="POST", headers={
"Authorization": "Bearer " + os.environ["SUME_API_KEY"],
"Content-Type": "application/json",
"Idempotency-Key": key,
})
with urllib.request.urlopen(req) as r:
return json.load(r)["data"]["id"]
key = "batch-2026-10-03-a"
print(create(key))
print(create(key)) # same key and payload: same queue idSources
Related posts
More in Formats
- Bulk run items ignore on_active_run skip and reject
A Format bulk queue runs every item with on_active_run allow, so skip or reject on an item will not serialize it. Set concurrency to control parallel runs.
- Revise 20 finished videos in one Sume bulk queue with previous_run_id
Each bulk item can carry previous_run_id, so one queue re-edits twenty finished runs. A preflight for thread_id, the repeated schema, and the cost per item.
- Bulk virtual try-on videos for a catalog: 100 SKUs per queue
Queue up to 100 try-on runs in one POST: concurrency 1 to 16, one garment image per item, a spend cap each, and how to read the failures afterwards.
- Calling a Formats by Sume entry: the sume handle, not yours
Formats by Sume run at POST /v1/formats/sume/{slug}/runs with any key holding formats:write. Your own handle returns 404, and a fork lives at your handle.
Written by Sume