Why use?

Do you need to get the public IP address or IP Geolocation programmatically? Do you have the requirements to obtain the servers’ public IP address? Do you need to get the location of your servers? Whatever the reason,sometimes a public IP address and IP Geolocation API are useful.

You should use IP.la because:

  • You can initiate requests without any limit.
  • You can get the english or chinese location data.
  • Does not record the visitor information.
  • Lastly, IP.la is sponsored by IPIP.NET and will exist in long-term stability, please feel free to use it.

API Usage

Using IP.la is ridiculously simple. You have two options. Address location support English and Chinese. You can get your public IP directly (in plain text), you can get your public IP in JSON format.

- API URI Type Sample Output (IPv4) Sample Output (IPv6)
get IP https://api.ip.la text 2001:4860:4860::8888
get XFF(X-Forwarded-For) https://api.ip.la/xff text 2001:4860:4860::8888
get IP Location(English) https://api.ip.la/en?json json
Coming soon
get IP Location(Chinese Simplified) https://api.ip.la/cn?json json
Coming soon

Gets the information for the request.

- API URI Type Sample Output
get Request Header https://api.ip.la/header text
GET /header HTTP/1.1
Host: api.ip.la
Accept: */*
User-Agent: curl/7.54.0


This section contains some common usage patterns from a variety of programming languages. Email me!



ip=$(curl -s https://api.ip.la)
echo "My public IP address is: $ip"


# This example requires the requests library be installed.  You can learn more
# about the Requests library here: http://docs.python-requests.org/en/latest/
from requests import get

ip = get('https://api.ip.la').text
print('My public IP address is: {}'.format(ip))


require "net/http"

ip = Net::HTTP.get(URI("https://api.ip.la"))
puts "My public IP Address is: " + ip


    $ip = file_get_contents('https://api.ip.la');
    echo "My public IP address is: " . $ip;


try (java.util.Scanner s = new java.util.Scanner(new java.net.URL("https://api.ip.la").openStream(), "UTF-8").useDelimiter("\\A")) {
    System.out.println("My current IP address is " + s.next());
} catch (java.io.IOException e) {


use strict;
use warnings;
use LWP::UserAgent;

my $ua = new LWP::UserAgent();
my $ip = $ua->get('https://api.ip.la')->content;
print 'My public IP address is: '. $ip;


var httpClient = new HttpClient();
var ip = await httpClient.GetStringAsync("https://api.ip.la");
Console.WriteLine($"My public IP address is: {ip}");


var http = require('http');

http.get({'host': 'api.ip.la', 'port': 80, 'path': '/'}, function(resp) {
  resp.on('data', function(ip) {
    console.log("My public IP address is: " + ip);


package main

import (

func main() {
        res, _ := http.Get("https://api.ip.la")
        ip, _ := ioutil.ReadAll(res.Body)



GET / HTTP/1.1
Host: www.ip.la
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip
Connection: Keep-Alive
If-Modified-Since: Thu, 24 May 2018 05:41:34 GMT
User-Agent: CCBot/2.0 (https://commoncrawl.org/faq/)