> For the complete documentation index, see [llms.txt](https://docs.dmns.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dmns.app/api/api-endpoints/domain-whois.md).

# Domain WHOIS

Get fresh WHOIS data for any domain

Most fields are normalized to a common format, so dates, statuses, NS and more fields have same labels across different TLDs.

## Get WHOIS data for any domain on the internet

<mark style="color:blue;">`GET`</mark> `https://domains-api.com/domains/{domain}/whois`

Use this endpoint if you need domain WHOIS data. Api Key is required in either apiKey query parameter or Authorization header.

#### Path Parameters

| Name                                     | Type   | Description       |
| ---------------------------------------- | ------ | ----------------- |
| domain<mark style="color:red;">\*</mark> | String | Valid domain name |

#### Query Parameters

| Name   | Type    | Description                                                                                   |
| ------ | ------- | --------------------------------------------------------------------------------------------- |
| key    | String  | Your API Key                                                                                  |
| follow | Number  | How many WHOIS servers to query. 1 is faster, 2 includes more data from Registrar. Default: 1 |
| raw    | Boolean | Set to 1 or true to return raw WHOIS data in text format                                      |

#### Headers

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| Authorization | String | Your API Key. Include it as `Bearer sk_abc123` |

{% tabs %}
{% tab title="200: OK " %}
The successful response will be in JSON format, and is an Object with WHOIS servers as keys.

```
{
	"whois.verisign-grs.com": {
		"Domain Name": "GOOGLE.COM",
		"Registrar WHOIS Server": "whois.markmonitor.com",
		...
	},
	"whois.markmonitor.com": {
		"Domain Name": "google.com",
		"Creation Date": "1997-09-15T00:00:00-0700",
		"Expiry Date": "2020-09-13T21:00:00-0700",
		"Registrar": "MarkMonitor, Inc.",
		"Domain Status": [
				"clientUpdateProhibited",
				"clientTransferProhibited"
		],
		...
		"Name Server": [
				"ns1.google.com",
				"ns2.google.com"
		],
		"text": [
				"For more information on WHOIS status codes, please visit:",
				...
		]
	}
}
```

{% endtab %}
{% endtabs %}

### Examples

{% tabs %}
{% tab title="JS - axios" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>import axios from 'axios'
</strong>
const domain = 'github.com'
const whoisResponse = await axios(`https://domains-api.com/domains/${domain}/whois?key=_key_`)

const whoisServers = Object.keys(whoisResponse.data)
const whoisData = whoisResponse[whoisServers[0]]

console.log(whoisData)
</code></pre>

{% endtab %}

{% tab title="JS - fetch" %}

```javascript
const domain = 'ai.com'

fetch(`https://domains-api.com/domains/${domain}/whois?follow=1`, {
        headers: {
            Authorizaton: `Bearer _api_key_`
        }
    })
    .then(response => response.json())
    .then(domainWhois => {
        const whoisServers = Object.keys(domainWhois)

        // whois data from Registry (first whois server)
        console.log('Registry whois:', whoisServers[0])
        console.log('Domain Expiry:', domainWhois[whoisServers[0]]["Expiry Date"])
    })
```

{% endtab %}
{% endtabs %}
