Limits and query cost
Every operation has a cost in points. The API checks the cost before the operation runs and spends it from your rate limit.
Query cost
| Selection | Cost |
|---|---|
| Scalar or enum field | 0 |
| Object | 1 + its selected fields |
| Connection (paged list) | 2 + first (or last) × the cost of one node, at least 1 per node |
edges, cursor, pageInfo, totalCount | 0 |
| List that is not paged | A fixed number of rows × (1 + one row's selection), whatever it holds |
A few fields cost more, and every list that is not paged is priced at a fixed number of rows. Their description gives the price with the sentence Costs N points.
Every operation costs at least 1 point, and at least 1 point for every 10 fields it selects (counted with fragments expanded).
Maximum cost
One operation can cost at most 10 000 points. A more expensive operation is refused before it runs. The response is HTTP 200 with an error whose extensions.code is COMPLEXITY_LIMIT_EXCEEDED, and nothing is spent. Ask for smaller pages or fewer fields.
Pages
Every list takes exactly one of first or last, from 1 to 250. Use after only with first and before only with last. A wrong combination is refused with VALIDATION.
Rate limit
Points come from two token buckets that refill continuously:
- Each API key has a bucket of 10 000 points that refills at 500 points per second.
- All API keys of one organisation together share a bucket of 20 000 points that refills at 1 000 points per second.
An operation takes its requested cost from both buckets. When it finishes, the points it did not use are returned. A query that asks for 250 orders and gets 3 pays only for the 3 it found.
When a bucket does not have enough points, the API answers with HTTP 429, a Retry-After header (seconds) and an error with extensions.code = RATE_LIMITED and extensions.retryAfterSeconds. Wait that long, then send the same request again.
Cost in the response
A response to an operation that ran carries extensions.cost:
Code
throttleStatus describes whichever of your two buckets has fewer points left, after the refund. A 429 response carries it too, without actualQueryCost. A request refused before it runs (invalid document, a limit below) carries no cost and spends nothing.
Pace your calls by throttleStatus and they will not be refused.
Other limits
| Limit | Value |
|---|---|
| Request body | 1 MiB; a larger body is refused (HTTP 413) |
| Request time | 30 seconds; a request that takes longer gets HTTP 504 |
| Document size | 1 000 tokens |
| Fields after expanding fragments | 20 000 |
| Different argument sets on one nested list field | 8 |
| Transport | POST only, one operation per request (no batching) |