# Batch lookups and runs (/docs/batches)

A batch call sends a list in one POST and starts a run. Read the run while its `status` is `queued` or `running`: it ends `completed` or `failed`.

## Making a batch request

Batch endpoints typically can take up to 1,000 items, but check individual endpoints for limits. Each item is answered as its single call would answer it, and only the answered ones (HTTP `200`, a negative answer included) cost a credit. The call reserves a credit for every item and is charged for the ones answered when the run completes. Send the shared parameters, such as `redacted`, beside the list.

A batch call never waits for its lookups: it creates a run and answers `202` with it at once. Items already in the result cache are answered in that response, and the rest show as `pending`.

```bash title="Domain Batch Request"
curl -X POST "https://api.dns.tools/v1/domain/batch" \
  -H "X-API-Key: YOUR-API-KEY" \
  -H "Content-Type: application/json" \
  -d '{"domains": ["example.com", "google.com", "unregistered-name-4821.com"]}'
```

## Read the run

Read the run at `/v1/runs/{id}`, with the `id` the batch call answered with, while its `status` is `queued` or `running`. Each read shows the items finished so far, in the order you sent them. `GET /v1/runs` lists your runs. Reading a run is free.

```bash title="Read the Run"
curl "https://api.dns.tools/v1/runs/{id}" \
  -H "X-API-Key: YOUR-API-KEY"
```

Once every item is answered, the run is `completed`, with each item's result in `results`:

```json title="Completed Run Example"
{
  "id": "run_domain_01m8sgqc548k6pb044g8rvk45z",
  "tool": "domain",
  "endpoint": "batch",
  "status": "completed",
  "createdAt": "2026-12-01T19:18:54.107Z",
  "completedAt": "2026-12-01T19:18:55.036Z",
  "items": 3,
  "answered": 3,
  "credits": 3,
  "results": [
    {
      "query": "example.com",
      "pending": false,
      "cached": true,
      "errors": [],
      "result": {
        "tech": null,
        "admin": null,
        "dnssec": true,
        "billing": null,
        "reseller": null,
        "reserved": false,
        "available": false,
        "eppStatus": [
          "clientDeleteProhibited",
          "clientTransferProhibited",
          "clientUpdateProhibited"
        ],
        "registrar": {
          "fax": null,
          "url": null,
          "city": null,
          "name": "RESERVED-Internet Assigned Numbers Authority",
          "email": null,
          "phone": null,
          "state": null,
          "faxExt": null,
          "ianaId": 376,
          "address": null,
          "phoneExt": null,
          "abuseEmail": null,
          "abusePhone": null,
          "postalCode": null,
          "countryCode": null
        },
        "domainName": "example.com",
        "registrant": null,
        "nameservers": [
          "elliott.ns.cloudflare.com",
          "hera.ns.cloudflare.com"
        ],
        "updatedDate": "2026-08-14T08:01:43Z",
        "creationDate": "1995-08-14T04:00:00Z",
        "expirationDate": "2027-08-13T04:00:00Z",
        "unmappedStatus": [],
        "domainNameUnicode": null,
        "registryExpirationDate": "2027-08-13T04:00:00Z"
      },
      "status": 200
    },
    {
      "query": "google.com",
      "pending": false,
      "cached": true,
      "errors": [],
      "result": {
        "tech": {
          "id": null,
          "fax": null,
          "org": null,
          "url": "https://domains.markmonitor.com/whois/contact/google.com",
          "city": null,
          "name": null,
          "email": null,
          "phone": null,
          "state": null,
          "faxExt": null,
          "address": null,
          "phoneExt": null,
          "postalCode": null,
          "countryCode": null
        },
        "admin": null,
        "dnssec": false,
        "billing": null,
        "reseller": null,
        "reserved": false,
        "available": false,
        "eppStatus": [
          "clientDeleteProhibited",
          "clientTransferProhibited",
          "clientUpdateProhibited",
          "serverDeleteProhibited",
          "serverTransferProhibited",
          "serverUpdateProhibited"
        ],
        "registrar": {
          "fax": null,
          "url": "https://www.markmonitor.com/contact-us/",
          "city": "Meridian",
          "name": "Markmonitor Inc.",
          "email": null,
          "phone": null,
          "state": "ID",
          "faxExt": null,
          "ianaId": 292,
          "address": [
            "3540 E Longwing Ln"
          ],
          "phoneExt": null,
          "abuseEmail": null,
          "abusePhone": "+1.2086851750",
          "postalCode": "83646",
          "countryCode": "US"
        },
        "domainName": "google.com",
        "registrant": {
          "id": null,
          "fax": null,
          "org": null,
          "url": "https://domains.markmonitor.com/whois/contact/google.com",
          "city": null,
          "name": null,
          "email": null,
          "phone": null,
          "state": "CA",
          "faxExt": null,
          "address": null,
          "phoneExt": null,
          "postalCode": null,
          "countryCode": "US"
        },
        "nameservers": [
          "ns1.google.com",
          "ns2.google.com",
          "ns3.google.com",
          "ns4.google.com"
        ],
        "updatedDate": "2024-08-02T02:17:33Z",
        "creationDate": "1997-09-15T04:00:00Z",
        "expirationDate": "2028-09-14T07:00:00Z",
        "unmappedStatus": [],
        "domainNameUnicode": null,
        "registryExpirationDate": "2028-09-14T04:00:00Z"
      },
      "status": 200
    },
    {
      "query": "unregistered-name-4821.com",
      "pending": false,
      "cached": true,
      "errors": [],
      "result": {
        "tech": null,
        "admin": null,
        "dnssec": null,
        "billing": null,
        "reseller": null,
        "reserved": false,
        "available": true,
        "eppStatus": [],
        "registrar": null,
        "domainName": "unregistered-name-4821.com",
        "registrant": null,
        "nameservers": [],
        "updatedDate": null,
        "creationDate": null,
        "expirationDate": null,
        "unmappedStatus": [],
        "domainNameUnicode": null,
        "registryExpirationDate": null
      },
      "status": 200
    }
  ],
  "errors": []
}
```

A run that `completed` can still hold items that failed, each with its own `errors`. A run that `failed` could not finish: it bills nothing, has no `results`, and its `errors` say why.

```json title="Failed Run Example"
{
  "id": "run_domain_01m8sgqc548k6pb044g8rvk45z",
  "tool": "domain",
  "endpoint": "batch",
  "status": "failed",
  "createdAt": "2026-12-01T19:18:54.107Z",
  "completedAt": "2026-12-01T19:23:54.107Z",
  "items": 3,
  "answered": 0,
  "credits": 0,
  "results": null,
  "errors": [
    {
      "code": "internal_error",
      "message": "The run could not finish. Nothing was billed."
    }
  ]
}
```