Skip to main content
Use this page to keep your app inside your plan’s limits and recover cleanly when you hit one.
Fastest way: ask your AI. Set up your coding tool once with Build with AI, then paste:

Two budgets

Every API key works within two separate budgets. The numbers depend on your plan. Some plans have no monthly cap. See pricing.
  • Trials are metered at 10% of the plan’s limits.
  • Every request counts once your key is accepted, including requests that return an error such as 400 or 404.
  • GET /health needs no key and doesn’t count.

Read the headers

Every authenticated response, success or error, includes these headers: To see them, add -i to any request:

When you hit a limit

Both limits return 429 with a Retry-After header. Check the error code to know which one you hit.

Retry with backoff

This wrapper retries RATE_LIMITED after Retry-After seconds and gives up straight away on USAGE_LIMIT_EXCEEDED.
To avoid the 429 in the first place, check X-RateLimit-Remaining. When it reaches 0, wait until X-RateLimit-Reset before the next request.

Use fewer requests

  • Call the API from your server and cache the responses. One cached response can serve all your users. Calling from the browser also exposes your key.
  • Cache slow-changing data for longer, such as competitions, seasons and finished matches.
  • Poll live endpoints only while a match is live, and stop at full time. The API has no webhooks or push updates, so polling is the only way to get new data.
  • Fetch 100 results per page (per_page=100) and filter on the server with parameters like team_id, date_from and date_to. See Pagination.
  • Check availability flags such as xg_available and odds_available before calling optional endpoints. See Data model.
AI coding agents can use up quota fast when they run code in a loop. Add a line like this to your prompt: “Make one test request first, cache every response while you build, and never call TheStatsAPI in a tight loop.”