Authentication and key security

Every request carries your API key. Restrict each key so a leaked key is useless elsewhere.

Send your API key

To use the IP geolocation API, create an API key in your dashboard and send it in the X-Api-Key header with every request.

You can also pass the key as a key query parameter for quick tests, but the header is safer, because full URLs are often stored in server and proxy logs.

Keep keys secret. Call the API from your server. If you must call it from a browser, create a separate key restricted to your website domains, as described below.

Key security

Open Settings next to any key in your dashboard to restrict it:

  • Allowed server IPs: only listed IPs or ranges (IPv4, IPv6, CIDR) can use the key. This is the strongest protection for server-to-server calls.
  • Allowed website domains: the key works from browser JavaScript on those sites only, for example example.com or *.example.com. A key with allowed domains and no allowed IPs is browser-only.
  • Expiry date: the key stops working automatically at the end of that day (UTC).

Keys without allowed domains are refused in browsers, so a secret server key cannot be reused on another website. The API supports CORS for keys used from browsers. See how to restrict an API key for a step-by-step guide.

Need a hand? Search the Help Center or open a support ticket. We usually reply within one business day.