This content reflects minia2a as of its publication date and is kept for the record. Current model: x402 pay-per-call in USDC on Base only, 5 free trial calls per signed wallet, no credits and no top-up rail.

Preflight the 402 before your agent pays for it

2026-12-05 · what an unpaid request can tell you, and what it cannot

When an agent hits an x402 endpoint, it has exactly two moves: build a payment from the challenge it was handed, or walk away. Both are expensive if the challenge is wrong. A signature that no client can build wastes the call; a payment for an offer that misstates its unit wastes the money; a price above the client's default spend cap ends in a silent refusal the seller never sees.

The cheapest moment to find any of that is before the signature — on the unpaid 402 itself. That request is free, repeatable, and tells you more about the offer than the paid response will.

Structurally valid is not the same as payable

Every defect below has been seen in the wild, and none of them is a crash. Each one is a 402 that looks fine to a parser and fails later, at the point where money moves.

  • Body and PAYMENT-REQUIRED header disagree. Some clients read the header, some read the body. If their accepts[] arrays differ, half your callers pay a different price than the other half.
  • An EIP-712 exact offer with no extra.name / extra.version. The signing domain is unbuildable. The wallet cannot produce a signature, so the endpoint is effectively closed to every compliant client.
  • A non-integer amount. Token amounts must be integers in the smallest unit. A float cannot be signed losslessly; rounding it either underpays or overpays by a fraction the seller will never notice.
  • A network that is not CAIP-2, or a payTo / asset that is not a 20-byte address. The client has nowhere to send the payment, or sends it somewhere unrecoverable.
  • x402Version: 2 with resource as a string. v2 defines resource as an object. A string that passes a lenient parser is not a v2 document.
  • A price above the reference client's default $1 per-call cap, with no disclosure. The client refuses before it signs. The seller sees no error, no traffic, and no reason.
  • An advertised example the handler would refuse. An empty input.example when the service takes input, or an example that violates its own schema.required, teaches every reader the wrong request. Indexers copy that example and replay it for days.
  • Two identical reads with no nonce or expiry. That is not a quote; it is a cached document. Fine for a static price, worth knowing before you build retry logic on it.

What we shipped: an unpaid-only preflight

@minia2a/x402-check is a zero-dependency Node ≥18 CLI. It sends one unpaid request (two when the static-offer check runs), reads the challenge the endpoint actually serves, and prints a verdict with per-finding codes. It never signs and never pays.

$ npx @minia2a/x402-check https://example.com/paid/api x402-check 0.1.3 https://example.com/paid/api status 402 verdict PASS (0 fail, 0 warn, 2 info) INFO static-offer two requests 1.2s apart return an identical offer ... INFO unpaired-examples output.example is advertised without answerBasis ... 

Exit codes are 0 no failures, 1 at least one FAIL, 2 usage or network error — so it drops into a CI step or an agent's pre-payment routine without parsing prose. --json gives the same report as data. --max-price defaults to 1.00 USD, the reference client's cap; --header lets you reach endpoints behind an auth header.

What it refuses to check, and why

It does not test whether the endpoint enforces payment — whether it accepts a forged transaction hash, replays a receipt, or serves data without settling. That question needs a signed payment, which is a different tool and a different risk: the moment the check signs, the check itself is a transaction, and a test you cannot afford to run on every push does not get run. Payment-enforcement auditing is a paid, adversarial exercise. A preflight should be something a buyer runs on every unfamiliar endpoint without thinking about cost.

It also does not judge whether the data is good, whether the seller is honest, or whether the service is worth the price. It judges the offer's shape.

What it found in our own catalog

We ran it against 40 endpoints sampled from minia2a's own listings. The honest result:

verdict count why
PASS 39 no defects at the challenge layer
FAIL 1 a $2.00 endpoint above the default cap — it discloses the cap, so the tool was working as designed
INFO 36 unpaired-examples: an output.example with no answerBasis
WARN 2 empty-input-example on services that do take input

The 36 INFO findings are our own gap, not a client bug. We advertise an output example for most services, but we do not state that it is the response to the input example next to it. A reader can see the pair and assume the link; nothing in the document asserts it. That is the difference between an example and a claim, and it is on our list.

The single FAIL is the more useful lesson. The tool said no because a $2.00 offer exceeds a $1.00 default — exactly what the default is for. Raising --max-price turned it green, and the endpoint's own advertisement already disclosed the cap. A preflight that cannot be told "I know what I'm doing" would be ignored after the first false positive.

The rule that generalises

An offer is a promise. Every promise in the 402 should be checkable without accepting it: the price, the token, the chain, the recipient, the domain, and the example. If a check needs a signature to run, it will run rarely, and the rare check is the one that misses the change.

Run the preflight against endpoints you are allowed to call. If you sell an x402 endpoint, run it against your own — the failures it finds are the ones your buyers experience as silence.

← All posts

Originally published at minia2a.uk.