Rightshold™ Sign up

Answers · AI crawlers

How do I charge AI crawlers per request with HTTP 402 without blocking Google and other search crawlers?

Last updated

TL;DR: Decide per crawler, verify before you decide, and keep search crawlers on plain 200s. Google says every 4xx except 429 tells its crawlers the content doesn't exist: new URLs aren't indexed and indexed ones are removed, so a 402 sent to Googlebot works as a deindex, not an invoice. Verify each claimed bot first (its operator's published IP list, a reverse-then-forward DNS check, or a Web Bot Auth signature), then give it Allow, Charge or Block. Allow Googlebot, Bingbot and the AI search crawlers you want to be cited by; charge the training and bulk AI crawlers that can pay; keep people on the normal page; and leave robots.txt, sitemap.xml and your discovery pages free. Make the 402 a price a program can read: Cloudflare's Pay Per Crawl (closed beta) sends a crawler-price header, and x402 sends a base64 PAYMENT-REQUIRED header. One limit to plan around: Google-Extended has no user agent of its own, so you can't charge Gemini separately from Google Search; it's a robots.txt preference only.

What should I check, step by step?

1. Sort the crawlers that reach you into classes before writing any rule: search engines (Googlebot, Bingbot), AI search (OAI-SearchBot, Claude-SearchBot, PerplexityBot), fetches a person asked an assistant to make (ChatGPT-User, Claude-User, Perplexity-User), training crawlers (GPTBot, ClaudeBot, CCBot) and unknown automation. Pick Allow, Charge or Block for each class.

  1. Never send 402, 401 or 403 to a search crawler you want in the index. Google treats all 4xx except 429 as content that doesn't exist and removes indexed URLs that start returning them, and Cloudflare's Pay Per Crawl docs warn that setting search engine crawlers to Charge or Block may hurt your SEO.
  2. Verify before you charge or exempt. Match each user-agent token against its operator's own list (openai.com/gptbot.json, searchbot.json and chatgpt-user.json; perplexity.ai's perplexitybot.json and perplexity-user.json), use reverse-then-forward DNS for Googlebot (googlebot.com or google.com) and Bingbot (search.msn.com), or verify a Web Bot Auth signature. A request that only says it's Googlebot gets no exemption.
  3. Keep discovery free: robots.txt, sitemap.xml, the homepage and category pages. Cloudflare's Pay Per Crawl always leaves /robots.txt, /sitemap.xml, /security.txt, /.well-known/security.txt and /crawlers.json free, and lets you exclude more URI patterns with Configuration Rules.
  4. Make the 402 machine-readable: put the amount and the way to pay in headers (crawler-price: USD 0.01 for Pay Per Crawl, PAYMENT-REQUIRED for x402) and say the same in a short body. RFC 9110 still lists 402 as reserved for future use, so the payment protocol, not HTTP, defines what the response means.
  5. Tie each payment to a verified identity. Pay Per Crawl requires the crawler to sign with Web Bot Auth and to include crawler-exact-price or crawler-max-price among the signed components, so a request with a borrowed name can't pay, or run up a bill, as someone else.
  6. Keep humans out of the 402 path. Browsers keep getting the page they always got. If you also paywall people, mark the locked part with isAccessibleForFree: false and hasPart.cssSelector, which Google says helps it tell a paywall from cloaking.
  7. Log every decision (claimed crawler, how it was verified, action, price, status) and watch Search Console's indexing and crawl reports for a week after launch. More 4xx responses to Googlebot means a search crawler fell into the charge path.

Why does returning HTTP 402 to Googlebot remove pages from Google Search?

Google's documentation on HTTP status codes says Google doesn't use the content of URLs that return 4xx, that all 4xx codes except 429 are treated the same way (the content doesn't exist), and that URLs already in the index are removed. 429 is treated as server overload, which slows crawling. No status code charges Googlebot without either dropping the page or throttling the crawl.

Which crawlers should I charge with HTTP 402, and which should I let through free?

Cloudflare's Pay Per Crawl gives each crawler an action (Charge, Allow or Block) and one price for every crawler set to Charge; its FAQ says you can't set different prices for different crawlers. Dynamic pricing lets your origin or a Worker send a crawler-price header per path, and every origin request carries cf-pay-per-crawl, with pricing=bypass when the request isn't subject to payment. A WAF or Bot Management block overrides Charge. The docs list it as a closed beta, with Cloudflare acting as merchant of record.

What headers does a paying AI crawler need in a 402 response, with Pay Per Crawl or x402?

Pay Per Crawl: the first response is 402 with crawler-price. The crawler retries with crawler-exact-price (matching the quoted price) or crawler-max-price, signed with Web Bot Auth. A success is 200 with crawler-charged; a failure is 402 with crawler-error such as InvalidCrawlerExactPrice. Error responses aren't billed, and every re-crawl of the same page is billed again, so crawlers need their own spend tracking.

How do I ask Rightshold about this (free, no key)?

Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, then ask: “A crawler hit my paid section and says it's a registered AI crawler. Does its Web Bot Auth signature verify, and which signer is it, before I send it a 402 price or let it through free?”

One-click setup

{
  "tool": "gate_check",
  "arguments": {
    "policy": {
      "require_web_bot_auth": true
    },
    "request": {
      "method": "GET",
      "url": "<the requested URL>",
      "headers": {
        "signature-agent": "<as received>",
        "signature-input": "<as received>",
        "signature": "<as received>",
        "crawler-max-price": "<as received, if sent>"
      }
    }
  }
}

Rightshold checks the signatures and gate policies you send it. It doesn't sit in front of your site, set prices, collect payments from crawlers, or run Pay Per Crawl or x402 for you, and it doesn't verify IP addresses. Not legal advice.

What are the sources?

Related

Not legal advice. JSON · Markdown · All answers

Get a free API key in one call

No card and no email needed. 100 free credits; the license and policy checks stay free without a key.

curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_...   # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
  -H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'