Domains App
DocumentationGuidesHelp
  • Get started
    • Documentation
  • Core features
    • Monitor domains
    • Use domain Collections
    • Domains database
  • API
    • API Introduction
    • API Endpoints
      • Domain info
      • Domain WHOIS
      • DNS Records
      • Similar websites (beta)
    • Examples
Powered by GitBook
On this page

Was this helpful?

  1. API
  2. API Endpoints

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)

GET https://domains-api.com/domains/{domain}/dns-records

Path Parameters

Name
Type
Description

domain*

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

- "text/plain" (default): return DNS records as text lines

- "application/json": return DNS records as JSON object

Examples

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)
    })
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)
PreviousDomain WHOISNextSimilar websites (beta)

Last updated 4 months ago

Was this helpful?