Limitations
The GraphQL Content API has limitations in place to protect against excessive or abusive calls to Swapcard servers.
The GraphQL Content API limit has two types of rate limiting:
- Call based limit
- Cost based limit
The call based limit counts the number of requests issued at the API during a given time.
The call based limit is set at 1000
points every minute. A request consumes 10
points.
For regular users, it is equivalent to 100
queries per minute.
You can check your current usage by checking the following headers in an API response:
X-RateLimit-Limit
: The maximum number of points that the consumer is permitted to make per minute.X-RateLimit-Remaining
: The number of points remaining in the current rate limit window.X-RateLimit-Reset
: The time at which the current rate limit window resets in UTC epoch seconds.Retry-After
: The number of seconds to wait before retrying the request.
The cost based limit is specific to GraphQL APIs. With GraphQL, one call can replace multiple REST calls. A single complex GraphQL call could be the equivalent of thousands of REST requests.
The GraphQL Content API can limit your queries based the following criteria:
- Cost: Maximum
20,000
points per query. An object is2
points, a scalar is1
point, depth factor applied is1.5x
- Depth: Maximum
20
levels. - Aliases: Maximum
50
aliases. - Tokens: Maximum
2,000
tokens. - Directives: Maximum
20
directives.
If your application requires different limits than specified above, please contact the support and include details on why it is necessary for your application to use different limits.
Heads up!
Heads up!