Idempotent requests in the REST Admin API
The REST Admin API is a legacy API as of October 1, 2024. All apps and integrations should be built with the GraphQL Admin API. For details and migration steps, visit our migration guide.
The REST Admin API supports idempotency, which allows you to safely retry API requests that might have failed due to connection issues, without causing duplication or conflicts.
Anchor to What is an idempotency key?What is an idempotency key?
An idempotency key (unique_token
) is a unique string identifier generated by your app. Shopify uses this identifier to recognize subsequent retries of the same request.
Anchor to How idempotent requests workHow idempotent requests work
If an API request is disrupted in transit, then you might not receive a response. By including an idempotency key in your request, repeated requests with the same parameters will be executed only once, no matter how many times the request is retried.
For example, you might be using the REST Admin API's Payment
resource to process a payment in Shopify. If you don't receive a response due to a network connection error, then you can retry the request with the same unique_token
to guarantee that only one payment is processed:
You can use any unique identifier for your idempotency key, but we recommend using a randomly generated universally unique identifier (UUID) to avoid collisions.
Anchor to Requests that accept idempotency keysRequests that accept idempotency keys
POST requests that process credit card payments, create billing attempts for subscriptions, or capture revenue details accept idempotency keys. GET and DELETE requests are idempotent by definition, and don't require you to send an idempotency key as part of the request.