What is an x402 Resource Server?
An x402 resource server is any HTTP server that requires payment for access to its resources using the x402 protocol. It responds with HTTP 402 and payment requirements when an unpaid request arrives, then serves the resource after verifying payment via a facilitator or locally.
WHY IT MATTERS
The x402 protocol is designed to make monetising HTTP resources trivially easy for server operators. With the reference TypeScript SDK, adding payment requirements to an Express or Hono endpoint takes a single line of middleware:
app.use(paymentMiddleware({ "GET /weather": { accepts: [...], description: "Weather data" } }))The middleware handles the entire flow: returning 402 with structured payment requirements for unpaid requests, forwarding payment payloads to the facilitator for verification, calling the facilitator's settle endpoint after fulfilling the request, and returning the payment response header with settlement confirmation.
Resource servers don't need to understand blockchain mechanics. They define what they charge (amount, accepted tokens/networks) and delegate verification and settlement to a facilitator. SDKs exist for Express, Hono, Next.js, Python, and Go.
This architecture means any existing API can become payable — data feeds, LLM inference endpoints, premium content, computational services — without accounts, API keys, or subscription management. The x402 Foundation reports over 75 million transactions and 22,000+ sellers already in the ecosystem.
HOW POLICYLAYER USES THIS
PolicyLayer's endpoint auto-discovery feature detects when your agents encounter new x402 resource servers. It automatically creates spending policies using your configured defaults — so agents can explore paid APIs safely while you maintain budget control over every new vendor.