TanqoryDocs

Rate limits and query cost

The Admin API does not count requests. It prices each request by the work it asks for, its query cost in points, and takes those points from a bucket that refills over time.

How a request is priced

Before a request runs, the API adds up the cost of every field it selects:

Selected fieldCost
Scalar or enum (title, status)0
Object (product, featuredMedia)1, plus the cost of what is selected inside it
Interface or unionThe cost of its most expensive possible type for the selection
Connection (products(first: 10))2 + page size × cost of one item
Mutation (the root field, such as productCreate)10, in place of the payload object's 1, plus what is selected in the payload
Introspection (__schema, __type, __typename)0
  • A connection is a field whose type ends in Connection and has pageInfo and edges or nodes. One item costs 1 for the node plus what is selected in it. edges { node } and nodes return the same items, so when both are selected only the more expensive one counts. The edge itself, cursor and pageInfo cost nothing.
  • The page size is the first or last argument, counted in steps (below), so a page of 250 costs far less than 250 times one item. A connection with neither argument is sized 0.
  • A list of objects that takes first or last but is not a connection costs page size × (one object + its selections), without the connection's 2. Any other list of objects costs as one object.
  • Fragments are expanded, and fields skipped with @skip or @include are not counted.

Page size steps

A page of first: n (or last: n) counts as this many items:

first or lastCounts as
1 to 21
3 to 42
5 to 73
8 to 124
13 to 205
21 to 336
34 to 547
55 to 888
89 to 1439
144 to 23210
233 or more11

Examples

RequestRequested cost
{
  products(first: 1) {
    edges { node { title } }
  }
}
3
2 for the connection + 1 item × (1 for the product + 0 for its title)
{
  products(first: 250) {
    nodes { id title }
  }
}
13
2 + a page of 250 counted as 11 × 1
{
  products(first: 10) {
    nodes {
      title
      variants(first: 5) { nodes { sku } }
    }
  }
}
26
2 + 4 × (1 for the product + the variants connection, 2 + 3 × 1)
mutation {
  productCreate(product: { title: "Linen shirt" }) {
    product { id title }
    userErrors { field message }
  }
}
12
10 for the mutation + 1 for the product + 1 for the list of user errors

Requested and actual cost

The requested cost is calculated from the request before it runs. The actual cost is calculated after it runs with the same rules over what came back: a connection is sized by the items it returned, an object that came back null costs nothing, and an interface or union costs the type that was returned. When the actual cost is lower than the requested cost, the difference is given back to the bucket.

Single query limit

A request whose requested cost is above 1000 points is refused before it runs, and nothing is taken from the bucket. Split it into smaller requests, or ask for smaller pages.

{
  "errors": [
    {
      "message": "Query cost is 2003, which exceeds the single query max cost limit (1000). …",
      "extensions": {
        "code": "MAX_COST_EXCEEDED",
        "cost": 2003,
        "maxCost": 1000,
        "documentation": "…"
      }
    }
  ],
  "extensions": { "cost": { "requestedQueryCost": 2003, "actualQueryCost": null, "throttleStatus": { … } } }
}

The bucket

Each combination of a store and a caller (an app's token, or a merchant's session) has its own bucket. It holds up to 1000 points and refills continuously at 100 points per second until it is full.

  1. A request needs its requested cost in the bucket. If the bucket holds less, the request is refused with THROTTLED and does not run.
  2. Otherwise the requested cost is taken and the request runs.
  3. When it has run, the difference between the requested and the actual cost is put back.

The merchant dashboard's own sessions are priced the same way under larger limits: a bucket of 20000 points refilled at 1000 points per second, and a single query limit of 4000. Apps always get the limits above.

Reading the cost of a response

Every Admin API response carries the cost and the state of your bucket in extensions.cost:

"extensions": {
  "cost": {
    "requestedQueryCost": 101,
    "actualQueryCost": 46,
    "throttleStatus": {
      "maximumAvailable": 1000,
      "currentlyAvailable": 954,
      "restoreRate": 100
    }
  }
}
requestedQueryCost
The cost calculated before the request ran. null when the document did not parse or validate.
actualQueryCost
The cost of what was returned. null when the request was refused and did not run.
throttleStatus.maximumAvailable
The bucket's size.
throttleStatus.currentlyAvailable
The points in the bucket after this request, rounded down.
throttleStatus.restoreRate
Points restored per second.

Throttled requests

A throttled request answers HTTP 200, like every GraphQL answer, with an error whose code is THROTTLED:

{
  "errors": [
    {
      "message": "Throttled",
      "extensions": { "code": "THROTTLED", "retryAfterMs": 1200, "documentation": "…" }
    }
  ],
  "extensions": { "cost": { "requestedQueryCost": 220, "actualQueryCost": null, "throttleStatus": { … } } }
}

The error carries how long to wait before the bucket can cover the request: extensions.retryAfterMs in milliseconds, and a Retry-After response header in seconds.

Staying within the limits

  • Select only the fields you use, and ask for the page size you need.
  • Watch throttleStatus.currentlyAvailable and slow down before the bucket runs dry.
  • On THROTTLED, wait as told above and send the same request again.
  • Spread large reads over several requests rather than one big one: the bucket refills while you work.

Storefront API

Query cost and the bucket apply to the Admin API. The Storefront API does not calculate query cost and does not return extensions.cost.

Built from commit c0b3fb3fdef7 · API version 2026-10