Skip to main content

Limitations

The GraphQL Leads API has limitations in place to protect against excessive or abusive calls to Swapcard servers.

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 Leads API has two types of rate limiting:

  • Cost based limit
  • Query based limit

Cost based limit

The GraphQL Leads API assigns a cost to each query and limits the points that you can use within a specific amount of time.

The cost is calculated based on the complexity of the query and is defined in Query based limit.

You can check your current usage by checking the following headers in an API response:

  • X-RateLimit-Cost: The number of points that the query cost.
  • X-RateLimit-Used: The number of points you have used in the current rate limit window.
  • X-RateLimit-Remaining: The number of points remaining in the current rate limit window.
  • X-RateLimit-Limit: The maximum number of points that you can use per window.
  • X-RateLimit-Reset: The time at which the current rate limit window resets in UTC epoch seconds.

By default, this limit is set to 60,000 points per minute.

Query based limit

The GraphQL Leads API can limit a query based the following criteria:

  • Cost: Maximum 10,000 points. A mutation is 1,000 points, an object is 2 points, a scalar is 1 point, depth factor applied is 1.5x
  • Depth: Maximum 20 levels of nested objects.
  • Aliases: Maximum 50 aliases.
  • Tokens: Maximum 2,000 tokens. A token corresponds to a field, an argument, or an alias.
  • Directives: Maximum 20 directives.

Additional limits

  • The size of the request body must not exceed 1 megabyte.

If the integration requires different limits than specified above, please submit a request and include details on your queries and use-case.

Heads up!

To guarantee service and prevent abuse, some users may encounter a temporary change in rate limit without notice.