A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hey all,
I've triggered a Shopify REST API multiple times and the request got throttled. The header info of this throttled request had the value - "X-Shopify-Shop-Api-Call-Limit": ["1/40"].
However, as per the Shopify document ( reference - https://shopify.dev/api/usage/rate-limits#rest-admin-api-rate-limits ), the request would be throttled once the request goes over a rate limit (example- X-Shopify-Shop-Api-Call-Limit: 40/40 ).
Can someone please help if there is any field in the header information or any way I can identify the throttled requests, and handle such scenarios accordingly.
Hey @SachinSS
If you had the x-request_id from the throttled request headers we can take a look!
On the throttled requests, they would return a client side 429 status - "too many requests" - and a message that a throttle had been applied.
Sounds like you know about the X-Shopify-Shop-Api-Call-Limit header already, but The Retry-After header contains the number of seconds to wait until you can make a request again once you've been throttled. Worth noting though, that any request made before the wait time has finished will be throttled.
There's some recommendations on handling such scenario's here if it helps too. Thanks!
Hey @Luke_K ,
Thank you for your response.
Here is the request ID for one such throttled request - "X-Request-ID": ["e6ca081e-4d49-4b17-96ab-9e6721e13281"]
This header payload did not contain the "Retry-After" field as well.
Please let me know if you need any further information to look into this issue.
Hey @SachinSS
Thanks! I checked out that request ID and I see what's happening now.
So you're hitting the update_tracking.json endpoint more than 5 times a minute. On the 429 throttle, you should be returned "upgrade to a paid account to remove this limit".
I can see you're making these calls on a Partner Test Store and you're hitting that resource more than 5 times a minute. Certain endpoints like the Fulfillments endpoint has restrictions on the amount of calls per minute - please see here. If you'd like to hit that endpoint more than that, you would need to upgrade to a paid plan.
I note you're calling 2019-10 of the API - well worth bumping up to the latest 2021-07 version (versioning docs here if need be). Hope that explains at least!
Does anyone know how to view this mysterious X-Shopify-Shop-Api-Call-Limit header?
I'm using Ruby, but if anyone else is using anything else and they can put in how they did it, it would be fantastic.
I'm using the Ruby gem so mine looks like:
Hi @Todd_Trimakas 👋
It should be returned as `http_x_shopify_shop_api_call_limit` in a verbose curl request as shown below. Alternatively, the shopify-api-ruby repo would be a great place to ask as well.
curl -v -L -X GET 'https://store.myshopify.com/admin/api/2023-01/shop.json' \
-H 'X-Shopify-Access-Token: shpat_abc'
Hope that helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog