Country is a free IP-to-country geolocation API that returns a user’s country based on their IP address.
We run an open instance—no API key needed. If preferred, you can self-host with Docker.
The API has a minimal interface.
/* curl -s https://api.country.is/ */
/* curl -s https://api.country.is/77.1.2.3 */
/* curl -s https://api.country.is/info */
Our hosted service is ideal for client-side apps. If you require to run high-volume queries server-side, consider self-hosting or querying the MaxMind GeoIP data directly.
If you prefer not to use our server, you can self-host with Docker.
# Runs country on port 3000
docker run -d \
-p 3000:3000 \
-e ACCOUNT_ID=$MAXMIND_ACCOUNT_ID \
-e LICENSE_KEY=$MAXMIND_LICENSE_KEY \
hakanensari/country
Set the two environment variables to your MaxMind account ID and the license key associated with it.