Idempotency-Key header that makes retries safe. This guide demonstrates it with two requests.
Step 1: Send a create request with an idempotency key
Generate a unique string per logical operation — a UUID works well — and send it in theIdempotency-Key header:
Request
Response
Step 2: Retry the identical request
Sending the exact same request with the same key does not create a second folder — the stored response is replayed:Request
Response
Idempotency-Replayed response header tells you it was a replay. Keys are remembered for a limited time after completion; reusing a key with a different payload is rejected with 422, and a retry that arrives while the original is still being processed is answered with 409 — wait and retry.
Complete example
A create that survives a timeout, as a Node.js script. The key is generated once, outside the retry loop, so every attempt is the same logical operation.Next steps
- Decide which failures are worth retrying at all — Handle errors.
- Retry a document create the same way — Create a document from a file.
- Which operations accept
Idempotency-Keyis documented per endpoint in the API reference.