# 2s DNS Lookup API

> 2s DNS Lookup API is a paid API for AI agents from 2s.io, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-13).

Performs DNS record lookups for a given hostname, returning structured results including A, AAAA, MX, TXT, NS, CAA, SRV, CNAME, PTR, and SOA records via a pay-per-call REST API.

## Facts

- Endpoint: GET https://2s.io/api/dns/lookup
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/2s-dns-lookup-api-abb1f933
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8wqgOPP9RWiTaM2IuHmzf

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability 2s-dns-lookup-api-abb1f933
```

Example prompt: What are the MX and TXT records for github.com? Use Cloudflare as the resolver.

## When to prefer this

Use this endpoint when an AI agent needs programmatic, structured DNS resolution without maintaining API keys or subscriptions — ideal for one-off or infrequent DNS lookups billed per call in USDC. Prefer this over self-hosted DNS libraries when you need flexibility to switch resolvers (Cloudflare, Google, Quad9, OpenDNS) and want normalized JSON output.

## Known failure modes

- Invalid or non-existent hostname returns empty items array or error
- Unsupported record type pattern returns validation error
- Requested resolver is unavailable causing timeout or error
- Payment not completed results in 402 response before data is returned
- Rate limits or resolver outages may cause transient failures

## How this service works

Resolve a hostname over public DNS and return parsed records. Query: host (required FQDN), types (comma-separated: A,AAAA,MX,TXT,NS,CAA,SRV,CNAME,PTR,SOA — default A,AAAA,MX,TXT,NS), resolver (cloudflare|google|quad9|opendns, optional). Returns one normalized JSON shape per record type with per-type error pass-through. Reserved/local TLDs (.local, .internal, .invalid, .test, localhost) are rejected. 4s per-query timeout.

## Output

Returns a JSON object with an array of DNS record items matching the query, a total count, and source metadata including the resolver provider, URL, and license. Each item contains record-type-specific fields such as IP addresses, priority, and values.

## Example request

```json
{
 "input": {
  "type": "http",
  "method": "GET",
  "queryParams": {
   "host": "example.com",
   "types": "A,MX",
   "resolver": "cloudflare"
  }
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "queryParams"
   ],
   "properties": {
    "type": {
     "const": "http"
    },
    "method": {
     "const": "GET"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "host"
     ],
     "properties": {
      "host": {
       "type": "string",
       "maxLength": 253,
       "minLength": 1
      },
      "types": {
       "type": "string"
      },
      "resolver": {
       "enum": [
        "cloudflare",
        "google",
        "quad9",
        "opendns"
       ],
       "type": "string"
      }
     },
     "additionalProperties": false
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/2s-dns-lookup-api-abb1f933/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 2s.io](https://www.zero.xyz/host/2s.io/llms.txt)
