My IP Address API - Develop With for Free

Welcome developers! Develop your app or website with the power of If you need to find out your IP or a visitor's public IP address in a programmatic way, we have the right tool for you. Our free, simple, and easy to use RESTful IP Address API provides the caller's IP address in formats like TXT, CSV, JSON, JSONP, XML and YAML.

Most formats also provide the proxy server's IP address if the service is accessed through a transparent proxy. If we can't detect a proxy then the proxy server's IP address is the same as the public IP address.

If you are not a developer or have no need of a free IP address API, maybe you are just asking "What's my IP address" or if you want extended information about your own public IP address please visit our My IP address page for help.


The API URL has the following form:

The list of supported parameters and returned values is enumerated further below. Parameters are submitted using a standard query string, and individual parameters are separated using the ampersand ( & ) character as shown in the following example:

API Parameters

The My IP API supports the parameters listed below. All values are case sensitive unless noted otherwise. Some parameters are used for certain output formats only. If you send a request with unsupported parameter values it might get answered with either 400 Bad Request or 404 Not Found HTTP status code.

ParameterRequiredPossible ValuesDefault ValueSupported Formats
  • csv - Comma Separated Values
  • json - JavaScript Object Notation
  • jsonp - JSON with Padding
  • txt - Plain Text
  • xml - Extensible Markus Language
  • yaml - YAML
callbacknoUp to 63 alphanumeric characters ([a-zA-Z0-9])callbackjsonp

API Return Values

A query to the API returns the caller's IP address and a possible proxy server IP address.

ValueDescriptionSupported Formats
ipaddressThe caller's IP addressAll
proxyThe IP address of the proxy server if one was detected, caller's IP address otherwiseAll but txt

API Usage Samples

Depending on your needs our API can provide the public IP address in various data formats. The most simple is the text format, and it only returns a single line consisting of the caller's public IP address. Other formats also provide the IP address of a proxy server if one is used. Please have a look at the samples further below to find out how the values are returned in individual formats.

Plain Text




JSONP with Custom Callback Function

<?xml version="1.0"?><myip><ipaddress></ipaddress><proxy></proxy></myip>

--- ipaddress: proxy:

Sample Code

The API can be queried from almost any programming language, and even for a single programming language different methods may be available. The following code samples provide an overview about common techniques to retrieve the public IP address. To keep the examples simple error checking has been omitted.


$csv = array_map ('str_getcsv', file(''));
echo "Public IP address: {$csv[1][0]}\n";
echo "Proxy IP address: {$csv[1][1]}\n";
$xml = simplexml_load_file ('');
echo "Public IP address: {$xml->ipaddress}\n";
echo "Proxy IP address: {$xml->proxy}\n";
$ch = curl_init ('');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec ($ch);
curl_close ($ch);
$json = json_decode ($data);
echo "Public IP address: {$json->ipaddress}\n";
echo "Proxy IP address: {$json->proxy}\n";


<script type="text/javascript">
function myip(callback){
  var r;
  if (window.XMLHttpRequest)r=new XMLHttpRequest();
  else r=new ActiveXObject("Microsoft.XMLHTTP");
    if (r.readyState==4&&r.status=="200")callback(r.responseText);
  var json=JSON.parse(response);
  document.write("<p>Public IP address: "+json.ipaddress+"</p>");
  document.write("<p>Proxy IP address: "+json.proxy+"</p>");


<script src=""></script>
<script type="text/javascript">
    document.write("<p>Public IP address: "+json.ipaddress+"</p>");
    document.write("<p>Proxy IP address: "+json.proxy+"</p>");


IP=$(curl -s
echo "Public IP address: $IP"
IP=`curl -s`
echo "Public IP address: $IP"