x402 pay-per-call market data
How to buy market data per request with x402 (HTTP 402 + USDC on Base or Solana): no account or API key. Copy-paste examples in curl, JavaScript, Python and MCP.
x402 revives the HTTP 402 Payment Required status code so a client can pay for a single request with a stablecoin, with no signup, API key or invoice. It suits AI agents well: an agent with a small wallet can discover a route, see the price and pay for exactly the calls it makes.
The flow
- Request a paid route, for example
GET /futures/event-gate?window=30. - The server answers
402with a base64PAYMENT-REQUIREDheader listing what it accepts: schemeexact, network (Baseeip155:8453or Solana), USDC amount andpayTo. - Your client signs a USDC transfer authorization (EIP-3009 on Base) for that amount and retries with a
PAYMENT-SIGNATUREheader. - A facilitator verifies and settles on-chain and pays the gas. You get
200JSON plus aPAYMENT-RESPONSEheader with the transaction hash.
Failed calls (bad input, upstream outage) return 4xx/5xx and are never settled, so you only pay for successful responses.
See the handshake (free)
curl -i "https://signals.incomefather.com/futures/event-gate?window=30"
# HTTP/2 402
# payment-required: eyJ4NDAyVmVyc2lvbiI6Mi...
Pay from JavaScript
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.X402_PRIVATE_KEY); // dedicated low-balance wallet
const fetchWithPay = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
policies: [(_v, reqs) => reqs.filter((r) => BigInt(r.amount) <= 100000n)], // cap $0.10
});
const res = await fetchWithPay("https://signals.incomefather.com/futures/event-gate?window=30");
console.log(await res.json());
Pay from Python
from eth_account import Account
from x402 import x402Client, max_amount
from x402.http.clients import x402_httpx_transport
from x402.mechanisms.evm.exact.register import register_exact_evm_client
import httpx, os
import asyncio
async def main():
client = x402Client()
register_exact_evm_client(client, Account.from_key(os.environ["X402_PRIVATE_KEY"]),
networks="eip155:8453", policies=[max_amount(100_000)]) # cap $0.10
async with httpx.AsyncClient(transport=x402_httpx_transport(client), timeout=60) as http:
r = await http.get("https://signals.incomefather.com/sec/insider-clusters?days=7")
print(r.json())
asyncio.run(main())
Use it from Claude, Cursor or Cline
The trading-signals MCP server wraps every route as a tool that pays automatically, capped per call:
npx -y x402-trading-signals-mcp # env: X402_PRIVATE_KEY, MAX_USD_PER_CALL=0.10
Prices on this API
| Route | USDC |
|---|---|
/futures/event-gate | $0.01 |
/sec/insider-buys | $0.01 |
/futures/event-study, /sec/insider-clusters, /base/token-verdict | $0.02 |
/futures/session-brief | $0.03 |
/ai/trade-brief | $0.08 |
/bundle/pre-trade-check | $0.10 |
/quant/* calculators | $0.005 to $0.02 |
Machine-readable: /openapi.json and /.well-known/x402.
Wallet safety
- Use a dedicated wallet holding a few dollars of USDC, never one with other funds.
- Always set a per-call cap in your client policy.
- No ETH is needed on Base: the facilitator pays gas.
Prefer an API key? The free tier gives 100 calls a month with no card.