x402 · USDC · Solana first
Pay per call.
Papertrade intelligence for agents.
Liquidation risk for any wallet, a live liquidation map, settlement estimates and top-trader stats, computed from live Papertrade data. No API keys and no accounts. Start with the free preview, connect your AI over MCP, or let your agent take an HTTP 402, sign a USDC payment and get the full answer.
Unofficial, not affiliated with Papertrade. High leverage can lose your whole margin. Nothing here is financial advice.
- Papertrade API: checking
- Payments: checking
- Solana USDC
- Base USDC
Works with
Works with
- Claude
- Codex
- ChatGPT
- Gemini
- Cursor
- VS Code
- Windsurf
- Zed
Live markets free
GET /api/v1/marketsPaid endpoints
Priced in USDC per successful call. You are charged only when the answer is delivered.Payments are not switched on yet. The operator has not set a payout address, so paid endpoints answer an explanatory 503 instead of a payment challenge. Every endpoint has a free live preview below, and the MCP server works now. Operators: set X402_SOLANA_PAY_TO.
Free: /api/v1/health, /api/v1/markets, /openapi.json, /.well-known/x402.
Try it live
Sends one real request. Nothing is signed or charged.Decoded PAYMENT-REQUIRED header
Connect your AI
One URL. Read-only tools. Connecting cannot spend money.claude mcp add --transport http papertrade-x402 https://papertrade-x402.pages.dev/mcp
codex mcp add papertrade-x402 --url https://papertrade-x402.pages.dev/mcp
{
"mcpServers": {
"papertrade-x402": { "url": "https://papertrade-x402.pages.dev/mcp" }
}
}
{
"mcpServers": {
"papertrade-x402": { "httpUrl": "https://papertrade-x402.pages.dev/mcp" }
}
}
Claude Desktop and claude.ai: add a custom connector with the URL above. ChatGPT: developer mode connector. VS Code, Windsurf, Zed, Cline, Goose, Continue and the Claude and OpenAI APIs: full setup guide.
MCP tools
Schemas and examplesFree
get_marketsget_service_statuspreview_wallet_riskpreview_liquidations_nearbypreview_estimate_positionpreview_top_traders
Paid, requirements only
wallet_riskliquidations_nearbyestimate_positiontop_traders
These return the x402 payment requirements and never pay. Your agent pays with its own wallet over HTTP: how.
curl
Every paid route answers an unpaid request with a spec-correct 402.curl -i https://papertrade-x402.pages.dev/api/v1/wallet/0x3f139ef9f371fbbfc299aa65b93534e177141b18/risk
# HTTP/2 402
# payment-required: eyJ4NDAyVmVyc2lvbiI6Mi4uLg== (base64 JSON: x402Version, accepts[], resource)
# Decode the challenge
curl -si https://papertrade-x402.pages.dev/api/v1/liquidations/nearby?market=BTC\&pct=0.5 \
| grep -i '^payment-required:' | cut -d' ' -f2 | base64 -d | jq '.accepts[] | {network, amount, payTo}'
# POST route
curl -i -X POST https://papertrade-x402.pages.dev/api/v1/estimate \
-H 'content-type: application/json' \
-d '{"market":"BTC","side":"long","marginUsd":100,"leverage":100,"exitMovePct":-0.5}'
TypeScript client
Example. You supply the signer; keys never leave your process.import { x402Client, wrapFetchWithPayment } from '@x402/fetch';
import { registerExactSvmScheme } from '@x402/svm/exact/client';
import { createKeyPairSignerFromBytes } from '@solana/kit';
import { base58 } from '@scure/base';
// Your own key, from your own secret store.
const signer = await createKeyPairSignerFromBytes(
base58.decode(process.env.SOLANA_PRIVATE_KEY!),
);
const client = new x402Client();
registerExactSvmScheme(client, { signer });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch(
'https://papertrade-x402.pages.dev/api/v1/wallet/0x3f139ef9f371fbbfc299aa65b93534e177141b18/risk',
);
console.log(await res.json());
import { PapertradeX402 } from 'papertrade-x402';
// Dry run: prints requirements, signs and pays nothing.
const preview = new PapertradeX402({ dryRun: true });
console.log(await preview.liquidationsNearby({ market: 'BTC', pct: 0.5 }));
// Live: pay with your signer, refuse anything above 0.10 USDC.
const api = new PapertradeX402({ svmSigner: signer, maxPriceUsdc: 0.1 });
const { data, receipt } = await api.tradersTop({ window: '7d' });
Agent quick start
- Discover. Fetch
/.well-known/x402,/openapi.jsonor the MCP server card for prices, networks, payTo and input/output schemas. Checkstatusfirst. - Call. Request any paid route. You get
402and a base64PAYMENT-REQUIREDheader listing Solana USDC first, then Base USDC. - Pay. Sign the matching option and retry with the
PAYMENT-SIGNATUREheader. The x402 fetch wrapper does both steps for you. - Receive. The facilitator verifies before the handler runs and settles only after a successful response. Errors (
400,502) are never charged. The receipt is inPAYMENT-RESPONSE. - Preview first. Every paid route has a free live preview under
/api/v1/preview/. - Pair it. Use papertrade-ai (MCP server and CLI) for the trading side and this API for paid intelligence.