> 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/dns-records.md).

# DNS Records

Check DNS records and subdomains

List all DNS Records (subdomains, A, MX, CNAME, TXT, etc) for a domain.

Subdomains are auto-disovered, and hints for more obscure ones can be sent to the API to check for.

**Pro tip**: use the "Accept" header to retrieve the DNS records in different types:

* "application/json" - get DNS Records as JSON objects
* "text/plain" - get DNS Records as text lines in 2 modes: wait for full response or read streamed lines as they are discovered (see JavaScript Fetch example below)

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

#### Path Parameters

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

#### Query Parameters

| Name      | Type   | Description                  |
| --------- | ------ | ---------------------------- |
| type      | String | A, AAAA, MX, etc             |
| apiKey    | String | Your API Key                 |
| subdomain | String | Extra subdomain to check for |

#### Headers

| Name          | Type   | Description                                                                                                                     |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------- |
| Authorization | String | Your API Key                                                                                                                    |
| Accept        | String | <p>- "text/plain" (default): return DNS records as text lines</p><p>- "application/json": return DNS records as JSON object</p> |

### Examples

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

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

// text/plain - get DNS records as they are discovered (stream)
fetch(`/domains/${domain}/dns-records?key=_api_key_`)
    .then(async response => {
        if (response.ok) {
            const reader = response.body.getReader()
            const decoder = new TextDecoder()
            while (true) {
                const {done, value} = await reader.read();
                if (done) return;
                
                // dns record line
                console.log(decoder.decode(value))
            }
        }
    })

// text/plain - wait for full response
fetch(`/domains/${domain}/dns-records?key=_api_key_`)
    .then(response => response.text())
    .then(dnsRecords => {
        console.log('all DNS Records', dnsRecords)
    })

// application/json
fetch(`/domains/${domain}/dns-records?key=_api_key_`, {
    headers: {
        accept: 'application/json',
    }
})
    .then(response => response.json())
    .then(dnsRecords => {
        console.log('all DNS Records', dnsRecords)
    })
```

{% endtab %}

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

```javascript
import axios from 'axios'

const domain = 'github.com'
const { data: dnsRecords } = await axios(`https://domains-api.com/domain/${domain}/dns-records?key=_key_`, {
  headers: {
    accept: 'application/json'
  }
})

console.log('all dns records', dnsRecords)
```

{% endtab %}
{% endtabs %}
