DNS Lookup API

API documentation for the DNS Lookup endpoints.

Endpoints

The DNS Lookup API provides endpoints for looking up various DNS record types for a domain.

GET /v1/dns/lookup

Look up DNS records for a domain.

Request Parameters

ParameterTypeRequiredDescription
domainstringYesThe domain to look up.
typestringNoThe record type to look up (A, AAAA, MX, NS, CNAME, TXT, SOA, etc.). Defaults to "A".
nameserverstringNoThe nameserver to query. If not specified, the system default nameserver is used.

Response

A successful response includes the requested DNS records.

curl -X GET "https://api.www12.dpdns.org/v1/dns/lookup?domain=example.com&type=A" \
  -H "Authorization: Bearer YOUR_API_KEY"

GET /v1/dns/batch-lookup

Look up DNS records for multiple domains.

Request Parameters

ParameterTypeRequiredDescription
domainsstringYesComma-separated list of domains to look up.
typestringNoThe record type to look up (A, AAAA, MX, NS, CNAME, TXT, SOA, etc.). Defaults to "A".
nameserverstringNoThe nameserver to query. If not specified, the system default nameserver is used.

Response

A successful response includes the requested DNS records for each domain.

curl -X GET "https://api.www12.dpdns.org/v1/dns/batch-lookup?domains=example.com,example.org&type=A" \
  -H "Authorization: Bearer YOUR_API_KEY"

Error Codes

The DNS Lookup API may return the following error codes:

CodeDescription
invalid_domainThe domain provided is invalid.
invalid_record_typeThe record type provided is invalid.
nameserver_errorAn error occurred while querying the nameserver.
rate_limit_exceededYou have exceeded the rate limit for this endpoint.

Code Examples

Here are some examples of how to use the DNS Lookup API with our client libraries:

// Install the package: npm install @dpdns/api-client

const DPDnsClient = require('@dpdns/api-client');

// Initialize the client with your API key
const client = new DPDnsClient('YOUR_API_KEY');

// Look up DNS records for a domain
client.dns.lookup({
  domain: 'example.com',
  type: 'A'
})
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error(error);
  });