Rate limits & caching

countries.dev has no per-key rate limits or quotas — only a generous abuse ceiling. Responses are cached at the edge for speed. Learn the Cache-Control headers and how to cache in your app.

No quotas

There are no API keys, so there are no per-key quotas, plans or billing. You can call the API as much as your app needs.

A single safeguard protects the service from abuse: roughly 60 requests per second per IP. Normal usage — even a busy production app — never comes close. Exceed it and you'll get a 429:

{ "error": "Too Many Requests", "message": "Rate limit reached" }

Responses are cached

Country data rarely changes, so responses ship with long cache headers and are served from the edge:

Cache-Control: public, max-age=3600, s-maxage=86400, stale-while-revalidate=604800

That means browsers, CDNs and proxies can reuse a response for up to a day (and keep serving a slightly stale one while revalidating). You get fast responses without doing anything.

Cache in your app

Because the data is stable, you rarely need to fetch it more than once. A few easy wins:

  • Fetch once, reuse. Load /countries (or just the fields you need) at build time or on first load, then keep it in memory or local storage.
  • Let the browser cache. Default fetch already respects the Cache-Control headers above — no extra work.
  • Trim with fields. Request only the properties you use to shrink payloads. See Response format.

On this page