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
| Parameter | Type | Required | Description |
|---|---|---|---|
| domain | string | Yes | The domain to look up. |
| type | string | No | The record type to look up (A, AAAA, MX, NS, CNAME, TXT, SOA, etc.). Defaults to "A". |
| nameserver | string | No | The 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| domains | string | Yes | Comma-separated list of domains to look up. |
| type | string | No | The record type to look up (A, AAAA, MX, NS, CNAME, TXT, SOA, etc.). Defaults to "A". |
| nameserver | string | No | The 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:
| Code | Description |
|---|---|
| invalid_domain | The domain provided is invalid. |
| invalid_record_type | The record type provided is invalid. |
| nameserver_error | An error occurred while querying the nameserver. |
| rate_limit_exceeded | You 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);
});