Skip to content

Captcha verify

$0.002 per callUSDC via x402POST /api/captcha-verify

Validate a Cloudflare Turnstile, Google reCAPTCHA, or hCaptcha token server-side.

Category: API primitivesTags: captcha turnstile recaptcha hcaptcha verify bot-protection siteverify signup

Try in playground →

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

NameTypeRequiredDescription
providerstringyesturnstile | recaptcha | hcaptcha The example sends turnstile.
secretstringyesyour provider secret key (relayed to the provider, never stored/logged) Also accepted as key, password, passphrase. The example sends 1x0000000000000000000000000000000AA.
tokenstringyesthe captcha response token from the client Also accepted as jwt, accessToken. The example sends XXXX.DUMMY.TOKEN.XXXX.
remoteipstringnooptional 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

RequestPOST /api/captcha-verify
402$0.002 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "provider": "turnstile",
  "success": true,
  "hostname": "example.com",
  "errorCodes": []
}
FieldTypeAlways presentIn the example
providerstringyesturnstile
successbooleanyestrue
hostnamestringyesexample.com
errorCodesarrayyes0 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

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

Related tools