x402proxy is a lightweight proxy that verifies x402 payments before forwarding requests to your API. Protect any endpoint and start charging per-request in minutes.
- Multi-chain support (Ethereum, Base, Solana, and more)
- One-time payments with prices you control
- Global or per-route pricing
- Works with any x402 facilitator
- Download the starter config
curl -o custom-config.json https://raw.githubusercontent.com/zachalam/x402proxy/refs/heads/main/custom-config.json- Run the container (mount your config to /app/config.json)
docker run -p 8080:8080 \
-v $(pwd)/custom-config.json:/app/config.json:ro \
zachalam/x402proxy:latestYour proxy will be available on port 8080 by default. The app exits if /app/config.json is missing.
The app reads configuration from /app/config.json inside the container.
Required fields:
facilitatorUrl: The x402 facilitator URLnetwork: Blockchain network (e.g. "base-sepolia")paymentAddress: Your wallet address to receive paymentsdefaultPrice: Default price for all routes (overridable per route)protectedEndpoints: Map of protected routes → forward targets and optional price
Example:
{
"facilitatorUrl": "https://x402.org/facilitator",
"network": "base-sepolia",
"paymentAddress": "0x5629562956295629562956295629562956295629",
"defaultPrice": "$0.05",
"protectedEndpoints": {
"GET /cat": { "forwardTo": "https://api.thecatapi.com/v1/images/search" }
}
}latest: latest stable build<number>: auto-incremented version per commit to main
- Exposes port
8080in the container. Map to your host with-p.
