Skip to content
IP & Network

DNS Lookup

Every DNS record a domain publishes, its mail provider and DNS host, or reverse DNS for an IP.

POST/v1/dns-lookup
2 creditsBulk supportedGlobal
Request
curl -X POST https://api.1lookup.dev/v1/dns-lookup \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain":"example.com"}'
Response
{
  "success": true,
  "data": {
    "query": "example.com",
    "query_type": "domain",
    "records": {
      "a": [
        {
          "address": "203.0.113.10",
          "ttl": 300
        }
      ],
      "aaaa": [
        {
          "address": "2001:db8::10",
          "ttl": 300
        }
      ],
      "cname": [],
      "mx": [
        {
          "priority": 10,
          "exchange": "mx1.mailhost.example",
          "ttl": 3600
        },
        {
          "priority": 20,
          "exchange": "mx2.mailhost.example",
          "ttl": 3600
        }
      ],
      "txt": [
        "v=spf1 include:_spf.mailhost.example ~all",
        "example-site-verification=4f9c2a71d0b84e53"
      ],
      "ns": [
        "ns1.dnshost.example",
        "ns2.dnshost.example"
      ],
      "soa": {
        "primary_ns": "ns1.dnshost.example",
        "admin_email": "hostmaster@example.com",
        "serial": 2026111201,
        "refresh": 7200,
        "retry": 3600,
        "expire": 1209600,
        "minimum_ttl": 300
      },
      "caa": [
        {
          "flags": 0,
          "tag": "issue",
          "value": "ca.example"
        }
      ],
      "ptr": []
    },
    "mail_provider": "Example Mail Hosting",
    "dns_host": "Example DNS Host"
  },
  "meta": {
    "credits_used": 2,
    "credits_remaining": 999,
    "cached": false,
    "request_id": "req_8f3a2c1e9b7d"
  }
}

Authorization

Authorizationstring<bearer>required

Your API key as a Bearer token. Live keys start with 1lk_live_. Test keys start with 1lk_test_ and return this endpoint's sample response without spending credits. See authentication.

Body

Send the fields as a JSON object with Content-Type: application/json.

domainstring<domain>required

Domain. A domain, or an IP address for reverse DNS. Example: example.com

freshboolean

Skip the 7-day cache and run a new lookup. Charged as a normal lookup.

referencestring

Your own identifier, echoed back in meta and shown in lookup history.

Response

A 200 response carries the result in data and the cost of the call in meta. These are the fields most integrations read.

successboolean

true when the lookup ran.

data.records.aarray

IPv4 addresses the name resolves to, each with a TTL. IPv6 addresses sit beside them in records.aaaa.

data.records.mxarray

Mail servers for the domain, in priority order.

data.records.txtarray

Every TXT string, including SPF policies and site verification tokens.

data.records.nsarray

The authoritative nameservers the domain is delegated to.

data.records.caaarray

Which certificate authorities the domain allows to issue certificates for it.

data.mail_providerstring

The email service inferred from the MX hosts, or null when none is recognized.

data.dns_hoststring

The DNS service inferred from the nameservers.

data.records.ptrarray

Hostnames an IP address points back to. Filled when you send an IP instead of a domain.

meta.credits_usednumber

Credits charged for this call.

meta.credits_remainingnumber

Your balance after the call.

meta.cachedboolean

true when the result came from the 7-day cache.

meta.request_idstring

Quote this when you contact support.

Errors

A failed request returns success: false with an error object, and is never charged. The full list is on the errors page.

HTTPCodeMeaning
401unauthorizedThe key is missing, malformed or revoked.
402insufficient_creditsYour credits are used up and pay as you go is off or at its limit.
422invalid_inputA field is missing or malformed. The field property names it.
429rate_limitedToo many requests for this key. Wait for the Retry-After interval.
500internal_errorSomething failed on our side. Safe to retry.
503source_unavailableAn upstream source did not answer in time. Safe to retry.

Billing

2 credits. Charged when the lookup runs and returns a result. Errors are never charged, and repeating the same input within 7 days is served from cache at no charge.

Product overview and use cases