Re-render a Short's ending without double billing: Idempotency-Key

A Timeline render needs an Idempotency-Key. Reuse a key to retry the same request; use a new key when you change the ending.

5 min readSume
All posts

Every POST /v1/timeline-1.0/render needs an Idempotency-Key. Reuse the same key to retry an identical request after a timeout, and the request is a replay, not a second render. Change the ending, and you must also change the key, because the same key with a different body is a conflict, not a new render.

The header requirement is from the Timeline 1.0 doc; how jobs are polled is in the jobs doc. A related stored post covers the 409 conflict on another endpoint.

A key scheme that works

Put what identifies the output into the key: the Short, the version, and a short hash of the body.

  • Retry after a network error: send the same key and body.
  • New ending for the same Short: new key, such as short-42-v2-ending-b.
  • Different body, same key: expect an error; do not work around it by changing the body quietly.

Timeouts and sync mode

Default mode is async: you get a job and poll GET /v1/jobs/:id/status, then /result. A sync request waits up to 30 seconds. If a sync call times out, poll the job you were handed instead of submitting again; a second submit with a new key would be a second charge.

What does a retry cost?

An identical retry with the same key is the same job, so the render is billed once. A deliberate new version is a new job at $0.10 per ceil output minute.

Retry versus new version (read 2026-10-03)
ActionKeyResultBilling
Retry after timeoutSame key, same bodySame jobOnce
Swap the endingNew key, new bodyNew job$0.10 per ceil minute again
Edit body, keep keySame key, new bodyConflictNone

What Sume does not do

It does not choose keys. A key that never changes would make every later version collide.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume