DNS lookup
GET /api/dns · Cached 5mLive DNS lookup for a domain: returns name, type and records[]. Send GET /api/dns with the required field name and pay $0.001 per call over x402 or MPP (there is no free tier). It returns a JSON object with name, type and records.
Supported record types: A, AAAA (addresses as strings), MX ({exchange, priority} objects), TXT (each record an array of its strings), NS and CNAME (hostnames). For SPF, DMARC or a full mail-security read use spf-check, dmarc-check or email-deliverability.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | yes | Domain name, e.g. example.com |
type | string | no | Record type (default A) |
Example request
curl -i "https://agent402.tools/api/dns?name=example.com&type=A"
Without payment this returns HTTP 402 Payment Required with the exact price for dns; any x402 v2 or MPP client pays it and retries.
Example response
{
"name": "example.com",
"type": "A",
"records": [
"93.184.215.14"
]
}
| Field | Type | Always present | In the example |
|---|---|---|---|
name | string | yes | example.com |
type | string | yes | A |
records | array of string | yes | 1 item in the example |
From an MCP client
catalog.call {
"slug": "dns",
"params": {
"name": "example.com",
"type": "A"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for dns; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
nameis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement is cancelled when the tool fails. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - Cached: an identical request within 5m is answered from cache with
X-Cache: hit. - A
POSTwith a JSON body to /api/dns is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/dns?name=example.com&type=A");
Related tools
DKIM key lookup
POST /api/dkim-lookupFetch and parse a DKIM public-key record at <selector>._domainkey.<domain> (RFC 6376). Returns the parsed key params (al…
DMARC check
POST /api/dmarc-checkFetch and validate a domain's DMARC policy at _dmarc.<domain> (RFC 7489). Surfaces the enforcement policy (none/quaranti…
DNS lookup
POST /api/dns-lookupResolve any DNS record type for a host: A, AAAA, MX, TXT, CNAME, NS, SOA, CAA, SRV, PTR. Returns the records plus a coun…
DNS propagation check
POST /api/dns-propagationResolve the same DNS record against 4 public resolvers (Google, Cloudflare, Quad9, OpenDNS) in parallel; surface diverge…
SPF check
POST /api/spf-checkFetch and validate a domain's SPF record (RFC 7208). Parses mechanisms (ip4/ip6/include/a/mx/all), counts DNS lookups ag…
A2A Agent Card fetch
POST /api/a2a-card-fetchDiscover and fetch a site's A2A (Agent2Agent protocol) Agent Card - tries /.well-known/agent-card.json then /.well-known…