What is a Payable Endpoint?
A payable endpoint is an HTTP API endpoint that gates access behind an x402 payment — returning 402 Payment Required with structured pricing to unpaid requests and serving the resource after payment verification and settlement.
WHY IT MATTERS
The concept of a payable endpoint represents a fundamental shift in how APIs are monetised. Instead of subscriptions, API keys, and credit-based billing systems, any HTTP endpoint can become individually purchasable.
With the x402 SDK, creating a payable endpoint is trivial:
app.use(paymentMiddleware({
"GET /premium-data": {
accepts: [{ scheme: "exact", network: "base", ... }],
description: "Premium market data"
}
}))This transforms the endpoint economics. A data provider can charge $0.001 per weather query, $0.05 per financial report, or $0.10 per satellite image — with instant settlement, no minimum purchase, and no account required. Each endpoint becomes its own product with its own price.
Cloudflare's Agents SDK extends this further with paidTool() — creating MCP tools that are inherently payable. An MCP server can expose a mix of free and paid tools, and agents automatically handle the payment flow when calling paid tools.
The payable endpoint model works especially well for AI agents because they consume APIs at massive scale with high variance. An agent might call one endpoint once and another ten thousand times. Per-request pricing aligns cost with actual usage, unlike subscriptions that either over- or under-charge.
HOW POLICYLAYER USES THIS
PolicyLayer enforces per-endpoint spending policies for payable endpoints your agents consume. Each discovered endpoint gets its own budget, rate limit, and recipient pin — so a compromised or malicious endpoint can't affect your spending on other services.