GET/api/v2/me
What is my IP API
Your own public IP address, network and approximate location, as Cloudflare saw your request.
- 60 calls a minute per IP
- Same engine as the What Is My IP tool
{
"query": {},
"ip": "195.250.20.4",
"version": 4,
"special": null,
"hostname": "unvps0032.spidyhost.com",
"network": {
"asn": 199404,
"name": "WHG Hosting Services",
"organization": "WHG Hosting Services Ltd",
"brand": {
"name": "hosting.com",
"website": "hosting.com"
},
"kind": "hosting",
"service": null,
"users": null
},
"location": {
"country": "IN",
"countryName": "India",
"region": "Maharashtra",
"regionCode": "MH",
"city": "Artist Village",
"postalCode": "400703",
"timezone": "Asia/Kolkata",
"latitude": 19.03227,
"longitude": 73.04276,
"continent": "AS",
"eu": false,
"source": "cloudflare"
},
"connection": {
"type": "hosting",
"tor": false,
"relay": null,
"colo": "HKG",
"rttMs": 97,
"httpProtocol": "HTTP/2",
"tlsVersion": "TLSv1.3"
},
"tookMs": 1157
}How it works
Answers the caller: the address your request came from (Cloudflare's CF-Connecting-IP, which a proxy header can't fake), your network and location from Cloudflare's own request metadata, the reverse DNS name, the Cloudflare data centre that took the request and the connection's round trip. No third-party lookup is made.
?format=text returns just the address and a newline as text/plain, for scripts: curl -s https://dnsrobot.net/api/v2/me?format=text. Errors stay JSON. Our domain has A and AAAA records, so curl -4 and curl -6 pick the family.
A VPN, iCloud Private Relay or Cloudflare WARP shows its own exit, which connection.type (relay, hosting) and network.kind tell apart from a home or mobile line.
Query parameters
formatstringoptionaldefaultjsonjson(the default) ortext: just the address, astext/plain.one of
json,text
Response fields
200 with this JSON object, plus tookMs, and incomplete with warnings when a source failed. Fields marked optional appear only when they apply.
queryobjectalwaysWhat was looked up, normalised (lower case, no trailing dot, IDNs as Punycode).ipstringalwaysYour address.versionintegeralways4 or 6.one of
4,6specialobject or nullalwaysThe special-purpose block the address is in (IANA's IPv4 and IPv6 Special-Purpose Address Registries), or null for an ordinary address.Show 5 fields
kindstringalwaysprivate(RFC 1918, RFC 4193),cgnat(RFC 6598),loopback,link-local,documentation,multicastorreserved: never on the public internet, so nothing else was looked up.special-purpose: an IANA block that is on the public internet (6to4, Teredo, NAT64's well-known prefix, AS112), looked up normally.one of
"private","cgnat","loopback","link-local","documentation","multicast","reserved","special-purpose"blockstringalwaysThe block, e.g.10.0.0.0/8.namestring or nullalwaysIANA's name for the block, e.g.Private-Use.rfcstring or nullalwaysThe RFC that defines it, e.g.RFC 1918.globallyReachableboolean or nullalwaysIANA's "Globally Reachable" column; null where IANA leaves it open.
hostnamestring or nullalwaysThe reverse DNS (PTR) name of your address, or null.networkobject or nullalwaysYour network, from Cloudflare's request metadata and our network table; null when Cloudflare gave none.Show 7 fields
asnintegeralwaysThe AS number.namestringalwaysThe network's name as people read it.organizationstring or nullalwaysThe AS's registered organization, as Cloudflare has it.brandobject or nullalwaysThe brand people know ("Xfinity" for Comcast's AS7922), where our brand table has the network.Show 2 fields
namestringalwaysThe brand.websitestring or nullalwaysThe brand's website domain.
kindstring or nullalwaysWhat kind of network it is:isp(home broadband),mobile,relay(Apple iCloud Private Relay, Cloudflare WARP),hosting(cloud, hosting, VPN exits, CDNs),satellite,other. From APNIC's user counts, a hand-checked brand table and name rules.one of
"isp","mobile","relay","hosting","satellite","other",nullservicestring or nullalwaysThe brand table's service:fixed(home broadband),mobile,bothorsatellite.one of
"fixed","mobile","both","satellite",nullusersobject or nullalwaysAPNIC Labs' estimate of the people online through the network in its main country, or null (not counted, or a hosting or relay network, whose "users" are VPN and relay users).Show 5 fields
countrystringalwaysISO 3166-1 alpha-2 country code.estimateintegeralwaysEstimated users there.sharenumberalwaysPercent of the country's users.rankintegeralwaysRank among the networks APNIC lists there (1 = largest).countryUsersinteger or nullalwaysThe country's estimated internet users.
locationobject or nullalwaysWhere Cloudflare places your request (its own geolocation, usually your city or your provider's nearest hub); null when it gave none.Show 12 fields
countrystring or nullalwaysISO 3166-1 alpha-2 country code.countryNamestring or nullalwaysThe country's English name.regionstring or nullalwaysRegion or state.regionCodestring or nullalwaysISO 3166-2 region code, where Cloudflare gives one.citystring or nullalwaysCity.postalCodestring or nullalwaysPostal code.timezonestring or nullalwaysIANA time zone, e.g.Europe/London.latitudenumber or nullalwaysLatitude.longitudenumber or nullalwaysLongitude.continentstring or nullalwaysContinent code: AF, AN, AS, EU, NA, OC or SA.eubooleanalwaysWhether the country is in the European Union.sourcestringalwaysAlwayscloudflare.
connectionobjectalwaysYour connection.Show 7 fields
typestring or nullalwaysOne type for the address, most specific first:tor(the Tor Project's exit list),relay,hosting,mobile,satellite,residential(a home ISP),business; null when unknown.one of
"tor","relay","hosting","mobile","satellite","residential","business",nulltorboolean or nullalwaysWhether the address is a Tor exit right now (the Tor Project's own list, kept 30 minutes); null for IPv6 (the list has none) or when the list couldn't be read.relaystring or nullalwaysA network that carries other people's traffic on purpose:icloud(Akamai's AS36183, iCloud Private Relay),cloudflare(AS13335: WARP, but also any Cloudflare server),fastly(AS54113).one of
"icloud","cloudflare","fastly",nullcolostring or nullalwaysThe Cloudflare data centre that took the request (IATA airport code, e.g.LHR).rttMsinteger or nullalwaysThe connection's smoothed round trip to that data centre (TCP, or QUIC over HTTP/3), in milliseconds.httpProtocolstring or nullalwaysThe HTTP version your client used, e.g.HTTP/2.tlsVersionstring or nullalwaysThe TLS version, e.g.TLSv1.3.
Errors
503unavailableThe request carried no client address (it didn't come through Cloudflare's edge).
Plus the errors every endpoint can return: 400 for a missing or unreadable parameter, 429 past the limit, 503 when every source failed.
Code samples
curl "https://dnsrobot.net/api/v2/me"const res = await fetch(`https://dnsrobot.net/api/v2/me`);
const data = await res.json();
if (!res.ok) throw new Error(data.error.message);
console.log(data.ip);import requests
r = requests.get(
"https://dnsrobot.net/api/v2/me",
timeout=30,
)
data = r.json()
if not r.ok:
raise RuntimeError(data["error"]["message"])
print(data["ip"])package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
res, err := http.Get("https://dnsrobot.net/api/v2/me")
if err != nil {
panic(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(data["error"])
}
fmt.Println(data["ip"])
}<?php
$context = stream_context_create(["http" => ["ignore_errors" => true, "timeout" => 30]]);
$data = json_decode(file_get_contents("https://dnsrobot.net/api/v2/me", false, $context), true);
if (isset($data["error"])) {
throw new RuntimeException($data["error"]["message"]);
}
print_r($data["ip"]);require "net/http"
require "json"
uri = URI("https://dnsrobot.net/api/v2/me")
data = JSON.parse(Net::HTTP.get(uri))
raise data["error"]["message"] if data["error"]
puts data["ip"]// Cargo.toml: reqwest = { version = "0.13", features = ["blocking", "json"] }, serde_json = "1"
fn main() -> Result<(), Box<dyn std::error::Error>> {
let res = reqwest::blocking::get("https://dnsrobot.net/api/v2/me")?;
let ok = res.status().is_success();
let data: serde_json::Value = res.json()?;
if !ok {
return Err(data["error"]["message"].to_string().into());
}
println!("{}", data["ip"]);
Ok(())
}using System.Text.Json;
using var http = new HttpClient();
var res = await http.GetAsync("https://dnsrobot.net/api/v2/me");
var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync()).RootElement;
if (!res.IsSuccessStatusCode)
throw new Exception(data.GetProperty("error").GetProperty("message").GetString());
Console.WriteLine(data.GetProperty("ip"));Called from a server in a data centre (our own, at hosting.com)
GET /api/v2/me{
"query": {},
"ip": "195.250.20.4",
"version": 4,
"special": null,
"hostname": "unvps0032.spidyhost.com",
"network": {
"asn": 199404,
"name": "WHG Hosting Services",
"organization": "WHG Hosting Services Ltd",
"brand": {
"name": "hosting.com",
"website": "hosting.com"
},
"kind": "hosting",
"service": null,
"users": null
},
"location": {
"country": "IN",
"countryName": "India",
"region": "Maharashtra",
"regionCode": "MH",
"city": "Artist Village",
"postalCode": "400703",
"timezone": "Asia/Kolkata",
"latitude": 19.03227,
"longitude": 73.04276,
"continent": "AS",
"eu": false,
"source": "cloudflare"
},
"connection": {
"type": "hosting",
"tor": false,
"relay": null,
"colo": "HKG",
"rttMs": 97,
"httpProtocol": "HTTP/2",
"tlsVersion": "TLSv1.3"
},
"tookMs": 1157
}