Braze retries a 500: keep the Sume job submit idempotent
Braze sends 500 and 502 responses to retry logic, and a :retry option exists. Give every Sume submit a stable Idempotency-Key so a retry is not a second bill.

Can a Braze retry create two Sume jobs?
It can if your endpoint submits a paid job on every request. Braze's docs say 500 and 502 responses go to its retry logic and that a :retry option exists. A retry reaches your server as a new request, so your code has to recognize it as the same request.
Sume requires an Idempotency-Key on paid POSTs. Derive it from what makes the request unique, such as the campaign id plus the segment, never from the clock or a random value.
What does Braze do with each status?
| Status | Braze behavior |
|---|---|
| 2xx | Success |
| 404 | Renders an empty string |
| 500, 502 | Retry logic |
| 429 | Treated as an endpoint failure |
| 301, 302 | Not followed |
How do I derive a stable key?
Hash the inputs that define the clip: avatar handle, script, aspect ratio and quality. The same inputs give the same key, and a different script gives a different key. Sume's docs also say not to resubmit the original paid request only because a local process timed out; poll the job instead.
Rather than submitting inside the Connected Content request at all, submit from a background step and have the lookup read the stored URL.
import hashlib, json
def idem_key(campaign, body):
blob = json.dumps(body, sort_keys=True)
digest = hashlib.sha256(blob.encode()).hexdigest()[:24]
return "braze-" + campaign + "-" + digest
body = {"avatar_handle": "your_avatar_handle",
"script": "Two more days at this price.",
"aspect_ratio": "9:16", "quality": "standard"}
print(idem_key("bf26", body))What else should the endpoint do on a retry?
Return 2xx for a request you already accepted, even if the clip is not ready; give the fallback URL in the body. A 429 is also treated by Braze as a failure, so protect your own endpoint from bursts. See retrying with the same key on a 429.
Sources
Related posts
More in Integrations
- Cherry Studio: add Sume as a remote MCP server and bind it
In Cherry Studio, add a server under Settings > MCP, enable it, check its tools, then bind it to an Agent. A server that is not started cannot be bound.
- Claude Code MCP_TOOL_TIMEOUT is about 28 hours; Sume waits 55 s
Claude Code lets a tool call run for about 28 hours by default, but Sume's hosted jobs_wait caps one call at 55 seconds. Why you still loop in short slices.
- Claude Code saves MCP text over 50,000 characters: size Sume reads
Claude Code writes long MCP text results to a file, and Sume caps a tool answer at 256 KiB. Read job waves in batches of 20 ids so each answer stays small.
- Cloudflare Worker: keep the image model id in KV and swap it live
A Worker that proxies POST /v1/images and reads the Sume model id from Workers KV, so replacing gpt-image-1 is a wrangler command, not a deploy.
Written by Sume