ipapi.xyz - IP info JSON/text API

ipapi.xyz is a straightforward API that provides you with:


ipapi.xyz offers both an extended JSON endpoint and a simple response with only your IP. This last option is very useful in a CLI scenario, because you can get your IP address with just a cURL one-liner (see the example below).



    "ip": "",
    "hostname": "ec2-107-23-129-77.compute-1.amazonaws.com",
    "request_info": {
        "accept": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8",
        "accept-encoding": "gzip",
        "accept-language": "en-US,en;q=0.5",
        "user-agent": "CCBot\/2.0 (https:\/\/commoncrawl.org\/faq\/)"
    "retrievedAt": {
        "unix_timestamp": "1558834644",
        "rfc2822": "Sun, 26 May 2019 03:37:24 +0200"

http://ipapi.xyz/ip or http://ipapi.xyz/text


Technical note: most information is obtained using the corresponding PHP functions, so you can expect the corresponding behaviour as provided in the PHP documentation. For instance, if the hostname is not available (no rDNS record was found), the API will return your IP address as your hostname. This is exactly what the gethostbyaddr function does. It will not return null, or remove the hostname field entirely.

HTTPS support: just replace http with https to enable it. Traditional HTTP requests are not redirected on purpose: many users of this API might not support encryption, for instance embedded or IoT devices.

Some usage examples

let url = URL(string: "https://ipapi.xyz/ip")
do {
  let ip = try String(contentsOf: url)
} catch {
  // network error
NSString *ipAddr = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://ipapi.xyz/ip"] encoding:NSUTF8StringEncoding error:nil];
$conn = curl_init();
curl_setopt($conn, CURLOPT_URL, "http://ipapi.xyz/ip");
curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1);
$ip = curl_exec($conn);
echo $ip;
(require net/url)
; ip-addr is String
(define ip-addr (port->string (get-pure-port (string->url "https://ipapi.xyz/ip"))))
andrea@cogitatio:~ $ curl ipapi.xyz/ip
andrea@cogitatio:~ $

I'm only providing a few examples here. If you have implemented the API in another programming language, send me your snippet at andrea {at} ipapi {dot} xyz. The more exotic the language is, the better! I'm hoping to publish a huge page with as many usage examples as possible.

Get downtime notifications

If you use the API and your software relies on it, I recommend that you subscribe using the form below. The mailing list is handled by MailChimp.

If you subscribe, I will keep you updated, especially if I have to take the API down for maintenance or if for some reason I have to shut down the entire service (I expect this will not happen in the near future!). No spammy emails, promised.


Currently, there is no automatic rate limiting implemented. 😊

However, I reserve the right to block your IP if I receive an unreasonable amount of requests.

Known issues, to-do & support

Please contact me at andrea {at} ipapi {dot} xyz for issues or bugs.