A 5xx on a Sume paid submit never proves no job: retry with the key

On Sume, only a validation, authorization or balance error proves a paid create was refused. A 5xx does not, so retry with the same Idempotency-Key.

5 min readSume
All posts

On Sume, a failed paid create proves the work was refused only when the error names a validation, authorization or balance reason. A 5xx never does. Treat a 5xx on a submit as unknown, and retry with the same Idempotency-Key, so the retry adopts whatever the first call created instead of paying for it twice.

What each failure tells you

This is the rule in the OpenAPI text for the Idempotency-Key header, plus the status classes the SDK treats as retryable.

Reading a failed submit (read 2026-10-06)
ResponseJob created?Next step
400 validationNoFix the request
401 or 403NoFix the key or scope
402 balanceNoAdd funds, then submit
429No (rate limited)Wait retry-after, resend with the same key
5xx or no responseUnknownResend with the same key

The same key on the retry

The first call may have created a job before the error. With the key, the second call returns that job with idempotency_hit: true. Without a key, you may pay twice. The payload must stay the same, or you get 409 idempotency_conflict.

curl -X POST https://api.sume.com/v1/image-1.0/generate \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: hero-shot-2026-10-06-001" \
  -d '{"prompt":"Product hero shot of a matte black bottle on marble","mode":"async"}'
# Got a 502 or a timeout? Run the exact same command again.

In the SDK

createSumeClient retries 408, 429 and 5xx, and transport failures, but replays a POST only when it carries an Idempotency-Key.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume