In order to start using our API, you will need to register for an API key here: https://api.nwdigital.cloud/register/
The following endpoint can be used for making API Calls for GeoIP Lookups using the GET method.
Replace “YOUR_API_KEY” with the API key you generated when registering.
Replace “YOU_CLIENT_ID” with the Client Id you generated when registering and replace “IP_ADDRESS” with the IP address you wish to query.
Method: GET
Endpoint URL
https://api.nwdigital.cloud/wp-json/wp/v2/geoip?key=YOUR_API_KEY&clientId=YOU_CLIENT_ID&ip=IP_ADDRESS
Potential Responses
Responses from the endpoint will be returned in JSON format. The examples for each type of response are listed below:
Using Another Method Besides GET
{
"code": "rest_no_route",
"message": "No route was found matching the URL and request method.",
"data": {
"status": 404
}
}
Not Authorized
{
"code": 401,
"message": "Not Authorized",
"data": {
"status": 401
}
}
Authorized (IP is from a private range)
{
"status": "Authorized",
"ip": "10.168.2.1",
"info": {
"message": "10.168.2.1 is a private address",
"valid_address": false,
"private_address": true
},
"auth_result": {
"user_id": "1",
"status": "Authorized"
},
"details": "Lookup failed for 10.168.2.1"
}
Authorized (API Key, Client ID and IP Address are valid and not in a private range so the lookup is successful and returns the result)
{
"status": "Authorized",
"ip": "91.234.192.26",
"info": {
"message": "91.234.192.26 is a valid public address",
"valid_address": true,
"private_address": false
},
"auth_result": {
"user_id": "1",
"status": "Authorized"
},
"details": {
"country": "Japan",
"iso": "JP",
"subdivname": "Tokyo",
"subdiviso": "13",
"city": "Tokyo",
"postalcode": "151-0053",
"lat": "35.6893",
"lon": "139.6899",
"network": "91.234.192.0/24"
}
}
Authorized (submitted value for IP is not a valid value)
{
"status": "Authorized",
"ip": "98.97.3.2132342",
"info": {
"message": "98.97.3.2132342 is not a valid IP address!",
"valid_address": false,
"private_address": false
},
"auth_result": {
"user_id": "1",
"status": "Authorized"
},
"details": "Lookup failed for 98.97.3.2132342"
}
Considerations
Latitudes and longitudes are currently rounded to 4 decimal places