Skip to main content

Rate Limits

The Scompler API enforces rate limits and complexity limits per token to ensure platform stability.

Request limits

Limits are applied per token within a 5-minute window:

OperationLimit
Queries500 per 5 minutes
Mutations150 per 5 minutes

Query complexity limits

Each request is also subject to node and complexity limits:

LimitValue
Query cost1,000
Max nodes per request50,000
Max nesting depth7
Max aliases7
Max directives20
Max tokens1,000

Pagination

All list queries require either a first or last argument. Values must be between 1 and 100.

Navigation uses cursor-based pagination:

query {
languages(first: 10, after: $cursor) {
nodes {
id
name
}
pageInfo {
endCursor
startCursor
hasNextPage
hasPreviousPage
}
}
}
FieldDescription
endCursorPass as after to fetch the next page
startCursorPass as before to fetch the previous page
hasNextPageWhether more results exist after this page
hasPreviousPageWhether more results exist before this page

Handling rate limit errors

When you exceed the limit, the API returns a RATE_LIMITED error:

{
"errors": [
{
"message": "Rate limit exceeded.",
"extensions": {
"code": "RATE_LIMITED"
}
}
]
}

Retry with backoff

async function queryWithRetry(query: string, variables = {}, maxRetries = 3) {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
const response = await fetch('https://public-api.pro.scompler.com/graphql', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SCOMPLER_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
})

const data = await response.json()

if (data.errors?.some((e) => e.extensions?.code === 'RATE_LIMITED')) {
if (attempt < maxRetries) {
await new Promise((r) => setTimeout(r, (attempt + 1) * 10_000))
continue
}
}

return data
}
}
tip

Use GraphQL field selection to request only the fields you need — this reduces query cost and helps you stay within complexity limits.