DNS Lookup API

DNS records for a domain (A, AAAA, MX, TXT, NS, CNAME, SOA, CAA) with their TTLs.

Updated

Agents read this page asGET /v1/dns-lookup/schemafree: schema, examples, errors, price

Endpoint
POST /v1/dns-lookup
Price
free
Timeout
5 s
max_timeout_seconds
6 (the whole call as the 402 envelope sells it: the timeout, plus payment verification and settlement around it)
Response cap
2 MB (2,097,152 bytes)

When to use it

A DNS query needs the network, so an agent cannot answer it on its own. It is what you run in a loop over a list of domains.

When not to use it

  • The destination needs more than 5 s to answer: the call ends with upstream_timeout (424).

Parameters

One JSON body. The schema is free at GET /v1/dns-lookup/schema.

FieldTypeRequiredDescription
domainstringyesFully qualified domain name to resolve, up to 253 characters; it is trimmed, lowercased and stripped of trailing dots, and IP literals, single-label names and private suffixes such as .local or .internal are refused.
typesarraynoRecord types to query, from a, aaaa, mx, txt, ns, cname, soa and caa in either case; duplicates collapse to one query per type, answers come back in that fixed order, and the default is all eight.

Limits

LimitValue
Size cap2 MB (2,097,152 bytes)
Timeout5 s
Show the JSON Schema the handler validates against
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "domain": {
      "description": "Fully qualified domain name to resolve, up to 253 characters; it is trimmed, lowercased and stripped of trailing dots, and IP literals, single-label names and private suffixes such as .local or .internal are refused.",
      "type": "string",
      "minLength": 1,
      "maxLength": 253
    },
    "types": {
      "description": "Record types to query, from a, aaaa, mx, txt, ns, cname, soa and caa in either case; duplicates collapse to one query per type, answers come back in that fixed order, and the default is all eight.",
      "minItems": 1,
      "maxItems": 16,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "a",
          "aaaa",
          "mx",
          "txt",
          "ns",
          "cname",
          "soa",
          "caa",
          "A",
          "AAAA",
          "MX",
          "TXT",
          "NS",
          "CNAME",
          "SOA",
          "CAA"
        ]
      }
    }
  },
  "required": [
    "domain"
  ],
  "additionalProperties": false
}

Example

The published example, verbatim: the request and the response it returns.

Request
POST /v1/dns-lookup
content-type: application/json

{
  "domain": "example.com",
  "types": [
    "a",
    "mx"
  ]
}
Response200 OK
200 OK

{
  "domain": "example.com",
  "types_requested": [
    "a",
    "mx"
  ],
  "records": [
    {
      "type": "a",
      "values": [
        {
          "address": "93.184.215.14",
          "ttl": 3600
        }
      ],
      "truncated": false,
      "resolution_error": null
    },
    {
      "type": "mx",
      "values": [
        {
          "exchange": "mail.example.com",
          "priority": 10
        }
      ],
      "truncated": false,
      "resolution_error": null
    }
  ],
  "queried_at": "2026-08-26T18:00:00.000Z"
}

This example is illustrative: it shows the exact shape the handler returns, but it was not produced by a reproducible call, because the real answer depends on live network data that changes over time.

Response fields

FieldTypeIn the example
domainstring"example.com"
types_requestedarray2 items
recordsarray2 items, each with type, values, truncated and resolution_error
queried_atstring"2026-08-26T18:00:00.000Z"

Deterministic: the same input returns the same output. Clock-derived fields, when present, are declared in the response.

Call it from code

A free endpoint: a plain POST, no payment.

// dns-lookup: free, no payment needed
// Save as client.mjs (ES module, Node 18+) and run: node client.mjs

const body = {
  "domain": "example.com",
  "types": [
    "a",
    "mx"
  ]
}

const res = await fetch('https://grist.tools/v1/dns-lookup', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify(body),
})
console.log(res.status, await res.json())

Errors

Every error is typed JSON. Only a successful call is settled.

CodeHTTPWhen
invalid_input400The body does not match the schema on this page. Nothing is charged. The body does not match the schema; its fields are domain and types.
unreachable_target424The destination you named did not resolve or refused the connection.
upstream_timeout424The destination you named did not answer before the declared timeout for this endpoint expired.
internal500Our fault, and in almost every case nothing is charged. The exceptions come after the call has run and the settlement call was made: the message "The work was done but settlement could not be completed", and the messages starting with "Payment settlement returned". There, whether the payment moved is unknown to us as well. The payment moves at most once: its nonce is single-use and settlement is idempotent, so a retry with it is never charged twice. A retry is normally refused with a 402: replay_consumed, an expiry reason, or a reason saying the nonce was already used once the transfer is on-chain. Only if our server restarted before the transfer was final can a retry run the call again. Even then, the payment moves at most once. To see whether it was settled, read the EIP-3009 authorizationState of its nonce on-chain; to call again, sign a new payment.
rate_limited429Too many calls from the same payer, or too many calls towards the same destination domain. Nothing is charged.
concurrency_limit,
registry_at_capacity,
upstream_unavailable
503We could not serve the call right now. Retryable: wait the number of seconds in the retry-after header, then repeat the call. concurrency_limit and registry_at_capacity mean we were at capacity: the call did not run. You can send the same payment again if its validBefore is still far enough away to cover another call. If it is not, the retry gets a 402 authorization_validity_too_short: sign a new payment. upstream_unavailable means our internal service failed or did not answer in time: the call may already have run and the payment may have been settled. A retry with the same payment can get a 402 whose error field says why. authorization_validity_too_short: too little time is left before validBefore to cover another call. This check comes before the replay check, so it does not tell whether the first payment was settled. replay_consumed (the payment was used and may have been settled) or replay_exhausted (too many attempts): sign a new payment. replay_in_flight: the first call is still running, so wait and do not pay again. invalid_exact_evm_nonce_already_used: the transfer is already on-chain, so this payment cannot move again. Sign a new payment. An authorization can be settled only once, since its nonce is single-use. To see whether it was settled, read the EIP-3009 authorizationState of its nonce on-chain.
misconfigured503The service is not configured to serve calls. The call did not run and nothing is charged. It needs a fix on our side, so there is no retry delay to wait for.

Questions

How much does a call to the DNS Lookup API cost?

Nothing. dns-lookup is free to call: no payment header is needed.

What is the timeout of dns-lookup?

The endpoint itself runs for at most 5 s. The whole call is bounded by max_timeout_seconds 6.

How large can a response from dns-lookup be?

The response-size cap is 2 MB (2,097,152 bytes).

Is the dns-lookup input schema free to read?

Yes. GET https://grist.tools/v1/dns-lookup/schema returns the input schema for free, paid endpoints included.

What happens if a call to dns-lookup fails?

The endpoint is free, so a failed call costs nothing.

What does dns-lookup return?

A JSON object with 4 top-level fields: domain, types_requested, records and queried_at. The example on this page is illustrative, not a recorded call.