IPv4 lookup
Location, timezone and network details for an IPv4 address. Leave the address out to look up the caller.
Parameters
| Parameter | Type | Description |
|---|---|---|
ipoptional | string | Dotted IPv4 address. Default: the address the request came from. |
ipsoptional | string | Comma-separated addresses, up to 100, for a batch. Returns results array in the same order. Each address counts as one request. |
elevationoptional | flag | 1 adds elevation_m, the ground height at the coordinates. |
keyoptional | string | API key, if not sent as a header. |
Example
$ curl -H "X-API-Key: YOUR_KEY" "https://api.mygeocode.com/v1/ipv4?ip=1.1.1.1"// In a browser, with no ip parameter, this returns the visitor's own address
const geo = await (await fetch("https://api.mygeocode.com/v1/ipv4", { headers: { "X-API-Key": "YOUR_KEY" } })).json();
console.log(geo.country_code, geo.timezone);import requests
geo = requests.get("https://api.mygeocode.com/v1/ipv4", params={"ip": "1.1.1.1"}, headers={"X-API-Key": "YOUR_KEY"}, timeout=5).json()
print(geo["country_code"], geo["org"], geo["is_datacenter"]){
"status": "ok",
"ip": "1.1.1.1",
"version": 4,
"found": true,
"prefix": "1.1.1.0/24",
"country": "Australia",
"country_code": "AU",
"continent": "Oceania",
"continent_code": "OC",
"region": "Queensland",
"region_code": "QLD",
"city": "Brisbane",
"postcode": "4000",
"lat": -27.467542,
"lon": 153.028089,
"timezone": "Australia/Brisbane",
"utc_offset": "+10:00",
"utc_offset_seconds": 36000,
"is_eu": false,
"asn": 13335,
"as_name": "Cloudflare, Inc.",
"org": "Cloudflare, Inc.",
"usage_type": "Content",
"registry": "arin",
"allocated": "2010-07-14",
"tags": ["a10k", "anycast", "cdn", "ddosm", "icrit", "rpkirov", "vpn"],
"is_anycast": true,
"is_satellite": false,
"is_datacenter": true,
"is_proxy": false,
"is_vpn_provider": true,
"is_tor": false,
"crawler": null,
"is_private": false,
"abuse_email": "abuse@cloudflare.com",
"threat": {
"listed": false,
"score": 0,
"source_count": 0,
"categories": [],
"is_tor": false,
"is_tor_exit": false,
"is_bogon": false,
"listings": []
},
"updated_at": "2026-09-18 06:52:52"
}Response fields
| Field | Type | Description |
|---|---|---|
ip, version | string, integer | The address looked up, in canonical form, and 4 or 6. |
found | boolean | False when no network covers the address; location fields are then null. |
prefix | string | The most specific network containing the address, in CIDR form. |
country, country_code | string | Country name and upper-case ISO 3166-1 alpha-2 code. |
continent, continent_code | string | Continent name and two-letter code. |
region, region_code | string | First-level division and its short code. The code is filled in for the United States, Canada and Australia; elsewhere it is present only where the dataset carries one. |
city, postcode | string | Best estimate; null when unknown. |
lat, lon | number | Centre of the most specific known area. |
elevation_m | number or null | Height above mean sea level at that point in metres, from the same 15 arc-second grid as the elevation endpoint. Negative over the sea floor. Only with elevation=1. |
timezone, utc_offset, utc_offset_seconds | string, string, number | IANA zone, the offset in force right now as +HH:MM, and the same offset in seconds. The zone is decided by the coordinates and the time zone boundaries, so it always agrees with lat and lon. |
is_eu | boolean | The country is in the European Union. |
asn, as_name, org | integer, string | Autonomous system number, its name, and the organisation behind it. |
usage_type | string | What the operator is: Eyeball (consumer ISP), Carrier, Content, Hosting, Enterprise, Education, NSP or unknown. |
registry, allocated | string | Regional registry that allocated the ASN and the allocation date. |
tags | array | Operator-level tags such as dsl, cdn, vpsh (VPS hosting), vpn, satnet. They describe the network operator, not the individual address. |
is_anycast, is_satellite | boolean | The prefix is anycast; the operator is a satellite network. |
is_datacenter | boolean | Hosting or content network, or an anycast prefix. Treat city as unreliable and consider that the traffic may be automated. |
is_proxy, is_tor | boolean | Per-address evidence that it is a Tor relay or exit, or is listed as a proxy or VPN endpoint. |
crawler | object or null | When the address is in a range a crawler operator publishes (Googlebot, Bingbot, Applebot, GPTBot and others): its name and type. |
is_vpn_provider | boolean | The operator runs VPN or proxy services somewhere in its network (an operator-level hint, weaker than is_proxy). |
is_private | boolean | Reserved, private or otherwise non-routable address. When true the response carries only ip, version, is_private and reason. |
abuse_email | string | Abuse contact registered for the network. |
threat | object | Reputation: listed, a score from 0 to 100 (the weight of the worst report, discounted for old ones), source_count (how many independent reports list it), categories, Tor and bogon flags, and the individual listings with category, confidence and how many days ago each was reported. |
updated_at | string | When the record for this network was last refreshed. |
Either version in one call
GET /v1/ip accepts an IPv4 or an IPv6 address (or none, for the caller) and returns the same record as the version-specific endpoints. Use it when you do not know in advance which kind of address you will be given.
Notes
- Anycast addresses such as
1.1.1.1and8.8.8.8are served from many places at once. The location returned is the registered one, which is whyis_datacenteris true for them. - Call it from your server with the visitor's address in
ip. Calling withoutipreturns the address the request came from, which behind a proxy or CDN is the proxy. - IP data is refreshed weekly. A cache time of a day is reasonable.
The same lookup in other providers' formats
If you already have code written against one of these providers, keep it: the drop-in host accepts the same path and parameters and answers in that provider's response shape, with this endpoint behind it. See how the drop-ins work.
| Provider | Host | Path |
|---|---|---|
| Geoapify | geoapify.mygeocode.com | /v1/ipinfo?ip=... |
| ip-api.com | ipapi.mygeocode.com | /json/{ip}/json//batch (POST, JSON array) |
| ipinfo.io | ipinfo.mygeocode.com | /{ip}/json/{ip}/json/{ip}/{field} |
| ipstack | ipstack.mygeocode.com | /{ip}/check/{ip},{ip},{ip} |
Errors
400 invalid_request when ip is not a valid IPv4 address, or when an IPv6 address is sent to this endpoint (use /v1/ipv6), or when ips has more than 100 entries. In a batch, an entry that is not a valid IPv4 address does not fail the call: its place in results holds "status": "error" with the address and an error object, and it is not counted.