Shovel Research

The x402 Field Guide: Selling Your API to AI Agents

We shipped x402 payment endpoints on three production data sites. Here is what the tutorials skip: pricing rules that trace to real client code, the route-pattern bug that gives paid data away free, and why the free endpoint matters more than the paid ones.

July 10, 2026 · by Shovel

In July 2026 we added x402 payment endpoints to three production data products: The Vault Report (precious metals), Mining Incidents (MSHA mine safety), and Safety Incidents (OSHA workplace safety). An AI agent can hit any of those catalogs right now, read the price list, and buy a page of query results for a cent or two in USDC. No API key, no signup, no invoice.

Most writing about x402 stops at "HTTP 402 is back" and a hello-world snippet. This guide is the rest of it: what to sell, how to price it, the implementation traps that only show up once real money settles, and the telemetry you should ship on day one. Every rule below traces to something that actually happened while we built the same surface three times.

What is the x402 protocol?

x402 is an open payment protocol, started by Coinbase, built on the status code HTTP reserved in the 1990s and then never used: 402 Payment Required. The loop works like this:

Payments are USDC on Base. USDC has 6 decimals, so a $0.01 price rides the wire as the string 10000. The whole design exists because the buyer is not a human who will tolerate a signup form. It is an agent in a loop, deciding in milliseconds whether your data is worth one more cent.

The honest economics: distribution, not revenue

Before you build, size the prize. While researching ours, we pulled 30-day gross figures for the top data sellers on x402 discovery surfaces: they ranged from a few hundred dollars to roughly $12,000 a month, and those are the winners. A niche data product should expect on the order of $100 a month at best, at least today.

So why bother? Because listing is free distribution on every agent-discovery surface at once: the Coinbase Bazaar indexes your endpoints automatically after your first settlement, and registries like x402scan list your catalog for any agent that shops there. You are buying a storefront on the machine web for a few days of work. Budget days, not weeks. And resist the urge to build an aggregator or a directory: be the supply.

Sell answers, not rows

Raw facts get commoditized instantly. An agent can get a spot gold price from a dozen free sources; it will not pay you for row storage. What it will pay for is the thing only you can compute:

Pricing rules that trace to real client code

None of these are taste. Each exists because of how actual x402 clients and the facilitator behave.

The five gotchas that cost us real hours

These are the ones the docs do not lead with.

Wallet setup: what is secret and what is not

The receiving address (payTo) is public by design. It ships in every 402 challenge and is listed by explorers and registries, so commit it to your repo as a constant with an environment override. Only the facilitator API credentials are secrets. Two rules we learned setting this up across multiple brands:

If you sell reports, guard the boundary

If your product also sells anything expensive (one of ours sells a $149 compliance-history report), the penny API must not sell that product's ingredients. An agent that can buy the inputs for 30 cents will not buy the report, and neither will its operator. Our rule: facts and single-entity totals are fair game for x402; interpretation, benchmarks, cross-entity scale, and portable artifacts stay behind the real price. Watch denominators especially. Selling a cheap feed of hours-worked lets an agent compute the very injury-rate benchmarks the paid product sells.

Then enforce it in code, not discipline: our CI runs a blocking test that greps the x402 handlers' SQL for forbidden tables and fields and fails the build if one appears. A boundary that lives in a doc gets crossed by a future refactor that never read the doc.

Log demand before you guess

Your access log almost certainly strips query strings, which means it cannot tell you what agents are actually asking for. That is the only signal worth having when deciding what to build next. Ship a dedicated request log with the x402 surface itself: endpoint, full query parameters, a paid flag, status, and user agent.

The detail that matters: wrap the logging middleware outside the payment gate, so it also records the 402 challenges agents received and declined to pay. Attempted-but-unpaid demand is your product backlog, ranked by the market, for free.

The launch checklist

The catalogs this guide came from are live: thevaultreport.com/api/x402, miningincidents.org/api/x402, and safetyincidents.org/api/x402. Curl any of them, hit a count endpoint for free, and watch a 402 challenge come back off a paid route. That round-trip is the whole protocol, and it is the closest thing the machine web has right now to walking into a shop and reading the price tags.

Get the next finding.

We dig these out of public data. One email when we publish the next one. Nothing else.