IP2WHOIS Domain WHOIS API

Overview

IP2WHOIS Domain WHOIS API helps users to obtain domain information and WHOIS record by using a domain name. The WHOIS API returns a comprehensive WHOIS data such as creation date, updated date, expiration date, domain age, the contact information of the registrant, mailing address, phone number, email address, nameservers the domain is using and much more. It supports the query for 1221 TLDs and 634 ccTLDs.

You may try the WHOIS API demo at here. The API requires an API key to function. If you do not have one, you may click on the below button to sign up for a Free Plan.

Get A Free API Key

Parameters

The REST API calling syntax. Please see the table below for the description of each parameter.

Name Description
key (required) API key.
domain (required) Domain name.
format (optional) Format of the response message.
Valid value: json | xml

If unspecified, json format will be used for the response message.

API Endpoint

The IP2WHOIS Domain WHOIS API supports json(default) and xml response formats. Please find the sample response below.

Query String
https://api.ip2whois.com/v2?key={YOUR_API_KEY}&domain=locaproxy.com    
Response
{
    "domain": "locaproxy.com",
    "domain_id": "1710914405_DOMAIN_COM-VRSN",
    "status": "clientTransferProhibited https://icann.org/epp#clientTransferProhibited",
    "create_date": "2012-04-03T02:34:32Z",
    "update_date": "2021-12-03T02:54:57Z",
    "expire_date": "2024-04-03T02:34:32Z",
    "domain_age": 3863,
    "whois_server": "whois.godaddy.com",
    "registrar": {
        "iana_id": "146",
        "name": "GoDaddy.com, LLC",
        "url": "https://www.godaddy.com"
    },
    "registrant": {
        "name": "Registration Private",
        "organization": "Domains By Proxy, LLC",
        "street_address": "DomainsByProxy.com",
        "city": "Tempe",
        "region": "Arizona",
        "zip_code": "85284",
        "country": "US",
        "phone": "+1.4806242599",
        "fax": "+1.4806242598",
        "email": "Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=LOCAPROXY.COM"
    },
    "admin": {
        "name": "Registration Private",
        "organization": "Domains By Proxy, LLC",
        "street_address": "DomainsByProxy.com",
        "city": "Tempe",
        "region": "Arizona",
        "zip_code": "85284",
        "country": "US",
        "phone": "+1.4806242599",
        "fax": "+1.4806242598",
        "email": "Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=LOCAPROXY.COM"
    },
    "tech": {
        "name": "Registration Private",
        "organization": "Domains By Proxy, LLC",
        "street_address": "DomainsByProxy.com",
        "city": "Tempe",
        "region": "Arizona",
        "zip_code": "85284",
        "country": "US",
        "phone": "+1.4806242599",
        "fax": "+1.4806242598",
        "email": "Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=LOCAPROXY.COM"
    },
    "billing": {
        "name": "",
        "organization": "",
        "street_address": "",
        "city": "",
        "region": "",
        "zip_code": "",
        "country": "",
        "phone": "",
        "fax": "",
        "email": ""
    },
    "nameservers": ["vera.ns.cloudflare.com", "walt.ns.cloudflare.com"]
}
https://api.ip2whois.com/v2?key={YOUR_API_KEY}&domain=locaproxy.com&format=xml    
Response
<result>
  <domain>locaproxy.com</domain>
  <domain_id>1710914405_DOMAIN_COM-VRSN</domain_id>
  <status>clientTransferProhibited https://icann.org/epp#clientTransferProhibited</status>
  <create_date>2012-04-03T02:34:32Z</create_date>
  <update_date>2021-12-03T02:54:57Z</update_date>
  <expire_date>2024-04-03T02:34:32Z</expire_date>
  <domain_age>3863</domain_age>
  <whois_server>whois.godaddy.com</whois_server>
  <registrar>
    <iana_id>146</iana_id>
    <name>GoDaddy.com, LLC</name>
    <url>https://www.godaddy.com</url>
  </registrar>
  <registrant>
    <name>Registration Private</name>
    <organization>Domains By Proxy, LLC</organization>
    <street_address>DomainsByProxy.com</street_address>
    <city>Tempe</city>
    <region>Arizona</region>
    <zip_code>85284</zip_code>
    <country>US</country>
    <phone>+1.4806242599</phone>
    <fax>+1.4806242598</fax>
    <email>Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=LOCAPROXY.COM</email>
  </registrant>
  <admin>
  <name>Registration Private</name>
    <organization>Domains By Proxy, LLC</organization>
    <street_address>DomainsByProxy.com</street_address>
    <city>Tempe</city>
    <region>Arizona</region>
    <zip_code>85284</zip_code>
    <country>US</country>
    <phone>+1.4806242599</phone>
    <fax>+1.4806242598</fax>
    <email>Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=LOCAPROXY.COM</email>
  </admin>
  <tech>
  <name>Registration Private</name>
    <organization>Domains By Proxy, LLC</organization>
    <street_address>DomainsByProxy.com</street_address>
    <city>Tempe</city>
    <region>Arizona</region>
    <zip_code>85284</zip_code>
    <country>US</country>
    <phone>+1.4806242599</phone>
    <fax>+1.4806242598</fax>
    <email>Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=LOCAPROXY.COM</email>
  </tech>
  <billing>
    <name></name>
    <organization></organization>
    <street_address></street_address>
    <city></city>
    <region></region>
    <zip_code></zip_code>
    <country></country>
    <phone></phone>
    <fax></fax>
    <email></email>
  </billing>
  <nameservers>vera.ns.cloudflare.com, walt.ns.cloudflare.com</nameservers>
</result>

Don't have a free account? .

Response Format

The REST API returns the following fields and values.

Field Description
domain Domain name.
domain_id Domain name ID.
status Domain name status.
create_date Domain name creation date.
update_date Domain name updated date.
expire_date Domain name expiration date.
domain_age Domain name age in day(s).
whois_server WHOIS server name.
registrar.iana_id Registrar IANA ID.
registrar.name Registrar name.
registrar.url Registrar URL.
registrant.name Registrant name.
registrant.organization Registrant organization.
registrant.street_address Registrant street address.
registrant.city Registrant city.
registrant.region Registrant region.
registrant.zip_code Registrant ZIP Code.
registrant.country Registrant country.
registrant.phone Registrant phone number.
registrant.fax Registrant fax number.
registrant.email Registrant email address.
admin.name Admin name.
admin.organization Admin organization.
admin.street_address Admin street address.
admin.city Admin city.
admin.region Admin region.
admin.zip_code Admin ZIP Code.
admin.country Admin country.
admin.phone Admin phone number.
admin.fax Admin fax number.
admin.email Admin email address.
tech.name Tech name.
tech.organization tech.organization
tech.street_address Tech street address.
tech.city Tech city.
tech.region Tech region.
tech.zip_code Tech ZIP Code.
tech.country Tech country.
tech.phone Tech phone number.
tech.fax Tech fax number.
tech.email Tech email address.
billing.name Billing name.
billing.organization Billing organization.
billing.street_address Billing street address.
billing.city Billing city.
billing.region Billing region.
billing.zip_code Billing ZIP Code.
billing.country Billing country.
billing.phone Billing phone number.
billing.fax Billing fax number.
billing.email Billing email address.
nameservers Name servers

Error Object & Codes

An Error object will be returned for any error encountered. For example:

{
    "error": {
        "error_code": 10000,
        "error_message": "Missing parameter."
    }
}

Below is the complete list of the error code and message returned by the IP2WHOIS Domain WHOIS API.

Error Code Error Message
10000 Missing parameter.
10001 API key not found.
10002 API key disabled.
10003 API key expired.
10004 Insufficient queries.
10005 Unknown error.
10006 No data found.
10007 Invalid domain.
10008 Invalid format.

Sample Codes

You can use the sample codes below for different applications.

<?php
$apiKey = 'YOUR_API_KEY';
$params['domain'] = 'Enter_Domain_Name';
$params['format'] = 'json';

$query = '';

foreach($params as $key=>$value){
    $query .= '&' . $key . '=' . rawurlencode($value);
}

$result = file_get_contents('https://api.ip2whois.com/v2?key=' . $apiKey . $query);

$data = json_decode($result);

print_r($data);
?>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Hashtable;
import java.util.Map;

public class test {
    public static void main(String[] args) {
        try {
            String key = "YOUR_API_KEY";
            Hashtable data = new Hashtable();
            data.put("domain", "Enter_Domain_Name");
            data.put("format", "json");

            String datastr = "";
            for (Map.Entry entry : data.entrySet()) {
                datastr += "&" + entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "UTF-8");
            }
            URL url = new URL("https://api.ip2whois.com/v2?key=" + key + datastr);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.setRequestProperty("Accept", "application/json");

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

            String output;

            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }
            conn.disconnect();
        }
        catch (MalformedURLException e) {
            e.printStackTrace();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }
}
Imports System.Net
Imports System.IO
Imports System.Uri

Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim request As HttpWebRequest = Nothing
        Dim response As HttpWebResponse = Nothing

        Dim apiKey As String = "YOUR_API_KEY"
        Dim data As New Dictionary(Of String, String)

        data.Add("domain", "Enter_Domain_Name")
        data.Add("format", "json")
        Dim datastr As String = String.Join("&", data.[Select](Function(x) x.Key & "=" & EscapeDataString(x.Value)).ToArray())

        request = Net.WebRequest.Create("https://api.ip2whois.com/v2?key=" & apiKey & "&" & datastr)

        request.Method = "GET"
        response = request.GetResponse()

        Dim reader As System.IO.StreamReader = New IO.StreamReader(response.GetResponseStream())

        Page.Response.Write(reader.ReadToEnd)

    End Sub

End Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Net;
using System.IO;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            WebRequest request = null;
            WebResponse response = null;

            string apiKey = "YOUR_API_KEY";
            Dictionary data = new Dictionary();

            data.Add("domain", "Enter_Domain_Name");
            data.Add("format", "json");
            string datastr = string.Join("&", data.Select(x => x.Key + "=" + System.Uri.EscapeDataString(x.Value)).ToArray());

            request = System.Net.WebRequest.Create("https://api.ip2whois.com/v2?key=" + apiKey + "&" + datastr);

            request.Method = "GET";
            response = request.GetResponse();

            System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());

            Page.Response.Write(reader.ReadToEnd());
        }
    }
}
import urllib.parse, http.client

p = { 'key': 'YOUR_API_KEY', 'domain': 'Enter_Domain_Name', 'format': 'json' }

conn = http.client.HTTPSConnection("api.ip2whois.com")
conn.request("GET", "/v2?" + urllib.parse.urlencode(p))
res = conn.getresponse()
print res.read()
require 'uri'
require 'net/http'

uri = URI.parse("https://api.ip2whois.com/v2")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({
  'key' => 'YOUR_API_KEY',
  'domain' => 'Enter_Domain_Name',
  'format' => 'json'
})

response = http.request(request)

if response == nil
  return false
else
  return response
end
var https = require('https');
let data = {
    key: 'YOUR_API_KEY',
    domain: 'Enter_Domain_Name',
    format: 'json',
};

let urlStr = 'https://api.ip2whois.com/v2?';

Object.keys(data).forEach(function (key, index) {
    if (this[key] != '') {
        urlStr += key + '=' + encodeURIComponent(this[key]) + '&';
    }
}, data);

urlStr = urlStr.substring(0, urlStr.length - 1);

let d = '';
let req = https.get(urlStr, function (res) {
    res.on('data', (chunk) => (d = d + chunk));
    res.on('end', function () {
        console.log(JSON.parse(d));
    });
});

req.on('error', function (e) {
    console.log(e);
});
use reqwest;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let url = format!(
            "https://api.ip2whois.com/v2?key={}&domain={}&format=json",
            "YOUR_API_KEY", "Enter_Domain_Name"
        );
	let b = reqwest::get(url)
        .get(url)
        .send()
        .await
        .expect("failed to get response")
        .text()
        .await
        .expect("failed to get payload");

	println!("Got {:?}", b);
	Ok(())
}

SDK

For the ease of developers, SDK for various programming languages are available. You may use our official SDK to assist you in code implementation.

Unlock Location Insights For Free

Empower your applications with accurate IP geolocation information now.

Try It for Free
IP2Location.io IP Geolocation API
Dive in and experience accurate IP geolocation API for FREE!
Get FREE API