What is a Payable Endpoint?

2 min read Updated

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.

FREQUENTLY ASKED QUESTIONS

Can any existing API become payable?
Yes. The x402 middleware wraps existing routes without changing their implementation. The API logic remains identical — the middleware simply adds the 402 challenge and payment verification flow around it.
How is pricing set for a payable endpoint?
The resource server operator sets the price in the payment requirements — specifying amount, token (e.g. USDC), and accepted networks. Prices can differ per endpoint and per network. There's no dynamic pricing in the exact scheme, but the planned upto scheme would allow usage-based pricing.
What about free-tier access?
A server can implement hybrid logic — serving limited results for free and requiring payment for premium access. The middleware can be applied selectively to specific routes while leaving others open.

FURTHER READING

Enforce policies on every tool call

Intercept is the open-source MCP proxy that enforces YAML policies on AI agent tool calls. No code changes needed.

npx -y @policylayer/intercept
github.com/policylayer/intercept →
// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.