Captcha verify
$0.002 per callUSDC via x402
POST /api/captcha-verifyValidate a Cloudflare Turnstile, Google reCAPTCHA, or hCaptcha token server-side.
Details
You pass your OWN provider secret plus the token from the client; we relay to the provider's siteverify endpoint (never logged) and return the normalized verdict (success, hostname, action, score, error codes). The legitimate backend half of bot protection - no solving, no bypass.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
provider | string | yes | turnstile | recaptcha | hcaptcha The example sends turnstile. |
secret | string | yes | your provider secret key (relayed to the provider, never stored/logged) Also accepted as key, password, passphrase. The example sends 1x0000000000000000000000000000000AA. |
token | string | yes | the captcha response token from the client Also accepted as jwt, accessToken. The example sends XXXX.DUMMY.TOKEN.XXXX. |
remoteip | string | no | optional client IP to pass through |
Example request
curl -i -X POST https://agent402.tools/api/captcha-verify \
-H "Content-Type: application/json" \
-d '{"provider":"turnstile","secret":"1x0000000000000000000000000000000AA","token":"XXXX.DUMMY.TOKEN.XXXX"}'Watch a call get paid
Request
POST /api/captcha-verify402
$0.002 USDCSign
PAYMENT-SIGNATURESettle
on 14 chainsAnswer
200 OKReceipt
Agent402-ReceiptEd25519Example response
{
"provider": "turnstile",
"success": true,
"hostname": "example.com",
"errorCodes": []
}| Field | Type | Always present | In the example |
|---|---|---|---|
provider | string | yes | turnstile |
success | boolean | yes | true |
hostname | string | yes | example.com |
errorCodes | array | yes | 0 items in the example |
From an MCP client
catalog.call {
"slug": "captcha-verify",
"params": {
"provider": "turnstile",
"secret": "1x0000000000000000000000000000000AA",
"token": "XXXX.DUMMY.TOKEN.XXXX"
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.19.2): pays from a wallet or AGENT402_CREDITS_KEY.
Errors and behavior
- Pay $0.002 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:
provider,secretandtoken; 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.002" }); // 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/captcha-verify", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"provider": "turnstile",
"secret": "1x0000000000000000000000000000000AA",
"token": "XXXX.DUMMY.TOKEN.XXXX"
}),
});Get a wallet or run npx -y agent402-mcp@0.19.2 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/captcha-verify", method="POST", data="{\"provider\":\"turnstile\",\"secret\":\"1x0000000000000000000000000000000AA\",\"token\":\"XXXX.DUMMY.TOKEN.XXXX\"}".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