x402 API
Charge for an API per request, with no API keys and no signup. Callers pay USDC; x402 handles the rest. Here's how to sell one, call one, and get discovered.
No API keys
Payment replaces the key. No signup forms, no key issuance, no rotation, no leaked secrets.
Per-call pricing
Price each route — even a fraction of a cent — because USDC on Base has tiny fees.
Agent-callable
AI agents discover and pay automatically — no human relationship required.
Sell your API in ~12 lines
Wrap the route, set a price and a wallet. Unpaid requests return HTTP 402; paid ones get the data.
import express from "express";
import { paymentMiddleware } from "@x402/express";
const app = express();
app.use(
paymentMiddleware(
"0xYourReceivingWalletAddress",
{ "GET /v1/data": { price: "$0.002", network: "base" } }
)
);
app.get("/v1/data", (req, res) => res.json({ result: "..." }));
app.listen(3000); Other languages/frameworks: SDK guide · step-by-step: tutorial.
Get discovered: the marketplace
Agents find paid APIs through the x402 Bazaar discovery layer. Browse the 1.5k+ x402 projects we track — including facilitators and gateways — to see how teams expose and monetize APIs. Open the directory →
Frequently asked questions
Do I need an API key to use x402?
No — that’s the point. Traditional APIs gate access with an API key you sign up for; x402 replaces that with payment. The caller proves a USDC payment instead of presenting a key, so there’s no signup, key issuance, or key rotation. You can still combine x402 with keys if you want, but it isn’t required.
How do I sell my API with x402?
Wrap the routes you want to charge for with the x402 payment middleware, setting a price and a receiving wallet address. Callers get HTTP 402 until they pay USDC, then receive the response. There’s no billing system, invoicing, or API-key management to build — settlement happens on-chain via a facilitator.
What is an x402 API marketplace?
It’s a directory where agents and developers discover paid, x402-enabled APIs and call them by paying per request. The x402 Bazaar is the discovery layer for this. Listing an API makes it callable by autonomous agents that pay automatically, without any prior account relationship.
How much does each API call cost with x402?
You set the price per route — it can be a fraction of a cent because x402 settles USDC on low-fee networks like Base. That makes true pay-per-call pricing viable, where card processing fees would make micro-charges impossible.
Can AI agents call my x402 API automatically?
Yes. An x402-aware client signs a USDC payment on a 402 response and retries automatically. This lets autonomous agents discover and pay for your API with no human signup — the main reason x402 APIs are attractive for the agent economy.
Related: API paywall · use cases · x402 Bazaar