Aethelforge
Read the Index

Research · Standards

HTTP 402: answering an agent with a challenge instead of a block

RFC 9110 still calls HTTP 402 reserved for future use. Here is how x402 and Cloudflare pay per crawl turn it into a challenge an agent can meet and retry.

Published 21 Nov 20268 min readAethelforge editors

In one paragraph

What does an HTTP 402 challenge do for an AI agent?

A 402 response states what the agent must do to be served, such as pay a price, so it can meet the terms and retry. RFC 9110 still reserves 402 for future use; x402 defines the exchange.

HTTP's status codes are among the most stable vocabularies on the internet, and almost all of them have done the same job for decades. One has been in the specification since the first HTTP/1.1 document without ever being given a job — and in the last two years, published protocols have started handing it one.

For a front desk deciding how to answer an automated caller, that code matters. It offers a third answer between an open door and a wall: a stated set of terms, carried in the protocol itself, that the caller can meet and then retry.

Every source cited below was checked on 15 October 2026.

What The RFC Actually Says About 402

The current HTTP semantics document, RFC 9110, was published in June 2022 as Internet Standard STD 97, and it gives the code a single sentence. Section 15.5.3 reads, in full: "The 402 (Payment Required) status code is reserved for future use."

That wording has barely moved in nearly thirty years. RFC 2068, the January 1997 document that first defined HTTP/1.1, says "This code is reserved for future use," and RFC 2616 repeated the identical line in June 1999.

Keep in mind what the RFC does not do. It defines no header, no body format and no payment method for 402, so any meaning the code carries today comes from a protocol layered on top of HTTP rather than from HTTP itself.

Why A Reserved Code Is Useful At The Front Door

Without a challenge code, a server answering an automated request has two broad options. A 403 Forbidden says no and ends the conversation, while a 200 OK says yes on whatever terms the caller happened to assume.

Neither answer tells the agent what it would take to be served. A 402 response can carry exactly that, and this is the standards reading of the Aethelforge manifesto: recognise the caller, route it to the right lane, and keep a receipt of what was agreed.

In other words, the code is a front door with a bouncer rather than a wall. The bouncer does not refuse the caller outright — it states the conditions for entry and waits to see whether they are met.

x402: The Exchange, Step By Step

Of the 402-based protocols we have read, x402 is the most fully specified at the wire level. Its reference repository, coinbase/x402 on GitHub, notes that the project has moved to the x402 Foundation, which Cloudflare announced its intent to create with Coinbase on September 23, 2025.

The current text is version 2 of the x402 specification, whose version history dates v2.0 to December 9, 2025 and describes it as restructuring the payment objects and moving to CAIP-2 network identifiers. The walk below follows that document and the companion x402 v2 HTTP transport spec.

Step 1: The Request

First, the client sends an ordinary HTTP request for a resource. The repository README notes that this opening round trip is optional if the client already knows which payment terms the server accepts.

Step 2: The 402 With Its Terms

Next, the server answers 402 and puts its terms in a PAYMENT-REQUIRED response header, encoded as Base64 JSON that matches the spec's PaymentRequired schema. The transport spec states that response bodies are left to the server, so all of the x402 protocol information travels in headers.

Decoded, the specification's own example reads as follows (reproduced as published, fields unchanged):

{
  "x402Version": 2,
  "error": "PAYMENT-SIGNATURE header is required",
  "resource": {
    "url": "https://api.example.com/premium-data",
    "description": "Access to premium market data",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:84532",
      "amount": "10000",
      "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
      "payTo": "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
      "maxTimeoutSeconds": 60,
      "extra": { "name": "USDC", "version": "2" }
    }
  ],
  "extensions": {}
}

Each entry in accepts is one acceptable way to pay. The spec requires a scheme, a CAIP-2 network, an amount in atomic units, an asset, a payTo recipient and a maxTimeoutSeconds window — and it allows asset to be either a token contract address or an ISO 4217 currency code for fiat.

Note that the resource object is separate from the payment options. That separation means the challenge names what is being sold as well as its price, which is the part a front desk can read back later as a receipt.

Step 3: The Retry With Proof

Then the client picks one entry from accepts, builds a PaymentPayload for that scheme and network, and resends the original request with the payload Base64-encoded in a PAYMENT-SIGNATURE header. The payload echoes the chosen terms in an accepted field and carries scheme-specific proof; for the exact scheme on EVM networks, the spec lists a signature and an authorization.

Because the chosen terms travel back with the proof, the server does not have to trust the client's memory of the offer. It can compare what was accepted against what it offered before doing any work.

Step 4: Verification And Settlement

Once the retry arrives, the server checks the payload itself or posts it, together with the original requirements, to a facilitator's /verify endpoint. If the payload is valid, the server either settles directly or calls the facilitator's /settle endpoint, after which the facilitator submits the payment and waits for confirmation.

The README frames the facilitator as a way to keep gas and RPC details out of both the client and the server. That is the project's stated goal, not a measured result.

Step 5: The Resource

Finally, on success, the transport spec calls for a 200 with the resource and a PAYMENT-RESPONSE header carrying the settlement result as Base64 JSON. On a failed verification or settlement the answer is another 402 — with a PAYMENT-RESPONSE whose success field is false when settlement failed — while a malformed payload or requirement set gets a 400.

That failure path is the detail a front desk should notice. A failed attempt ends not in a block but in another 402 that restates the terms; only a malformed request drops to a 400.

Cloudflare Pay Per Crawl: A Second 402 Scheme

x402 is not the only scheme giving 402 a job. In its July 1, 2025 announcement of pay per crawl, Cloudflare wrote that it was "excited to help dust off a mostly forgotten piece of the web: HTTP response code 402".

The exchange it describes runs in two shapes. In the discovery-first path, a crawler receives a 402 with a crawler-price header and can retry with crawler-exact-price to agree; in the intent-first path, it sends crawler-max-price up front and receives a 200 if the configured price falls within that ceiling.

The announcement adds that only one price declaration header, crawler-exact-price or crawler-max-price, may be used per request, and that an invalid request of any kind returns a 402. A successful paid response carries a crawler-charged header, which Cloudflare uses to record the billing event before it aggregates charges and pays the publisher.

Identity comes before payment in this scheme. The announcement requires participating crawlers to sign requests with HTTP Message Signatures, sending the signature-agent, signature-input and signature headers covered in what a signed agent request looks like.

Be aware of the scheme's status as well. Cloudflare's pay per crawl documentation, last updated July 28, 2026, states that the feature "is currently in closed beta".

How The Two Schemes Compare

Placed side by side, the two schemes share a shape — request, challenge, retry, resource — and differ in where trust lives. Here is how each publisher's own documents describe the moving parts:

  • Where the terms travel. x402 v2 sends a PAYMENT-REQUIRED header of Base64 JSON that can list several payment options. Pay per crawl sends a single crawler-price header.
  • How the caller agrees. x402 retries with a signed payment payload in PAYMENT-SIGNATURE. Pay per crawl retries with crawler-exact-price, or declares crawler-max-price before any challenge is issued.
  • How identity is established. Pay per crawl makes a registered, signed crawler a precondition. The x402 v2 core spec binds the retry to a payment signature and reserves an extensions object, but the sections we read do not require a separate caller identity.
  • Who settles. x402 settles through the server or a facilitator, per the README. Pay per crawl aggregates charges and bills through Cloudflare, per the announcement.

All of these differences sit on top of the same one-line RFC entry. That is the practical meaning of "reserved for future use": the code is a shared slot, and each protocol decides what goes into it.

The Front-Desk Reading: Terms Instead Of Walls

A challenge lets a business set terms for an agent instead of choosing between an open door and a block. Read through the two specifications, those terms fall into three kinds.

  • Identify yourself. Pay per crawl already makes a signed identity the price of admission, which is the same declared signal discussed in declared vs undeclared agent signals and observed in the wild in agents have started signing their requests.
  • Pay. Both schemes put a price and its conditions in the response itself — x402 adds an asset, a recipient and a timeout — so an agent can decide without a human in the loop.
  • Use this lane. Neither document defines a "lane" field. What both define is a machine-readable refusal-with-terms. Because x402 states its terms per resource, a site can answer one path free and another with a price; Cloudflare's announcement describes a single site-wide price.

The phone network has a cousin of this in call attestation. STIR/SHAKEN attestation levels for a front desk reads how a carrier labels what it knows about a caller, and 402 lets a web server state what it requires of one.

It also fits the acting layer on the layers page: an agent working for a person is neither a visitor to wave through nor one to turn away, and a challenge treats it as a party to a transaction.

What The Sources Do Not Settle

Several questions stop at the edge of the primary documents. None of the sources above measures how widely 402 is deployed, and Cloudflare's own description of the code is "mostly forgotten," so this piece makes no adoption claim.

RFC 9110 has not been revised to assign 402 a meaning, and x402 and pay per crawl are conventions layered on top of it. Whether any of them moves into an IETF document is not addressed by the sources we checked, so we stop there.

See The Exchange Run

The live challenge exchange on this site runs the same sequence end to end: the request, the 402 with its terms, the retry and the resource. It is the quickest way to see what an agent receives when a front desk answers with terms instead of a wall.

How often automated callers reach a front desk in the first place is measured on the current Aethelforge Index edition, built on the published method. For the other open standards we read at this depth — Web Bot Auth, STIR/SHAKEN, MCP and AP2 mandates among them — start at the standards hub.

If you're deciding what your front desk should say to an automated caller that arrives with no terms of its own, the 402 challenge is a documented place to start, though not yet a standard one. Read the two specifications against your own paths, decide which ones answer free and which answer with a price, and keep the receipt.

FAQ

Questions this note answers.

  1. 01What exact wording does RFC 9110 use for status code 402?

    Section 15.5.3 of RFC 9110 (June 2022) reads, in full: "The 402 (Payment Required) status code is reserved for future use." RFC 2068 used near-identical wording in January 1997.

  2. 02Which headers carry an x402 v2 payment exchange?

    Per the x402 v2 HTTP transport spec, the server sends PAYMENT-REQUIRED, the client retries with PAYMENT-SIGNATURE, and the server confirms with PAYMENT-RESPONSE. Each carries Base64-encoded JSON.

  3. 03How does Cloudflare pay per crawl use the 402 status code?

    Per Cloudflare's July 1, 2025 announcement, a crawler gets a 402 with a crawler-price header and can retry with crawler-exact-price, or send crawler-max-price up front. Docs updated July 28, 2026 say it is in closed beta.

  4. 04What happens when an x402 payment fails verification or settlement?

    The x402 v2 transport spec returns another 402 rather than a block; a failed settlement includes a PAYMENT-RESPONSE with success set to false. A malformed payload or requirement set returns a 400 instead.

  5. 05Is HTTP 402 widely adopted across the web?

    No primary source we checked measures 402 deployment. Cloudflare's 2025 announcement called the code "mostly forgotten," and its pay per crawl feature is in closed beta, so this note makes no adoption claim.