API - Geolocate IP Addresses (geo_lookup)

Geolocation

Tells you where public IP addresses are: country, region, city, coordinates and time zone. One address or up to 50 in one call.

Endpointhttps://opensolr.com/solr_manager/api/geo_lookup
MethodGET or POST, a JSON body works too
Authemail and api_key of your account, as GET or POST parameters: Authentication.

01 · Parameters

ipOne of the two

One address.

ipsOne of the two

Several: an array, a JSON array, or addresses separated by commas, semicolons or spaces. Up to 50; extras are left out and capped is true.

02 · Example

curl -s "https://opensolr.com/solr_manager/api/geo_lookup?email=YOUR_EMAIL&api_key=YOUR_API_KEY&ips=8.8.8.8,192.168.1.10"

03 · Answer

{
    "status": true,
    "contract_version": 1,
    "count": 2,
    "submitted": 2,
    "max_ips": 50,
    "capped": false,
    "results": {
        "8.8.8.8": {
            "found": true,
            "ip": "8.8.8.8",
            "country_code": "US",
            "country_name": "United States",
            "region": "California",
            "city": "Mountain View",
            "latitude": 37.386,
            "longitude": -122.0838,
            "timezone": "America/Los_Angeles"
        },
        "192.168.1.10": {
            "found": false,
            "msg": "ERROR_NOT_A_PUBLIC_IP"
        }
    }
}

results is keyed by each address as you sent it.

Only found and country_code are sure on a found entry. Every other field is left out when it is not known, never empty and never zero. Coordinates are left out when only the country is known.

timezone is always a real IANA name, such as Europe/Berlin, or absent.

Values shown are an example.

04 · Errors

ERROR_NO_IP_SUPPLIEDHTTP 400

No usable address in the request.

ERROR_GEO_LOOKUP_UNAVAILABLEHTTP 503

An address could not be looked up. Retry later; cache nothing from this answer.

ERROR_NOT_A_PUBLIC_IP, ERROR_GEO_NO_DATAHTTP 200

In one entry: not a public address, or nothing known about it. The other entries are answered.

ERROR_AUTHENTICATION_FAILEDHTTP 403

The email and API key do not match.

ERROR_RATE_LIMIT_PER_MINUTEHTTP 429

Too many calls. Wait for the Retry-After seconds.

Each address counts once against the monthly API counter, and the call once against the per-minute and per-hour limits. It never uses the AI allowance.

05 · Related

The same answer on api.opensolr.com, next to the other lookups: ip_geo. The local time at an address: local_time.

Every error code and HTTP status of the API: API errors. Calls per minute and per hour: Rate limits.