Look up an IP address (path slug)
Changed onReturns the geolocation record for the IP address given as the path slug: location (continent, country, subdivision, city, coordinates, postal), connection (ASN, organization, domain), security signals, and timezone. Both IPv4 and IPv6 are accepted; a value that isn't a valid IP address returns HTTP 400 before any lookup, and a valid but unlocatable address (private/reserved) returns HTTP 400 with the reason in the message. Every response carries the full canonical key tree; a leaf that can't be resolved for an address ships as null. See https://restcountries.com/docs/ip for the full reference.
Request
- Base URLhttps://api.restcountries.com
- Auth
- HTTP bearer
- or API key in query parameter api-key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
IP address to look up. Both IPv4 and IPv6 are accepted. A value that isn't a valid IP address returns HTTP 400 before any lookup is attempted.
Query parameters
Comma-separated dot-path projection. Only the specified fields are returned. Example: names.common,codes.alpha_2,flag.emoji
Comma-separated dot-path blocklist. The specified fields are removed from the response. Useful for trimming heavy branches like names.translations.
Set to true (a bare ?pretty, 1, or true) to pretty-print the JSON response; 0 or false keep it minified. Default is minified.
Response
Geolocation record for the resolved IP address, always a single object.
Changes
- info
the response property
//became required for the status - info
the response property
//became required for the status - info
the response property
//became required for the status - info
the response property
//became required for the status - info
the response property
//became required for the status - info
the response property
//became required for the status - info
the response property
//became required for the status - info
the
//response's property pattern^[a-z_]+\.[a-z0-9_]+$was added for the status - info
the
//response's property pattern^[a-z_]+\.[a-z0-9_]+$was added for the status - info
the
//response's property pattern^[a-z_]+\.[a-z0-9_]+$was added for the status - info
the
//response's property pattern^[a-z_]+\.[a-z0-9_]+$was added for the status - info
the
//response's property pattern^[a-z_]+\.[a-z0-9_]+$was added for the status - info
the
//response's property pattern^[a-z_]+\.[a-z0-9_]+$was added for the status - info
the
//response's property pattern^[a-z_]+\.[a-z0-9_]+$was added for the status
- info
- info
endpoint added
- info