Don't want to read anything else? Then don't, run the code sample below in your terminal to see some code magic!

$ curl 'https://api.seeip.org/jsonip?'

What can I do with it?

Have you ever needed to get an IPv4 or IPv6 address separately within your software or web app? Maybe you want to show your visitors both their IPv4 and IPv6 addresses at the same time or you want to test IPv6 readiness. With SeeIP you can do this and more!

You should use SeeIP because:

  • You can use it without any real limit.
  • It's open source, and 100% free to use.
  • It will always be online and secure.
  • It can show both IPv6 and IPv4 addresses together or separately.
  • The API powering this site is open source, and can be viewed on .
  • No user information is ever logged no matter what. We value privacy.
  • SeeIP is funded by UNVIO, LLC, you don't need to worry about the website disappearing or the SSL certs expiring, which we've had some trouble with in the past and is one of the main reasons why we wanted to fund and serve an open public IP API ourselves.

API Usage

Using SeeIP is really easy. You have multiple options. You can retrieve an IP in text, JSON or JSONP format, and you can also retrieve the IP's Geolocation information. You can choose to get either IPv4 or IPv6 or only IPv4 or IPv6.

API URI Response Type Sample Output (IPv4) Sample Output (IPv6)
https://api.seeip.org text 192.88.99.23 2a05:dfc7:5::53
https://api.seeip.org/jsonip json {"ip":"192.88.99.23"} {"ip":"2a05:dfc7:5::53"}
https://api.seeip.org/jsonip?callback=getip jsonip getip({"ip":"192.88.99.23"}); getip({"ip":"2a05:dfc7:5::53"});

IPv4 Only

The endpoints below will only display IPv4 addresses.

API URI Response Type Sample Output
https://ipv4.seeip.org text 192.88.99.23
https://ipv4.seeip.org/jsonip json {"ip":"192.88.99.23"}
https://ipv4.seeip.org/jsonip?callback=getip jsonip getip({"ip":"192.88.99.23"});

IPv6 Only

The endpoints below will only display IPv6 addresses.

API URI Response Type Sample Output
https://ipv6.seeip.org text 2a05:dfc7:5::53
https://ipv6.seeip.org/jsonip json {"ip":"2a05:dfc7:5::53"}
https://ipv6.seeip.org/jsonip?callback=getip jsonip getip({"ip":"2a05:dfc7:5::53"});

Examples

Some common usage patterns from a variety of programming languages are outlined below.

Bash

#!/bin/bash

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

Python

# 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.seeip.org').text
print('My public IP address is: {}'.format(ip))

Ruby

require "net/http"

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

PHP

<?php
    $ip = file_get_contents('https://api.seeip.org');
    echo "My public IP address is: " . $ip;
?>

Java

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

Perl

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

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

C#

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

VB.NET

Dim httpClient As New System.Net.Http.HttpClient
Dim ip As String = Await httpClient.GetStringAsync("https://api.seeip.org")
Console.WriteLine($"My public IP address is: {ip}")

NodeJS

var http = require('http');

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

Go

package main

import (
        "io/ioutil"
        "net/http"
        "os"
)

func main() {
        res, _ := http.Get("https://api.seeip.org")
        ip, _ := ioutil.ReadAll(res.Body)
        os.Stdout.Write(ip)
}

Racket

(require net/url)

(define ip (port->string (get-pure-port (string->url "https://api.seeip.org"))))
(printf "My public IP address is: ~a" ip)

Scala

val addr = scala.io.Source.fromURL("https://api.seeip.org").mkString
println(s"My public IP address is: $addr")

Javascript

<script type="application/javascript">
  function getIP(json) {
    document.write("My public IP address is: ", json.ip);
  }
</script>

<script type="application/javascript" src="https://api.seeip.org?format=jsonp&callback=getIP"></script>

jQuery

<script type="application/javascript">
  $(function() {
    $.getJSON("https://api.seeip.org?format=jsonp&callback=?",
      function(json) {
        document.write("My public IP address is: ", json.ip);
      }
    );
  });
</script>

C#

using System;
using System.Net;

namespace seeip.Examples {
    class Program {
        public static void Main (string[] args) {
            WebClient webClient = new WebClient();
            string publicIp = webClient.DownloadString("https://api.seeip.org");
            Console.WriteLine("My public IP Address is: {0}", publicIp);
        }
    }
}

nim

import HttpClient
var ip = newHttpClient().getContent("https://api.seeip.org")
echo("My public IP address is: ", ip)

PowerShell

$ip = Invoke-RestMethod -Uri 'https://api.seeip.org?format=json'
"My public IP address is: $($ip.ip)"

Lua

http.Fetch("https://api.seeip.org", function(body) print("My ip is: " .. body ) end

PureBasic

InitNetwork()
*Buffer = ReceiveHTTPMemory("https://api.seeip.org?format=json")
If *Buffer
  ParseJSON(0, PeekS(*Buffer, MemorySize(*Buffer), #PB_UTF8))
  FreeMemory(*Buffer)
  Debug GetJSONString(GetJSONMember(JSONValue(0), "ip"))
EndIf

LiveCode

put "My public IP address is" && url "https://api.seeip.org"

Arduino

if (client.connect("api.seeip.org", 80)) {
    Serial.println("connected");
    client.println("GET / HTTP/1.0");
    client.println("Host: api.seeip.org");
    client.println();
} else {
    Serial.println("connection failed");
}

GeoIP (Get IP address location in JSON format)

Calling the API endpoint without any parameter will return location information for the visitor IP address:

Appending an IP address as parameter will return location information for this IP address:

JSON Output Scheme

The output is a JSON object containing the following elements:

Please note that the IP location database, which for this API is Maxmind, may not contain all information about a given IP. In this case, only the available data is displayed.

  • ip (Visitor IP address, or IP address specified as parameter)
  • country_code (Two-letter ISO 3166-1 alpha-2 country code)
  • country_code3 (Three-letter ISO 3166-1 alpha-3 country code)
  • country (Name of the country)
  • region_code (Two-letter ISO-3166-2 state/region code for US and Canada, FIPS 10-4 region codes otherwise)
  • region (Name of the region)
  • city (Name of the city)
  • postal_code (Postal code/Zip code)
  • continent_code (Two-letter continent code)
  • latitude (Latitude)
  • longitude (Longitude)
  • dma_code (DMA Code)
  • area_code (Area Code)
  • organization (ASN + ISP name)
  • timezone (Time Zone)
  • offset (UTC time offset)

Output example

The dma, continent, and area code information is not available and thus not present in the output JSON object:

{
  "ip":"208.67.222.222",
  "organization": "AS36692 OpenDNS, LLC",
  "city": "San Francisco",
  "region": "California",
  "dma_code": "0",
  "area_code": "0",
  "timezone": "America\/Los_Angeles",
  "offset": "-7",
  "longitude": -122.3933,
  "country_code3": "USA",
  "postal_code": "94107",
  "continent_code": "NA",
  "country": "United States",
  "region_code": "CA",
  "country_code": "US","latitude":37.7697
}