IPv6 lookup
The same lookup as IPv4 for IPv6 addresses, plus the announced prefix.
GEThttps://api.mygeocode.com/v1/ipv6
Parameters
| Parameter | Type | Description |
|---|---|---|
ipoptional | string | An IPv6 address in any textual form. Default: the address the request came from. |
ipsoptional | string | Comma-separated addresses, up to 100. Each counts as one request. |
langoptional | string | ISO 639-1 code for names. Default en. |
keyoptional | string | API key, if not sent as a header. |
Example
$ curl "https://api.mygeocode.com/v1/ipv6?ip=2606:4700:4700::1111"const url = new URL("https://api.mygeocode.com/v1/ipv6");
url.searchParams.set("ip", "2606:4700:4700::1111");
const geo = await (await fetch(url)).json();
console.log(geo.prefix, geo.country_code);import requests
geo = requests.get("https://api.mygeocode.com/v1/ipv6", params={"ip": "2606:4700:4700::1111"}, timeout=5).json()
print(geo["prefix"], geo["country_code"])Response
{
"status": "ok",
"ip": "2606:4700:4700::1111",
"version": 6,
"prefix": "2606:4700::/32",
"country": "United States",
"country_code": "US",
"region": "California",
"region_code": "CA",
"city": "San Francisco",
"postcode": "94107",
"lat": 37.7621,
"lon": -122.3971,
"timezone": "America/Los_Angeles",
"asn": 13335,
"org": "Cloudflare, Inc.",
"is_datacenter": true,
"is_proxy": false,
"is_private": false
}Response fields
All fields of the IPv4 lookup, plus:
| Field | Type | Description |
|---|---|---|
prefix | string | The BGP route containing the address, in CIDR notation. |
version | integer | 6, or 4 when an IPv4-mapped address (::ffff:a.b.c.d) was sent, in which case the answer is the IPv4 data. |
Notes
- Accepted forms: compressed (
2001:db8::1), expanded, mixed with an embedded IPv4, and with a zone index (%eth0), which is stripped. - Calling without
ipover an IPv4 connection returns the IPv4 result rather than an error, so a single call works for both. - Anonymous quota for requests that arrive over IPv6 is counted per /40. See rate limits.
Errors
400 invalid_request when ip is not a valid IPv6 address, or when ips has more than 100 entries.