GraphQL Query Limitations

    Plan Availability
  • GraphQL
    Legacy Plans
  • GraphQL
    Platform
  • GraphQL

To ensure Thinkific remains stable and accessible to all sites, we have established limitations on incoming requests to our GraphQL API. 

In this article:

Rate Limits

We rate limit calls to the GraphQL API based on the calculated cost of the data requested over a span of a minute. Thinkific assigns a point value (cost) to each API request based on the structure of the query provided. Requests that ask for more data will have a higher cost; it’s thus important to only request the values you will actually use.

Cost Limits

API Standard Limit
Beta 2000 points per minute
Stable 2000 points per minute

Notes:

  • The maximum cost for a single request is 1000 points
  • Customers on our Plus plan can access expanded limits upon request

Cost Calculation

The cost of a query is the sum of the cost of every field in the query and is based on the returned field type. This table describes the cost associated with each type:

Return Type Cost
Scalar 0
Enum 0
Query 100
Object 100
Connection Value of first or last argument multiplied by the cost of the nested children
List 100
Mutation 1000

Notes:

  • A query's cost is divided by 100 before being applied towards the rate limit to normalize large numbers
  • Thinkific reserves the right to set manual costs on fields

An example:

# Total Complexity = (100 + 100 + 625) / 100 = 9
query CommunityPosts($communityId: ID!) { # Query: 100
community(id: $communityId) { # Object: 100
spaces(first: 25) { # Connection: 25 * 25 = 625
nodes {
id
posts(first: 25) { # Connection: 25
nodes {
id
}
}
}
}
}
}

Knowing the cost of a query

Included in each response is detailed rate limiting information. You’ll find this under the extensions key. This includes:

  • cost is the calculated cost of the current request
  • remaining is how many points remain in the current window of time.
  • resetAt is the time when the rate limit will reset
  • limit is your current limit and  maximum number of points available in a time window.

An example:

Query:

# Get users and their courses
query UsersAndCoursesQuery {
site {
  users(first: 25) {
    nodes {
      id
      firstName
      courses(first: 10) {
      nodes {
        id
          title
        }
      }
    }
  }
}
}

Response:

{
"data": {
"site": {
"users": {
"nodes": [
// 25 users
]
}
}
},
"extensions": {
"rateLimit": {
"cost": 206,
"remaining": 1794,
"resetAt": "2023-12-11T19:53:00.000Z",
"limit": 2000
}
}
}

Exceeding the Rate Limit

When you exceed your Rate Limit the API will stop returning data and will return a Rate Limit Exceeded error. This error will be returned in a 200 HTTPS Response with the following content:

{
"errors": [
{
"message": "API rate limit exceeded.",
"extensions": {
"code": "RATE_LIMITED"
}
}
],
"extensions": {
"rateLimit": {
"cost": 104,
"remaining": 0,
"resetAt": "2023-12-13T15:48:00.000Z",
"limit": 2000
}
}
}

Query Max Depth

Queries made with Thinkific’s GraphQL API are restricted to a maximum depth of 15. Anything above 15 will return an error with the code `MAX_DEPTH_EXCEEDED`. 

The following request’s depth is 15, and is the maximum depth allowed.

Max Page Size

Thinkific enforces a maximum page size of 100 items In order to prevent timeouts and potentially malicious queries. All requests must contain a `first` or `last` argument or will return a top-level error. As a best practice, use pagination for any request that could return a large number of items.

Was this article helpful?
0 out of 3 found this helpful