# DNS Lookup API

URL: https://www.deepinfo.com/data-api/apis/dns-lookup/

## Resolve Any Hostname’s DNS Records as They Stand Now.

The DNS Lookup API takes a domain or hostname and the record types you want. It resolves them in real time and returns, for each type, the response code, the parsed values and the answer in zone-file form.

[Talk to us about access](https://www.deepinfo.com/contact/?topic=data-api) [DNS reference](https://docs.deepinfo.com/reference/lookup/dns/)

### Ask for Several Types and Get One Entry Each.

Each requested type comes back as its own entry, with its own response code and connection status, so a failed type does not hide the answers for the others.

GET `https://api.deepinfo.com/v1/lookup/dns` [Reference](https://docs.deepinfo.com/reference/lookup/dns/)

| Parameter | Type |  | Description |
| --- | --- | --- | --- |
| `domain` | string | Required | A domain or hostname, for example `deepinfo.com` or `www.deepinfo.com`. IP addresses are not accepted. |
| `type` | string | Required | Record types, comma-separated, up to five: `A`, `AAAA`, `CNAME`, `MX`, `NS`, `SOA`, `TXT` and others. |

Request

curl:

```bash
curl "https://api.deepinfo.com/v1/lookup/dns?domain=deepinfo.com&type=A,MX" \
  -H "apikey: YOUR_API_KEY"
```

Python:

```python
import requests

r = requests.get(
    "https://api.deepinfo.com/v1/lookup/dns",
    params={"domain": "deepinfo.com", "type": "A,MX"},
    headers={"apikey": "YOUR_API_KEY"},
)
for answer in r.json()["responses"]:
    print(answer["type"], answer["rcode"], answer["values"])
```

JavaScript:

```javascript
const r = await fetch(
  'https://api.deepinfo.com/v1/lookup/dns?domain=deepinfo.com&type=A,MX',
  { headers: { apikey: 'YOUR_API_KEY' } }
)
const { responses } = await r.json()
for (const a of responses) console.log(a.type, a.rcode, a.values)
```

Response

200 OK · application/json

```json
{
  "fqdn": "deepinfo.com",
  "requested_types": ["A", "MX"],
  "responses": [
    {
      "type": "A",
      "conn_status": "success",
      "rcode": "NOERROR",
      "values": ["104.26.10.21", "104.26.11.21", "…"],
      "raw": "deepinfo.com. 300 IN A 104.26.11.21\n…",
      "server": "8.8.8.8"
    },
    {
      "type": "MX",
      "conn_status": "success",
      "rcode": "NOERROR",
      "values": ["1 aspmx.l.google.com", "5 alt1.aspmx.l.google.com", "…"],
      "…": "…"
    }
  ],
  "servers": ["8.8.8.8"],
  "check_date": "2026-09-22T12:25:59Z"
}
```

### What Each Field Tells You.

The parsed values are there for your code. The raw answer is there for the cases where you need what the resolver said, TTL included.

| Field | Meaning |
| --- | --- |
| `requested_types` | The record types you asked for. |
| `responses[].conn_status` | `success`, or `timeout` when no answer came back for that type. |
| `responses[].rcode` | The DNS response code, such as `NOERROR` or `NXDOMAIN`. |
| `responses[].values` | Parsed record values. MX values keep their preference number. |
| `responses[].raw` | The answer in zone-file form, with the TTL of each record. |
| `responses[].server`, `servers` | The resolver that answered each type, and every resolver used. |
| `check_date` | When the lookup ran, in UTC. |

### When the Current Answer Is the Question.

#### [Incident Investigation](https://www.deepinfo.com/solutions/use-cases/incident-investigation-and-response/)

Resolve the hostnames in an alert to their current addresses and mail servers without running a resolver fleet.

#### [Phishing Triage](https://www.deepinfo.com/solutions/use-cases/phishing-detection-and-prevention/)

Check whether a newly seen lookalike already has MX records, which means it is set up to receive mail.

#### [Attack Surface Checks](https://www.deepinfo.com/solutions/use-cases/attack-surface-management/)

Confirm that a record you changed, or one a scan flagged, now resolves the way it should.

### Quota, Limits and What It Won’t Take.

- **Live vs history**: This call resolves the name now. The values a name has had, with the times Deepinfo observed them, come from the [DNS History API](https://www.deepinfo.com/data-api/apis/dns-history/).
- **Quota**: One unit per request, however many types it asks for.
- **Addresses**: The call takes names, not IPs. For the domains that point at an IP, use [Reverse IP](https://www.deepinfo.com/data-api/apis/reverse-ip/).
- **Rate limits**: Plan-dependent. The default is one request per second per key and endpoint. See [rate limits](https://docs.deepinfo.com/getting-started/rate-limits/).
- **Errors**: `400` when `domain` is not a valid name or `type` is missing. See [errors](https://docs.deepinfo.com/getting-started/errors/).

### Other Ways Into One Name.

- [DNS History](https://www.deepinfo.com/data-api/apis/dns-history/): The values Deepinfo has observed for a name, with each time it was seen.
- [Domain WHOIS](https://www.deepinfo.com/data-api/apis/whois-lookup/) (Lookup): Registrar, dates and name servers for a domain, raw and parsed.
- [SSL](https://www.deepinfo.com/data-api/apis/ssl-lookup/) (Lookup): The certificate a host serves right now, with a verdict on its chain.

### See This Data at Work in the Deepinfo Platform

External Attack Surface Management runs these lookups continuously over your assets and raises what changes as issues, and Deep Search & Insights opens the whole index to your analysts.

- [External Attack Surface Management](https://www.deepinfo.com/platform/easm/) (EASM)
- [Deep Search & Insights](https://www.deepinfo.com/platform/dsi/) (DSI)
- [How the Platform Works](https://www.deepinfo.com/platform/how-it-works/)

### Questions About DNS Lookup API

**Does a name that does not exist return an error?**

No. You get an entry for each requested type, and its `rcode` holds the DNS response code, such as `NXDOMAIN` for a name that does not exist.

**Can we resolve many names at once?**

Each call takes one name, so a list means one call per name within your rate limit. For names already in the index, [Domain Search](https://www.deepinfo.com/data-api/apis/domain-search/) returns the DNS records Deepinfo last observed for many names in one query: filter `fqdn` with `in`.

**Can we go the other way, from a mail or name server to its domains?**

Yes, with the reverse lookups. [Reverse MX](https://www.deepinfo.com/data-api/apis/reverse-mx/) lists the domains that use a mail server and [Reverse NS](https://www.deepinfo.com/data-api/apis/reverse-ns/) the ones that use a name server, each as a full domain record.

**How is the DNS Lookup API priced?**

As part of an API services plan, priced by volume and frequency, separately from the platform. See [Data & API pricing](https://www.deepinfo.com/pricing/#data-pricing) or [talk to us](https://www.deepinfo.com/contact/?topic=data-api) about the volume you expect.

**Can analysts run DNS lookups without writing code?**

Yes. [Instant Lookups](https://www.deepinfo.com/platform/dsi/instant-lookups/) in Deep Search & Insights resolves names in the Deepinfo Platform, next to WHOIS, SSL and the other live lookups.

### Resolve Your Domains First.

Most teams test the API against their own domains before they wire it into a pipeline. We set up access and answer schema questions on a short call.

[Talk to us about access](https://www.deepinfo.com/contact/?topic=data-api) [All API services](https://www.deepinfo.com/data-api/apis/)
