Charge AI bots for content access using the x402 protocol. Pay-per-request, settled on-chain.
AI bots consume your content at scale, summarize it elsewhere, and return nothing. No page views, no ad revenue, no conversions. You bear the infrastructure cost while someone else extracts the value.
Until now, the options were binary: block them (lose reach) or allow them (subsidize their product). AWS WAF introduces a third option: charge them.
The agent receives an HTTP 402 Payment Required with a machine-readable payment-required header containing the price, accepted payment network, and wallet address. The agent signs a USDC payment authorization and retries with a Payment-Signature header. WAF verifies, settles on-chain, and serves the content.
This demo runs in test mode on Base Sepolia testnet. No real money needed. Free test USDC available from a faucet.
npm install @coinbase/x402
import { paymentClient } from "@coinbase/x402";
import { createWalletClient, http } from "viem";
import { baseSepolia } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");
const wallet = createWalletClient({
account,
chain: baseSepolia,
transport: http()
});
const response = await paymentClient.fetch(
"https://monetize.tzoori.click/api/article",
{ wallet }
);
console.log(await response.json());
// => { title: "...", body: "...", author: "..." }curl -i https://monetize.tzoori.click/api/article
The payment-required header (base64-decoded) contains:
{
"accepts": [{
"amount": "1000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"extra": { "name": "USD Coin", "version": "2" },
"maxTimeoutSeconds": 300,
"network": "eip155:84532",
"payTo": "0x9549392E8EFEE6ff66E364980177FFfe47052Fc7",
"scheme": "exact"
}],
"error": "PAYMENT-SIGNATURE header is required",
"resource": { "url": "https://monetize.tzoori.click/api/article" },
"x402Version": 2
}
Translation: Pay 0.001 USDC on Base Sepolia to the publisher's wallet. Attach the signed authorization as a Payment-Signature header and retry within 300 seconds.
Once payment is verified and settled on-chain, the agent receives the actual content:
HTTP/2 200
{
"title": "Understanding Neural Architecture Search",
"author": "Dr. Sarah Chen",
"body": "Neural architecture search (NAS) automates the design of...",
"category": "machine-learning",
"generated_at": "2026-06-16T10:30:00Z",
"word_count": 342
}
Every /api/* path generates different randomized content. Try /api/weather, /api/economics, /api/anything.