Data & analysis

x402-api-builder

Try it

Build your own pay-per-call API with the x402 standard: FastAPI + payment manifest + API keys + MCP wrapper. Sell your data/services per call (USDC). Template with ON-CHAIN payment verification (secure-by-default).

What it does

Turn your data/service into a **paid pay-per-call API** in under an hour.

The skill document

X402 API Builder 💳🔌

Turn your data/service into a paid pay-per-call API in under an hour.

What you get

  1. FastAPI server with paid endpoints (template)
  2. x402 manifest (/.well-known/x402) — so other agents can discover you
  3. Payment flow: customer pays USDC → sends txHash → gets API key
  4. 401/402 gates — no free calls
  5. MCP wrapper — your API as MCP tools (get_signals, get_market, etc.)

Quick start

# 1) Install
pip install fastapi uvicorn

# 2) Copy the template
cp scripts/server.py .
cp scripts/mcp_server.py .

# 3) Add YOUR endpoints (see TODO in server.py)
# 4) Run
uvicorn server:app --host 0.0.0.0 --port 8791 &

# 5) Verify manifest
curl http://YOUR_IP:8791/.well-known/x402
ProductPrice
Per call$0.005 (market: $0.001-0.01)
Monthly (unlimited)$25
Premium (live + alerts)$100
Enterprise (SLA + white-label)$500

Security (critical)

  • On-chain verification (secure-by-default): /v1/purchase only issues an API key after the txHash is verified on-chain (eth_getTransactionByHash + receipt status against Base RPC). Unreachable RPC or invalid tx = purchase denied (402).
  • Never commit api_keys.json (gitignore it!)
  • API key = HMAC of txHash (verifiable, not guessable)
  • 401 without key · 402 when call usage is exhausted or payment is not verified
  • Client: refuses to send the key over plain HTTP to non-local hosts (use X402_BASE=https://...)
  • Rate-limit per key

Files

x402-api-builder/
├── SKILL.md
└── scripts/
    ├── server.py      # FastAPI template (manifest + purchase + gates)
    ├── mcp_server.py  # MCP wrapper (fastmcp)
    └── client.py      # Test client

Related skills

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai22 installs8 stars

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants4.3k installs296 stars

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván855 installs69 stars

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván559 installs18 stars

More from northcap-group

Browse all skills

Dealing Range Theory (DRT) — complete ICT structure: Type 1 (continuation), Type 2 (reversal), Type 3 (consolidation), quadrant levels (25/50/75), entry models, SMT confirmation and news filter. For market analysis and trade setups.

by Northcap Group2 installs1 stars

Crypto DRT scalping strategy + backtest reference on 12 crypto pairs (TRX, BNB, BTC, LINK, AVAX, DOGE, SOL, NEAR, XRP, LDO, ADA, ETH), all 7 days. Backtested 2 years (~400+ trades). 100% lokal backtest-reference — ingen netværkskald, ingen API-nøgle. Backtest results are historical and not a guarantee of future performance.

by Northcap Group2 installs1 stars

How to build wealth from zero — bootstrapping, scaling strategies, resource allocation, and wealth mindset. Strategic advisory for Mohamed.

by northcap-group1 installs

Provides pay-per-call crypto trading signals with entry, stop-loss and take-profit via the x402 standard (USDC on Ethereum). Live DRT/ICT signals for agents and traders.

by Northcap Group1 installs1 stars

How the world's best entrepreneurs network, negotiate, and create partnerships. Relationships that build millions.

by northcap-group

Crypto DRT scalping — Dealing Range Theory on 12 crypto pairs (TRX, BNB, BTC, LINK, AVAX, DOGE, SOL, NEAR, XRP, LDO, ADA, ETH), all 7 days. Backtested 2 years (~400+ trades). Backtest results are historical and not a guarantee of future performance. Separate play-money account rules.

by northcap-group