Idempotency
Idempotency
The API can safely retry a POST or PUT without performing that operation twice. Send an Idempotency-Key header when you create or update a resource. If the connection fails before you receive a response, repeat the same request with the same key.
The header is not an operation parameter. Send it with the other headers for that request, alongside Authorization. Do not set one key as a default on an SDK client. Each logical operation needs its own key, and a retry must send that same key again.
The key is scoped to the authenticated account. Calls made with an API app are also scoped to that app.
Sending a key
Generate the key in your integration. It must be 1 to 255 characters, and unique for a single operation on that account for 24 hours. Use a version 4 UUID. Another random string is fine when it has enough entropy to avoid collisions. You can also derive the key from your own object id, such as an internal order id, when that id already identifies one submission.
Do not put sensitive data in the key. Email addresses and other personal identifiers are not keys.
A missing header means the request is not idempotent. An empty value or a value longer than 255 characters returns 400 bad_request.
GET and DELETE are safe to retry without this header. Do not send Idempotency-Key on those methods. The API ignores it.
In the official SDKs, send Idempotency-Key with that single call. Generate the UUID once, then reuse it if you retry. Python, Node, and Ruby accept the header on the method. C#, Java, and PHP read extra headers from the client configuration, so set the key immediately before the call and clear it immediately after. A key left on the client is sent again with the next request.
Retries
Retry with the same key and the same parameters when you never received a response, such as a timeout or a dropped connection. The API keeps the result for 24 hours. Retry with that key only inside that window. After it expires, the same key starts a new request. Check the resource or wait for a callback before sending the operation again.
A request matches when the HTTP method, path, query, parameters, and uploaded file contents match. Key order inside JSON objects does not make the request different.
Replayed responses
The first completed result for a key is saved, including a 4xx or 500 from a request that ran. A later call with the same key and the same parameters returns that status code and body. Any response to a request that included Idempotency-Key includes Idempotent-Replayed. The first response uses false. A stored response uses true:
The result is saved once the operation has started. These responses are not saved, so you can retry them with the same key:
401or another failure that happens before the operation starts409while the original request with that key is still in progress
Wait briefly, then retry an in-progress 409 with the same key and the same parameters.
When to use a new key
Send a new key when the request itself changed. Reusing a key with different parameters returns 409 conflict and does not replace the saved result.
For a completed 4xx, generate a new key after you correct the request. Treat a completed 500 as indeterminate: the original request may already have created or changed a resource. Prefer the saved result, or check the resource and listen for a callback, instead of sending a new key to force the operation through again.
A 409 can also mean the target resource cannot accept the request yet, such as a signature request that is still being set up. See Warnings and Errors.