From 70512007ab04451d0b042ab19246bb08300d95c3 Mon Sep 17 00:00:00 2001 From: Kyrch Date: Fri, 10 Apr 2026 01:11:15 -0300 Subject: [PATCH] docs(graphql): add query complexity limit (#130) --- docs/graphql/intro/ratelimiting/index.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/graphql/intro/ratelimiting/index.md b/docs/graphql/intro/ratelimiting/index.md index ff99491..7200188 100644 --- a/docs/graphql/intro/ratelimiting/index.md +++ b/docs/graphql/intro/ratelimiting/index.md @@ -12,7 +12,7 @@ Here we will provide an overview of managing request quotas. ## Response Headers -The AnimeThemes GraphQL API limits queries to 90 per minute. +The AnimeThemes GraphQL API limits 90 requests per minute. The AnimeThemes API will return `X-RateLimit-Limit` and `X-RateLimit-Remaining` headers in the response. @@ -25,7 +25,7 @@ X-RateLimit-Remaining: 89 ## Exceeding the Rate Limit -If the rate limit is exceeded, the AnimeThemes API will return `Retry-After` and `X-RateLimit-Reset` headers in the response. +If the rate limit is exceeded, the AnimeThemes API will return `Retry-After` and `X-RateLimit-Reset` headers in the response with a 429 status code. ```sh ... @@ -50,7 +50,7 @@ Clients can nest fields within other fields, which can quickly result in deeply The AnimeThemes GraphQL API enforces a maximum query depth of 13. -If your query exceeds this limit, the API will return the following error response: +If your query exceeds this limit, the API will return a 200 status code with the following error response: ```json { @@ -60,4 +60,22 @@ If your query exceeds this limit, the API will return the following error respon } ] } +``` + +## Query Complexity Limit + +Clients can request a lot of fields, can nest fields within other fields, which can quickly result in deeply nested queries. + +The AnimeThemes GraphQL API enforces a maximum of 250 fields per request. + +If your query exceeds this limit, the API will return a 200 status code with the following error response: + +```json +{ + "errors": [ + { + "message": "Max query complexity should be 250 but got 300." + } + ] +} ``` \ No newline at end of file