Hosted Domain API

Overview

Hosted Domain API allowing users to get the list of hosted domain names by IP address in real time. The REST API supports both IPv4 and IPv6 address lookup.

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.
ip (required) IP address (IPv4 or IPv6) for hosted domain lookup purposes.
format (optional) Format of the response message.
Valid value: json | xml

If unspecified, json format will be used for the response message.
page (optional) Pagination result returns of the hosted domains.

If unspecified, 1st page will be used.

API Endpoint

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

Query String
https://domains.ip2whois.com/domains?key={YOUR_API_KEY}&ip=8.8.8.8    
Response
{
    "ip": "8.8.8.8",
    "total_domains": 3857,
    "page": 1,
    "per_page": 100,
    "total_pages": 39,
    "domains": [
        "000180.top",
        "00100tet.xyz",
        "001hash.vip",
        "002hash.com",
        "0050500.xyz",
        "007515.com",
        "023mm.net",
        "023mt.net",
        "023sn.net",
        "031000.xyz",
        "0515smw.com",
        "058637.com",
        "0798907.xyz",
        "07capital.com",
        "07osrs.com",
        "07sh2wv.bar",
        "0857.site",
        "0931seo.com",
        "0lzh.com",
        "0x4f.com",
        "0x57696c6c.com",
        "0xb055.com",
        "1-189tais.com",
        "10askfcwebkvh.top",
        "1102halfhowehbao1.com",
        "1102hdfkeuwuhfubao2.com",
        "1102hdukefjkf2.com",
        "1102sdbkwuoubao3.com",
        "11107hdkjhguk.com",
        "111km.xyz",
        "1130kfhuhw.com",
        "11eqlhon.top",
        "1206m.site",
        "125ap.com",
        "12la21wn31da40le6.com",
        "12safhoie.top",
        "12tivi.com",
        "1333limited.com",
        "1333yyh.com",
        "135493.com",
        "136668.xyz",
        "13shkuwq.top",
        "142937440.site",
        "144888.xyz",
        "14whoduhw.top",
        "1562yjargm.xyz",
        "15sdkwb.top",
        "167853.xyz",
        "168.one",
        "168km.xyz",
        "16uhwfuhe.cyou",
        "176274.com",
        "17diqwehfoi.cyou",
        "17jule.com",
        "18uhefoh.cyou",
        "191095211.xyz",
        "19931006.xyz",
        "19g.vip",
        "19wuji.cyou",
        "1huofhoehfogakfwqqq.com",
        "1ine1.com",
        "1master-fitness.com",
        "1rf3k.com",
        "1s1s.app",
        "1visualizer.app",
        "200250.xyz",
        "20070217.xyz",
        "20088888.xyz",
        "20230406.mov",
        "205566.com",
        "205artemisbet.com",
        "20iiij.cyou",
        "21107ahsfukhweo.com",
        "21hodheoh.cyou",
        "22bahman.space",
        "22howhw.cyou",
        "231q.top",
        "234n.top",
        "236j.top",
        "23hw.cyou",
        "24asfbkhb.cyou",
        "24ihhcorp.com",
        "25dgfu.cyou",
        "26asfhku.cyou",
        "277210.shop",
        "27adfljn.cyou",
        "28dshkf.cyou",
        "29583.biz",
        "29dakfb.cyou",
        "2ashdowehofhweohfo.com",
        "2c.com",
        "2qdrap.com",
        "2s1c.com",
        "304065117.xyz",
        "30fwhdfkb.cyou",
        "3101r.space",
        "31107abskjfbekb.com",
        "315sx.com",
        "31dfhkjsdb.cyou",
        "325965.com"
    ]
}
https://domains.ip2whois.com/domains?key={YOUR_API_KEY}&ip=8.8.8.8&format=xml    
Response
<result>
  <ip>8.8.8.8</ip>
  <total_domains>3857</total_domains>
  <page>1</page>
  <per_page>100</per_page>
  <total_pages>39</total_pages>
  <domains>
    <item>000180.top</item>
    <item>00100tet.xyz</item>
    <item>001hash.vip</item>
    <item>002hash.com</item>
    <item>0050500.xyz</item>
    <item>007515.com</item>
    <item>023mm.net</item>
    <item>023mt.net</item>
    <item>023sn.net</item>
    <item>031000.xyz</item>
    <item>0515smw.com</item>
    <item>058637.com</item>
    <item>0798907.xyz</item>
    <item>07capital.com</item>
    <item>07osrs.com</item>
    <item>07sh2wv.bar</item>
    <item>0857.site</item>
    <item>0931seo.com</item>
    <item>0lzh.com</item>
    <item>0x4f.com</item>
    <item>0x57696c6c.com</item>
    <item>0xb055.com</item>
    <item>1-189tais.com</item>
    <item>10askfcwebkvh.top</item>
    <item>1102halfhowehbao1.com</item>
    <item>1102hdfkeuwuhfubao2.com</item>
    <item>1102hdukefjkf2.com</item>
    <item>1102sdbkwuoubao3.com</item>
    <item>11107hdkjhguk.com</item>
    <item>111km.xyz</item>
    <item>1130kfhuhw.com</item>
    <item>11eqlhon.top</item>
    <item>1206m.site</item>
    <item>125ap.com</item>
    <item>12la21wn31da40le6.com</item>
    <item>12safhoie.top</item>
    <item>12tivi.com</item>
    <item>1333limited.com</item>
    <item>1333yyh.com</item>
    <item>135493.com</item>
    <item>136668.xyz</item>
    <item>13shkuwq.top</item>
    <item>142937440.site</item>
    <item>144888.xyz</item>
    <item>14whoduhw.top</item>
    <item>1562yjargm.xyz</item>
    <item>15sdkwb.top</item>
    <item>167853.xyz</item>
    <item>168.one</item>
    <item>168km.xyz</item>
    <item>16uhwfuhe.cyou</item>
    <item>176274.com</item>
    <item>17diqwehfoi.cyou</item>
    <item>17jule.com</item>
    <item>18uhefoh.cyou</item>
    <item>191095211.xyz</item>
    <item>19931006.xyz</item>
    <item>19g.vip</item>
    <item>19wuji.cyou</item>
    <item>1huofhoehfogakfwqqq.com</item>
    <item>1ine1.com</item>
    <item>1master-fitness.com</item>
    <item>1rf3k.com</item>
    <item>1s1s.app</item>
    <item>1visualizer.app</item>
    <item>200250.xyz</item>
    <item>20070217.xyz</item>
    <item>20088888.xyz</item>
    <item>20230406.mov</item>
    <item>205566.com</item>
    <item>205artemisbet.com</item>
    <item>20iiij.cyou</item>
    <item>21107ahsfukhweo.com</item>
    <item>21hodheoh.cyou</item>
    <item>22bahman.space</item>
    <item>22howhw.cyou</item>
    <item>231q.top</item>
    <item>234n.top</item>
    <item>236j.top</item>
    <item>23hw.cyou</item>
    <item>24asfbkhb.cyou</item>
    <item>24ihhcorp.com</item>
    <item>25dgfu.cyou</item>
    <item>26asfhku.cyou</item>
    <item>277210.shop</item>
    <item>27adfljn.cyou</item>
    <item>28dshkf.cyou</item>
    <item>29583.biz</item>
    <item>29dakfb.cyou</item>
    <item>2ashdowehofhweohfo.com</item>
    <item>2c.com</item>
    <item>2qdrap.com</item>
    <item>2s1c.com</item>
    <item>304065117.xyz</item>
    <item>30fwhdfkb.cyou</item>
    <item>3101r.space</item>
    <item>31107abskjfbekb.com</item>
    <item>315sx.com</item>
    <item>31dfhkjsdb.cyou</item>
    <item>325965.com</item>
  </domains>
</result>

Don't have a free account? .

API Pagination

Pagination in an API is a technique used to split large sets of data into smaller, manageable chunks or pages instead of returning everything at once. It appears when the returned dataset is too large, so the API limits the number of items returned per request (e.g., 100 domains per page).

You can use the page parameter to loop through the pagination in the Hosted Domain API query. You could increment the page value in each request (e.g., page=1, page=2, etc.) until you reach the value of total_pages in the response, which indicates the last page of the returned domains.

Response Format

The REST API returns the following fields and values.

Field Description
ip IP Address.
total_domains Total number of hosted domains found.
page Current lookup page.
per_page Number of domains displayed in the page.
total_pages Total pages of the hosted domains.
domains Hosted domains of the lookup IP Address.

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 Internal server error.
10006 Invalid IP address.
10007 Invalid format.
10008 Invalid page value.

Sample Codes

You can use the sample codes below for different applications.

<?php
$apiKey = 'YOUR_API_KEY';
$params['ip'] = 'Enter_IP_Address';
$params['format'] = 'json';

$query = '';

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

$result = file_get_contents('https://domains.ip2whois.com/domains?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("ip", "Enter_IP_Address");
            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://domains.ip2whois.com/domains?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("ip", "Enter_IP_Address")
        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://domains.ip2whois.com/domains?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("ip", "Enter_IP_Address");
            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://domains.ip2whois.com/domains?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', 'ip': 'Enter_IP_Address', 'format': 'json' }

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

uri = URI.parse("https://domains.ip2whois.com/domains")
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',
  'ip' => 'Enter_IP_Address',
  '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',
    ip: 'Enter_IP_Address',
    format: 'json',
};

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

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://domains.ip2whois.com/domains?key={}&ip={}&format=json",
            "YOUR_API_KEY", "Enter_IP_Address"
        );
	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(())
}

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