x402station.io Preflight
One line of code that stops your agent from paying dead, fake, zombie, or overpriced x402 endpoints. Runs preflight before every PAYMENT-SIGNATURE your agent signs. Fail-closed by default.
The whole integration
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { wrapWithPreflight } from "x402station-middleware";
const x402Fetch = wrapFetchWithPaymentFromConfig(fetch, { schemes: [...] });
const safeFetch = wrapWithPreflight(x402Fetch);
// Use exactly like fetch — preflight runs before every payment.
await safeFetch("https://api.example.com/x402-endpoint", { method: "POST", ... });
// ↑ throws PreflightBlockedError if dead / zombie / decoy / never_paid_zombie.Three ways to install
- 1. npm middleware (recommended)
npm install x402station-middleware @x402/fetch @x402/evm viem
Drop-in fetch wrapper. Pure ESM, works in Node 20+, Bun, and the Cloudflare Workers runtime. npm - 2. MCP server (Claude Code / Cursor / Windsurf / Continue)
npx -y x402station-mcp
Ten tools (preflight, forensics, catalog_decoys, alternatives, whats_new, buy_credits, watch_subscribe, plus free status + unsubscribe). npm · MCP Registry - 3. Bulk credits (cheapest at scale)
POST https://x402station.io/api/v1/credits → $0.50 USDC → 1000 prepaid preflights
Effective rate: $0.0005 / call (50% off the $0.001 per-call rate). 90-day expiry. Pass the returned creditId on every preflight via X-Credit-Id. On exhaustion the call fails closed with credit_redeem_failed (no silent per-call charge): buy a new bundle or drop the credit to pay per call.
What Preflight blocks right now
From the live catalog and probe history (cached for up to an hour):
- 2 active endpoints listed at ≥ $1,000 USDC per call. Aggregate sticker price: $2,000. Max single endpoint: $1,000.
- 4,025 listed endpoints currently flagged zombie (probed, never healthy in the last hour).
- Raw catalog paths can overstate effective endpoint supply — single-source risk is surfaced via high_concentration and wildcard_402 / spa_fallback.
Full breakdown: We probed 49,314 x402 endpoints. Here's what we blocked.
Framework recipes
5-minute copy-paste integration for the agent runtimes we've verified end-to-end:
- Safe x402 agent with Coinbase AgentKit · EVMWalletProvider binding · 4 min setup
- Safe x402 agent with Cloudflare Agents · Workers runtime + Durable Objects · 5 min setup
- Safe x402 agent with LangChain / LangGraph · DynamicStructuredTool + MCP adapter · 5 min setup
- Safe x402 agent with Lucid / Daydreams · guarded action boundary · 5 min setup
- Safe x402 agent with Vercel AI SDK · tool execute boundary · 5 min setup
For service operators
Run an x402 endpoint and want agents to prefer it when routing? Mint a $1 verified-badge cert — a 30-day audit certificate showing your endpoints pass the published criteria, re-checked live on its public page. Agents using Preflight prefer verified endpoints when routing alternatives.