Rate Limit
Storyblok's GraphQL API limits differ from the Content Delivery API limits because a single GraphQL call can replace multiple REST calls.
To accurately represent a query's server cost, Storyblok's GraphQL API calculates a call's rate limit score based on a normalized scale of points. A query's score factors the first and last arguments on a parent connection and its children.
The formula uses the first and last arguments on a parent connection and its children to pre-calculate the potential load on Storyblok's systems. Each new connection has its own point value. Points are combined with other points from the call into an overall rate limit score.
Storyblok's GraphQL API rate limit is 100 points per second. Note that 100 points per second is not the same as 100 calls per second.
If the GraphQL API reaches 100 points per second, it will return the status code 429
which means you can retry your call with a delay later. The delay depends on the query. In a production scenario where multiple subsequent requests are sent, even if you retry after a second, some of the requests will fail if they are sent after the per-second limit is breached.
Estimate the cost of a query
A GraphQL object called RateLimit
with a property called maxcost
will return an approximation of the maximum cost of a single request with the specific query performed.
For example, if the maxcost
of a query is 3 and 10 requests are performed, you will not consume 30 points because 3 is merely an upward approximation. To calculate the number of requests you can perform per second, divide 100 by 3. In this particular example, you can safely perform 33 requests per second.
Relying on maxcost
ensures operation within limits, avoiding a 429
response. Cached requests have no cost.