Idempotent requests
Shopify APIs support idempotency, which allows you to safely retry API requests that might have failed due to connection issues, without causing duplication or conflicts.
Idempotency keys
Anchor link to section titled "Idempotency keys"An idempotency key (idempotencyKey
) is a unique string identifier generated by your app. Shopify uses this identifier to recognize subsequent retries of the same request.
How idempotent requests work
Anchor link to section titled "How 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, the subscriptionBillingAttemptCreate
mutation supports idempotency. By including an idempotency key in your request, you ensure that repeated requests with the same parameters will be executed only once, regardless of how many times the request is retried:
Resources that accept idempotency keys
Anchor link to section titled "Resources that accept idempotency keys"Requests that process credit card payments, create billing attempts for subscriptions, or capture revenue details accept idempotency keys. Requests that update or delete objects are idempotent by definition, and don't require you to send an idempotency key as part of the request.
Some examples of objects that accept an idempotency key include the following:
GraphQL Admin API
AppRevenueAttributionRecord
AppRevenueAttributionRecordInput
SubscriptionBillingAttempt
SubscriptionBillingAttemptInput
subscriptionBillingAttemptCreate
GraphQL Storefront API