Reference Information for Shopify API Rate Limits

Tadashi Shigeoka ·  Thu, April 15, 2021

I’ll introduce reference information for considering Shopify API rate limits.

shopify

Background: Shopify API Has Rate Limits

As stated in the Shopify official documentation Shopify API rate limits, Shopify API has rate limits.

Shopify API Node.js (Official module)

In my case, I’m using the npm package shopify-api-node, so I make sure to specify the autoLimit option.

autoLimit - Optional - This option allows you to regulate the request rate in order to avoid hitting the rate limit. Requests are limited using the token bucket algorithm. Accepted values are a boolean or a plain JavaScript object. When using an object, the calls property and the interval property specify the refill rate and the bucketSize property the bucket size. For example { calls: 2, interval: 1000, bucketSize: 35 } specifies a limit of 2 requests per second with a burst of 35 requests. When set to true requests are limited as specified in the above example. Defaults to false.

Quote from: Options - MONEI/Shopify-api-node at 3.6.10

Using stopcock Internally

At shopify-api-node/index.js#L74-L84, it uses an npm package called stopcock, so if you’re interested, you might want to check that out as well.

  if (options.autoLimit) {
    const conf = transform(
      options.autoLimit,
      (result, value, key) => {
        if (key === 'calls') key = 'limit';
        result[key] = value;
      },
      { bucketSize: 35 }
    );

    this.request = stopcock(this.request, conf);
Limit the execution rate of a function using the token bucket algorithm. Useful for scenarios such as REST APIs consumption where the amount of requests per unit of time should not exceed a given threshold.

トークンバケットアルゴリズムを使用して、関数の実行速度を制限します。単位時間あたりのリクエスト数が特定の閾値を超えてはならないRESTAPIの消費などのシナリオに役立ちます。

Quote from: stopcock - npm

That’s all from the Gemba.