SHOPLINE API rate limit
There are circumstances where platforms need to limit their rates to prevent the abuse of platform resources while ensuring smooth operation and fair competition between merchants. Developers should adhere to industry standards, limit calls, and be discreet about making retry requests.
What’s a rate limit
- The term 'rate limit' refers to the restriction on the number of requests sent to the server within a specific period.
- All types of SHOPLINE APIs adopt the Leaky Bucket method(or “Leaky Bucket”), allowing developers to send infinite requests to the platform in a controlled manner.
- APIs in different styles have different ways to limit rate based on Leaky Bucket, which we’ll explain below.
Leaky Bucket
Here's a quick illustration of how Leaky Bucket works:
- For each store, your app will get a space that can hold up to 40 small balls.
- While these small balls are stored in this space, the platform takes them out at a rate of up to 4 balls per second.
- Once your storage space is filled with 40 small balls, you’ll no longer be able to send more small balls into the space. Instead, you'll receive an error message saying you've reached the storage limit.
- Therefore, you can store up to 40 small balls at a time. After that, you'll either need to wait for them to be slowly taken out or trim your storage request to a rate lower than the outflow speed of 4 balls per second.
The Leaky Bucket method applies to all SHOPLINE APIs, though the storage space calculation may vary. We will now explain the three ways in which rate limiting work.
Rate limit method
Request-based limit
This method sets a time frame for making app requests (e.g., 60 requests within 60 seconds). All requests are counted equally, regardless of the amount of data returned. The REST API currently uses this method.
Based on cost point
This method calculates the cost of requests based on their complexity and sets a limit based on the total cost per unit of time. For example, you can set a limit of only 1000 cost points within 60 seconds. The cost of each request will be calculated based on the type and quantity of the output.
Based on time resource
This method calculates the cost based on the time spent requesting the resource. Then, it determines and limits the total cost of each request's response time (e.g., for 60 seconds) by stacking the same IP address. The time cost is then calculated based on the stacked response time.
The Storefront API currently uses this method.
This limit is calculated based on the store's IP
address rather than individual stores.
Rate limit comparison between plans
Below are SHOPLINE APIs' rate-limiting methods and the corresponding standards of each plan
API | Rate limit method | Standard | Enterprise Limit |
---|---|---|---|
REST Admin API | Request-based limit | 4 requests/second | *Unlimited |
GraphQL Admin API | Calculated query cost | Coming soon | Coming soon |
Storefront API | Time-based limit | 1 second/APP/IP | 1 second/APP/IP |
Unlimited rate for enterprise customers means stores under the same enterprise won't be bound by the request amount limit per unit of time. However, there could still be basic logistical constraints that may restrict the maximum data flow.
Why you need unlimited API rate
- Better user experience: receive data more quickly when using third-party plugins.
- High flexibility: control flow rates according to your needs and stop worrying about constraints from rate limits.
- Enhanced stability: stores can better handle scenarios when many users are accessing the store simultaneously and be free from risks caused by rate limits.
- Scalability: works better for scenarios that require a massive number of API calls, such as data synchronization and bulk updates.
Error loading component.