apyhub
DEVELOPER TOOLS

DNS Batch Lookup API

Hosted on ApyHub

What it does

DNS Batch Lookup lets you send up to 25 host lookups in one request and get a per-row DNS answer back. Use it when you need to resolve domains or IPs for PTR lookups without making one network call at a time.

Each query in the queries array accepts a host and an optional type. Supported record types are A, AAAA, MX, NS, TXT, CNAME, and PTR; omit type to query A. The response returns data.results, where every result includes status, host, and type. Depending on the record type, you may also get addresses, names, txt, mx, or ptr. For failed rows, status is ERROR and an error field explains the failure.

The status field helps you distinguish between a valid answer (OK), a non-existent name (NXDOMAIN), an existing name with no records of the requested type (NODATA), and row-level batch failures (ERROR). That makes it straightforward to normalize DNS checks in onboarding flows, security tooling, inventory audits, or infrastructure monitoring.

If you need to validate multiple domains, inspect mail exchanger records, or reverse-resolve IP addresses in bulk, DNS Batch Lookup keeps the response structured and easy to process.

POST
Batch DNS lookups (max 25)
http://localhost:8080/apyhub/mono-go-dns-batch-lookup
QUICKSTARTGUIDE

Quickstart

Look up DNS records for one or more hosts in a single batch request.

curl -X POST "http://localhost:8080/apyhub/mono-go-dns-batch-lookup" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "queries": [
      {
        "host": "google.com"
      }
    ]
  }'

What you'll get back

Returns a JSON object with a data object. Inside data, results is an array of DNS lookup results; each item includes status, host, and type, and may also include record-specific fields like addresses, mx, names, ptr, txt, or error depending on the query.

{
  "data": {
    "results": [
      {
        "status": "OK",
        "host": "apyhub.com",
        "type": "A",
        "addresses": [
          "188.114.96.3",
          "188.114.97.3"
        ]
      },
      {
        "status": "OK",
        "host": "google.com",
        "type": "A",
        "addresses": [
          "172.217.22.14"
        ]
      }
    ]
  }
}
TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
queries*

About this endpoint

What it does

Performs up to 25 DNS lookups in a single request. You send a list of queries, and the response returns a per-query result with the resolved records and a status for each row.

Request Body

ParameterTypeMandatoryDescription
queriesObject ArrayYesList of DNS lookup requests. Max 25 items.
queries[].hostStringYesDomain, FQDN, or IP address for PTR lookups.
queries[].typeENUMNoRecord type to query. Allowed values: A, AAAA, MX, NS, TXT, CNAME, PTR. Default: A. Omit for A.

Response

Returns a JSON object with a data object field. data contains a results array; each item is a DNS answer object for one requested query, including the queried host, the queried type, a status, and record-specific fields when applicable.

ParameterTypeMandatoryDescription
dataObjectNoWrapper object containing the lookup results.
data.resultsObject ArrayNoArray of per-query DNS answer objects. Each item includes status, host, and type, plus only the record fields relevant to the queried type.
data.results[].statusENUMNoResult status for the row. Allowed values: OK, NXDOMAIN, NODATA, ERROR. OK means at least one record returned; NXDOMAIN means the DNS name does not exist; NODATA means the name exists but has no records of the requested type; ERROR is used for batch-row failures.
data.results[].hostStringNoQueried host, or IP address for PTR.
data.results[].typeENUMNoQueried record type. Allowed values: A, AAAA, MX, NS, TXT, CNAME, PTR.
data.results[].addressesString ArrayNoIPv4 (A) or IPv6 (AAAA) addresses.
data.results[].namesString ArrayNoHostnames for NS or CNAME answers.
data.results[].mxObject ArrayNoMX records returned for the query. Each item is one MX resource record.
data.results[].mx[].preferenceIntegerNoMX preference. Lower values have higher priority.
data.results[].mx[].exchangeStringNoMail exchanger hostname, often returned with a trailing dot.
data.results[].ptrString ArrayNoPTR target names for reverse DNS lookups.
data.results[].txtString ArrayNoTXT RDATA strings. One element is returned per TXT record, per Go net.Resolver.
data.results[].errorStringNoPresent when status is ERROR, typically for resolver or validation failures for that row.

Notes

The batch is limited to 25 queries per request. The response is row-oriented: only the fields relevant to each query's type are populated, and the other record fields are omitted.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.