REST Countries

IP geolocation, network and security signals.

Resolve any IPv4 or IPv6 address to a place: continent, country, subdivision, city, coordinates and postal code. You also get the network operating it (ASN, organization, domain), security flags like Tor, proxy and datacenter, and the local timezone. Pass no address at all and it geolocates the caller.

Get an API key Read the docs

Try a real request

// Fires a real request against the demo API key.
// Click the button below to run it. The response opens in the Explorer panel.
const response = await fetch(
  'https://api.restcountries.com/ip/v1/216.209.248.188',
  { headers: { 'Authorization': 'Bearer rc_live_demo' } }
);
const result = await response.json();

Run this request → Drop the address to geolocate the caller instead. The response opens in an Explorer panel on the right.

Inside one record

Every block on every lookup

One record under data.objects, always the same shape. A value the provider can't report comes back null. There are no optional keys.

{
  "ip": "216.209.248.188",
  "type": "IPv4",
  "location": {
    "label": "Toronto, Ontario",
    "continent": { "name": "North America", "codes": { "common": "NA" } },
    "country": {
      "name": "Canada",
      "codes": { "alpha_2": "CA" },
      "flag": { "emoji": "🇨🇦", "url_svg": "https://flags.restcountries.com/v5/svg/ca.svg" },
      "attributes": { "is_eu": false }
    },
    "subdivision": { "name": "Ontario", "codes": { "common": "ON", "iso_3166_2": "CA-ON" } },
    "city": { "name": "Toronto" },
    "coordinates": { "lat": 43.64, "lng": -79.433 },
    "postal": { "code": "M6K" }
  },
  "connection": {
    "asn": { "number": 5645 },
    "organization": { "name": "TekSavvy Solutions Inc." },
    "domain": "teksavvy.com"
  },
  "security": { "tor": false, "proxy": false, "vpn": null, "anonymous": false, "data_center": false },
  "timezone": {
    "id": "America/Toronto",
    "current": { "abbreviation": "EDT", "offset": { "iso_8601": "-04:00" }, "attributes": { "is_dst": true } }
  }
}
Uptime 99.995% target availability
Avg response <150ms based on >1m requests
ASN coverage 100K+ networks identified
Countries 250+ incl. dependencies

Common questions

Before you wire it in

Can I geolocate the visitor without knowing their IP?

Yes. Call /ip/v1 with no address and the API resolves the caller's own IP, so a bare request doubles as a "where is this visitor" lookup.

Can I get the full country record too?

Pass ?extend=countries and the matched country's complete Countries API record is embedded in the same response, with no second call.

What happens when a field isn't known?

Every response carries the full tree; anything the provider can't report ships as null rather than disappearing, so your parsing never has to branch on missing keys. See the full reference →

Start geolocating addresses today.

Free tier covers most prototypes. Point at /ip/v1 and go.

Get an API key Read the docs