{
  "@context": "https://agentflare.org/schema",
  "type": "Article",
  "tier": "L2-full",
  "title": "Getting Started with HTTP 402 Pay-Per-Crawl",
  "description": "How AI agents pay for web content using HTTP 402 and crawler tokens AI agents can now pay for web content and APIs directly over HTTP using the revived 402 “Payment…",
  "canonical": "https://agentflare.org/guides/getting-started-with-http-402-pay-per-crawl.html",
  "category": "guides",
  "updated": "2026-06-23",
  "generated_at": "2026-06-23T15:42:04.744Z",
  "facts": [
    {
      "label": "Access",
      "value": "Free / open"
    },
    {
      "label": "Updated",
      "value": "2026-06-23"
    }
  ],
  "data": {
    "topic": "how AI agents pay for web content using HTTP 402 and crawler tokens",
    "access": "free",
    "summary": "How AI agents pay for web content using HTTP 402 and crawler tokens AI agents can now pay for web content and APIs directly over HTTP using the revived 402 “Payment…"
  },
  "analysis_md": "# How AI agents pay for web content using HTTP 402 and crawler tokens\n\nAI agents can now pay for web content and APIs directly over HTTP using the revived 402 “Payment Required” status code and standards like x402 and AISA HTTP 402. This guide walks through the practical flow for both agent builders and publishers.\n\n## 1. Publisher: Signal payment with HTTP 402 and crawler tokens\n\nPublishers expose paid content or APIs by returning `402 Payment Required` when a crawler or agent hits a protected endpoint. In the response, include:\n\n- `402 Payment Required` status  \n- Payment metadata headers (e.g., `X-Payment-Amount`, `X-Payment-Asset: USDC`, `X-Payment-To`, `X-Payment-Network`)  \n- Optional crawler token or agent identifier (e.g., `X-Crawler-Token` or `User-Agent` pattern) to rate‑limit or whitelist specific bots  \n\nFor example, when an AI agent requests `/api/news` without a valid payment, the server responds with 402 and structured payment terms instead of blocking or redirecting to a human checkout.\n\n## 2. Agent: Handle 402 and pay with crypto\n\nWhen an AI agent receives a 402, it parses the payment descriptor and decides whether to pay. The agent:\n\n- Uses a built‑in wallet (often USDC‑backed) to construct an on‑chain payment matching the 402 terms  \n- Sends the payment via a facilitator (e.g., Coinbase, Cloudflare Agents SDK, or AgentCore Payments)  \n- Retries the original request with a payment credential header (e.g., `PAYMENT-SIGNATURE` or `PAYMENT-RESPONSE` in x402, or an AISA‑compliant receipt header)  \n\nThis flow is fully programmatic: no human approval, no sessions, and no traditional API keys for payment.\n\n## 3. Publisher: Verify and serve content\n\nOn the retry request, the publisher or its facilitator:\n\n- Verifies the on‑chain transaction (amount, asset, recipient, and window)  \n- Optionally checks the crawler token or agent identity against allow‑lists or rate‑limits  \n- Returns `200 OK` with the requested content or data  \n\nAISA HTTP 402 and x402 both treat payment as a first‑class HTTP primitive, so the same pattern works for AI agents, crawlers, and human‑driven clients.\n\n## Key takeaways\n\n- Use `402 Payment Required` with structured headers to signal payment terms to AI agents and crawlers, instead of opaque blocks or redirects.  \n- AI agents pay autonomously via crypto (e.g., USDC on Base/Ethereum) using x402 or AISA HTTP 402, then retry with a signed payment receipt.  \n- Publishers verify on‑chain payments and crawler tokens server‑side, enabling pay‑per‑crawl without accounts, sessions, or human checkout.",
  "sources": [
    {
      "url": "https://blog.nodit.io/ai-agents-that-pay-for-themselves-how-the-x402-protocol-works/"
    },
    {
      "url": "https://www.digitalapplied.com/blog/x402-payment-protocol-ai-agents-pay-coinbase-cloudflare"
    },
    {
      "url": "https://developers.cloudflare.com/agents/tools/payments/"
    },
    {
      "url": "https://www.galaxy.com/insights/research/x402-ai-agents-crypto-payments"
    },
    {
      "url": "https://www.youtube.com/watch?v=S6wc6yvoZLY"
    },
    {
      "url": "https://www.permit.io/blog/exploring-the-x402-protocol-for-internet-native-payments"
    },
    {
      "url": "https://aws.amazon.com/blogs/industries/x402-and-agentic-commerce-redefining-autonomous-payments-in-financial-services/"
    }
  ],
  "related": [
    {
      "name": "Crawler Tokens & Auto-Pay: A How-To",
      "url": "https://agentflare.org/guides/crawler-tokens-auto-pay-a-how-to.html"
    },
    {
      "name": "Reading .data.json: A Field Guide for Agents",
      "url": "https://agentflare.org/guides/reading-datajson-a-field-guide-for-agents.html"
    },
    {
      "name": "robots.txt, llms.txt & Sitemaps for AI Crawlers",
      "url": "https://agentflare.org/guides/robotstxt-llmstxt-sitemaps-for-ai-crawlers.html"
    },
    {
      "name": "Pricing Content by Directory: Best Practices",
      "url": "https://agentflare.org/guides/pricing-content-by-directory-best-practices.html"
    }
  ],
  "pricing": {
    "price_usd": 0,
    "method": "402",
    "endpoint": "https://esa.aisa.one/api/v1/access/verify",
    "autopay_hint": "set crawlerAutoPrice=true with X-AISA-Crawler-Token",
    "onboarding": "https://esa.aisa.one/cdn/guide.html"
  },
  "powered_by": "AISA — agent-native search, settlement & delivery (https://aisa.one)"
}