A2A Agent Card fetch
$0.005 per callUSDC via x402
POST /api/a2a-card-fetchDiscover and fetch a site's A2A (Agent2Agent protocol) Agent Card - tries /.well-known/agent-card.json then /.well-known/agent.json (or fetches a direct .json URL as-is) - and validate it against the spec v0.3 structural core.
Details
Returns the card, errors, interop warnings, and a normalized summary. Mini-A2A discovery for agents. Marked untrustedContent: the fetched card is external, untrusted data.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | yes | site root, domain, or a direct agent-card .json URL Also accepted as link, uri, href, page. |
Example request
curl -i -X POST https://agent402.tools/api/a2a-card-fetch \
-H "Content-Type: application/json" \
-d '{"url":"https://agent402.tools/samples/a2a-agent-card.json"}'Watch a call get paid
Request
POST /api/a2a-card-fetch402
$0.005 USDCSign
PAYMENT-SIGNATURESettle
on 14 chainsAnswer
200 OKReceipt
Agent402-ReceiptEd25519Example response
{
"source": "https://agent402.tools/samples/a2a-agent-card.json",
"valid": true,
"errors": [],
"summary": {
"name": "Sample Weather Agent",
"skillCount": 1
}
}| Field | Type | Always present | In the example |
|---|---|---|---|
source | string | yes | https://agent402.tools/samples/a2a-agent-card.json |
valid | boolean | yes | true |
errors | array | yes | 0 items in the example |
summary | object | yes | 2 fields: name, skillCount |
From an MCP client
catalog.call {
"slug": "a2a-card-fetch",
"params": {
"url": "https://agent402.tools/samples/a2a-agent-card.json"
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.18.0): pays from a wallet or AGENT402_CREDITS_KEY.
Errors and behavior
- Pay $0.005 per call over x402 or MPP. Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Required:
url; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. A Tempo push credential pays before the call; a failure is a refund owed.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (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?.({ maxAmountPerPayment: "$0.005" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/a2a-card-fetch", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"url": "https://agent402.tools/samples/a2a-agent-card.json"
}),
});Get a wallet or run npx -y agent402-mcp@0.18.0 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/a2a-card-fetch", method="POST", data="{\"url\":\"https://agent402.tools/samples/a2a-agent-card.json\"}".encode(), headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base units