This endpoint returns the country of the requesting IP. It has multiple plain text endpoints allowing you to choose whether you want the full country name or just the country code.
Type | URI |
---|---|
Plain text | https://get.geojs.io/v1/ip/country{/ip address} |
Plain text | https://get.geojs.io/v1/ip/country/full{/ip address} |
JSON | https://get.geojs.io/v1/ip/country.json https://get.geojs.io/v1/ip/country/{ip address}.json |
JSONP | https://get.geojs.io/v1/ip/country.js https://get.geojs.io/v1/ip/country/{ip address}.js |
Paramater | Default | Description | Endpoint |
---|---|---|---|
ip |
None | Allows searching of multiple IPs at once | All |
callback |
countryip |
JSONP callback | /v1/ip/country.js |
Property | Type | Description | Example |
---|---|---|---|
ip |
String | Requested IP | 8.8.8.8 |
country |
String | Two letter country code | US |
country_3 |
String | Three letter country code | USA |
name |
String | Country name in English | United States |
This endpoint features two plain text versions. One returns the two letter country code, the other returns the full country name in English.
The below two examples are from the normal plain text endpoint (/v1/ip/country
). The first is hitting the endpoint without any args, the second is specifying two IP args (/v1/ip/country?ip=8.8.8.8,198.35.26.96
):
US
8.8.8.8: US
198.35.26.96: US
The below two examples are the same as the above, but are hitting the full URL endpoint (/v1/ip/country/full
):
United States
And multiple IP lookups:
8.8.8.8: United States
198.35.26.96: United States
{
"country": "US",
"country_3": "USA",
"ip": "198.35.26.96",
"name": "United States"
}
When multiple IPs are queried using the the ip
arg on a request you get a response like this:
[
{
"country": "US",
"country_3": "USA",
"ip": "8.8.8.8",
"name": "United States"
},
{
"country": "US",
"country_3": "USA",
"ip": "198.35.26.96",
"name": "United States"
}
]
countryip({
"country": "US",
"country_3": "USA",
"ip": "198.35.26.96",
"name": "United States"
})
When querying multiple IPs using the ip
arg the return becomes a list like below:
countryip([{
"country": "US",
"country_3": "USA",
"ip": "8.8.8.8",
"name": "United States"
}, {
"country": "US",
"country_3": "USA",
"ip": "198.35.26.96",
"name": "United States"
}])