IP info
POST /api/ip-infoClassify an IP address: version, public/private/loopback/link-local, integer form, and reverse-DNS (PTR) lookup. Send POST /api/ip-info with the required field ip and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with ip, version, scope and ptr.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ip | string | yes | IPv4 or IPv6 address |
Example request
curl -i -X POST https://agent402.tools/api/ip-info \
-H "Content-Type: application/json" \
-d '{"ip":"8.8.8.8"}'
Without payment this returns HTTP 402 Payment Required with the exact price for ip-info; any x402 v2 or MPP client pays it and retries.
Example response
{
"ip": "8.8.8.8",
"version": 4,
"scope": "public",
"ptr": [
"dns.google"
]
}
| Field | Type | Always present | In the example |
|---|---|---|---|
ip | string | yes | 8.8.8.8 |
version | number | yes | 4 |
scope | string | yes | public |
ptr | array of string | yes | 1 item in the example |
From an MCP client
catalog.call {
"slug": "ip-info",
"params": {
"ip": "8.8.8.8"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for ip-info; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
ipis 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. - A
GETorHEADto /api/ip-info returns the same 402 quote, so the price can be read without a body. - 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/ip-info", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"ip": "8.8.8.8"
}),
});
Related tools
CIDR calculator
POST /api/cidrParse an IPv4 CIDR block: network address, broadcast, first/last host, netmask, and host count. Optionally test if an IP…
Card number validate
POST /api/card-validateValidate a payment card number (Luhn checksum) and detect the brand. Numbers are not stored or logged.
Color convert
POST /api/colorConvert a color between hex, RGB, and HSL. Accepts "#1a2b3c", "rgb(26,43,60)", or "hsl(210,40%,17%)".
CSV lint
POST /api/csv-lintValidate CSV structure: consistent column counts across rows, properly closed quotes, delimiter detection. Returns row/c…
Email validate
POST /api/email-validateValidate an email address: syntax check plus live MX record lookup on the domain (deliverability signal, not a guarantee…
IBAN validate
POST /api/iban-validateValidate an IBAN: country code, length, and the ISO 13616 mod-97 checksum.