Skip to main content
Networks fail after the work started, so a client cannot always tell whether a request went through. An Idempotency-Key makes the retry safe: the same key and the same request never run twice.
Generate one UUIDv4 per logical request, store it before you send, and send the same value on every retry of that request.

The rules

What a retry answers

When to retry

The problem says it in retry: Before a new attempt at paid work, call the estimate again, because the price may have changed. A higher price is a new decision for whoever accepted the first one, so do not send it as the price cap on your own. A client that may restart keeps its keys where a restart finds them. The Quickstart’s client saves them in a file with the price it accepted, so a rerun sends the same requests and the API replays them.

Edits and deletes

An edit that requires If-Match is protected twice. Its stale ETag makes a blind retry fail with 412, and the replay check runs before the If-Match check, so a retry of a successful edit with its key replays instead of failing. Send a key on those too. A DELETE takes no key, and repeating it answers 204 for at least 30 days after the delete. The one exception is deleteSegment, a hard delete that returns an edit result: it accepts a key, and without one a repeat answers 404 segment_not_found.