HTTP 402 for API builders

x402 Paid API Starter

A small Node server that shows the paid API shape agents expect: preview, 402 response, discovery, feed filters, and a production verifier swap point.

$ curl -i /v1/paid/data
HTTP/1.1 402 Payment Required
payment-required: eyJ4NDAyVmVyc2lvbiI6Mi...

{"error":"payment_required"}

$ curl -H 'X-Payment: demo-paid' /v1/paid/data
{"paid":true,"count":3}

Free Preview

Expose one useful row before payment so humans and agents can inspect value.

402 Route

Return a structured payment requirement with route, price, network, and asset details.

Feed Filters

Wrap JSON feeds with score, tag, repository, opportunity, and effort-score filters.

Quick Start

git clone https://github.com/go165/x402-paid-api-starter.git
cd x402-paid-api-starter
cp .env.example .env
npm test
npm start