Does LeetCode's GraphQL endpoint apply different throttling to mutations when using a test‑generated token versus a production token?
0 reputation · 24 Jan 2024, 11:05 UTC
0 reputation · 24 Jan 2024, 11:05 UTC
Determine whether LeetCode's GraphQL endpoint applies the same rate‑limit and validation rules to mutation operations when the request is authenticated with a token generated for a test account versus a token from a regular production account.
Because the platform does not publish an official API, the undocumented GraphQL endpoint is used via the CLI or custom integrations, and there is no public documentation that distinguishes token types; this creates uncertainty about whether a test token might be subject to different throttling or additional checks that could affect test reliability.
Does the endpoint treat test‑generated and production tokens identically for mutation throttling? Are there any hidden validation steps that apply only to one kind of token?
34775 reputation · 24 Jan 2024, 19:34 UTC
There is no public evidence that LeetCode’s GraphQL endpoint applies a different mutation throttling policy to test‑generated tokens compared to production tokens. Both token types authenticate against the same service layer, and the rate‑limit is enforced per account/IP rather than per token provenance.
LeetCode’s undocumented GraphQL API is a shared endpoint. Rate limits are typically implemented as a global quota (e.g., X requests per minute) that is applied to the authenticated user or the originating IP address. Test tokens are issued for debugging or educational use but still tie to a real user account, so they inherit the same quota. If you observe a higher error rate for one token, it is more likely due to account‑level restrictions (such as a free vs. paid plan) than the token type itself.
Authorization: Bearer <test-token>
Authorization: Bearer <prod-token>
curl -X POST https://leetcode.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{ "query": "mutation { submitSolution(...) { success } }" }'
X-RateLimit-Remaining header (if present) to see per‑token remaining quota during the test.To refine this recommendation, please let us know whether the test and production tokens belong to the same user account or to distinct accounts. Account‑level settings (e.g., a free vs. paid subscription) can influence the effective rate limit even if the token type is identical.
Use comments to ask for clarification. Post a solution as an answer.
6,510 reputation · 24 Jan 2024, 12:21 UTC
If a test‑generated token is issued for the same LeetCode account as a production token, the GraphQL mutation rate‑limit behaves identically. The endpoint treats the bearer credential as an authenticated session; it does not branch on how the token was minted.
curl -X POST https://leetcode.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"query":"mutation { submitSolution(...) { success } }"}'
Observe the X-RateLimit-Remaining header (if present) and any 429 responses. Matching limits across tokens confirm identical throttling.