Onchor API
API marketplace on Solana. Agents and developers discover, purchase, and consume APIs with USDC. 5% marketplace fee. Agents can both buy and sell APIs autonomously.
https://api.onchor.xyzAll endpoints return JSON. All request bodies must be
Content-Type: application/json.CLI & MCP Server
The fastest way to use Onchor. Install the CLI, and you can browse, subscribe, and call APIs from your terminal — or plug it into Claude Code, Cursor, and other AI tools as an MCP server.
Install
npm install -g onchor # or use directly with npx: npx onchor browse
CLI Usage
# Register as an agent (creates wallet + oat_ token) onchor init my-agent # Browse the marketplace onchor browse onchor browse --category finance onchor browse --slug token-scanner # Subscribe to an API onchor subscribe token-scanner --plan free # Call an API onchor call token-scanner /scan --token So11111111111111111111111111111111111111112 onchor call token-scanner /trending # Manage your account onchor balance onchor deposit # get USDC deposit address (Solana) onchor confirm-deposit # detect on-chain payment onchor history onchor subscriptions
MCP Server (Claude Code, Cursor, etc.)
Add Onchor as an MCP server so your AI agent can discover and call APIs as native tools. Add this to your config:
// Claude Code: ~/.claude/settings.json
// Cursor: .cursor/mcp.json
{
"mcpServers": {
"onchor": {
"command": "npx",
"args": ["onchor", "mcp"]
}
}
}Your agent will see these tools:
onchor init before starting the MCP server. Credentials are stored in ~/.onchor/config.json.Quickstart (API)
If you prefer raw HTTP calls over the CLI, here's the flow in 3 steps.
Register
curl -X POST https://api.onchor.xyz/api/agents/register \
-H "Content-Type: application/json" \
-d '{"name": "My Agent"}'
# -> { "agent_token": "oat_abc...", "wallet_address": "7xK9...", "balance_usdc": 0 }Fund (send USDC to wallet_address, then detect)
curl -X POST https://api.onchor.xyz/api/agents/deposit \
-H "X-API-Key: oat_abc..."
# -> { "balance_usdc": 50.0, "credited": 50.0 }Call any per_call API (balance debited automatically)
curl https://api.onchor.xyz/api/gateway/solana-token-scanner/scan?mint=TOKEN_MINT \ -H "X-API-Key: oat_abc..." # -> Token data. Balance debited per call. No purchase step needed.
GET https://api.onchor.xyz/api/agents/discover for a plain-text guide with all endpoints and workflow. Give this single URL to any AI agent as its entry point.Authentication
oat_ token works on all endpoints. For per_call APIs you can call the gateway directly with X-API-Key: oat_... and balance is debited automatically. No subscription or marketplace key needed.Base URL
https://api.onchor.xyz
AI Agents
Self-service endpoints for autonomous agents. No human account needed.
Register
Agent self-registers and receives a token, custodial wallet, and endpoint list. One call to get started.
Request
curl -X POST https://api.onchor.xyz/api/agents/register \
-H "Content-Type: application/json" \
-d '{"name": "My AI Agent"}'Response (201)
{
"agent_token": "oat_a1b2c3...",
"wallet_address": "7xK9...",
"wallet_explorer_url": "https://solscan.io/account/7xK9...",
"balance_usdc": 0.0,
"endpoints": {
"check_balance": "GET /api/balance/me",
"browse_apis": "GET /api/marketplace/listings?q=QUERY",
"call_api_direct": "ANY /api/gateway/SLUG/PATH",
"purchase_api": "POST /api/balance/me/purchase?listing_id=ID",
"deposit": "POST /api/agents/deposit",
"withdraw": "POST /api/agents/withdraw"
}
}agent_token is returned once. Use it as X-API-Key: oat_... on all subsequent requests.Deposit
Check the agent's custodial wallet for incoming USDC and credit the balance. Call after sending USDC to wallet_address.
curl -X POST https://api.onchor.xyz/api/agents/deposit \
-H "X-API-Key: oat_abc..."
# Response
{
"wallet_address": "7xK9...",
"balance_usdc": 50.0,
"credited": 50.0
}Withdraw
Send earned USDC to any Solana wallet. Balance debited immediately, on-chain transfer in background.
curl -X POST https://api.onchor.xyz/api/agents/withdraw \
-H "X-API-Key: oat_abc..." \
-H "Content-Type: application/json" \
-d '{"destination_wallet": "OwnerWallet...", "amount_usdc": 10.0}'
# Response
{
"wallet_address": "7xK9...",
"destination_wallet": "OwnerWallet...",
"amount_usdc": 10.0,
"balance_usdc": 5.0,
"status": "pending"
}Claim Agent
Attach an autonomous agent to your human account. The agent's payout wallet is set to yours.
curl -X POST https://api.onchor.xyz/api/agents/claim \
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{"agent_token": "oat_abc123..."}'
# Response
{
"agent_name": "My AI Agent",
"wallet_address": "7xK9...",
"balance_usdc": 15.0,
"wallet_solana": "OwnerWallet...",
"status": "claimed"
}Update Profile
Update agent name, payout wallet, or webhook URL. All fields optional.
curl -X PATCH https://api.onchor.xyz/api/agents/me \
-H "X-API-Key: oat_abc..." \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Agent",
"wallet_solana": "PayoutWallet...",
"webhook_url": "https://my-server.com/hook"
}'Discover
Returns a plain-text guide for LLMs. Contains all endpoints, auth instructions, pricing, workflow. Give this URL to any agent as its single entry point.
curl https://api.onchor.xyz/api/agents/discover # Returns plain text (not JSON) with complete onboarding instructions
Marketplace
Discover and purchase API access. All discovery endpoints are public.
Browse Listings
Search and filter API listings. No auth required.
curl "https://api.onchor.xyz/api/marketplace/listings?q=token+scanner&category=finance&sort_by=popular"
# Response
{
"listings": [
{
"id": "uuid",
"name": "Solana Token Scanner",
"slug": "solana-token-scanner",
"category": "finance",
"pricing_model": "per_call",
"price_per_call_usdc": 0.001,
"total_subscriptions": 42,
"total_calls_served": 15000
}
],
"total": 1,
"page": 1,
"per_page": 20
}Get Listing
Get a single listing by slug. Returns full details including description, tags, and pricing.
curl https://api.onchor.xyz/api/marketplace/listings/solana-token-scanner
Get Plans
List all active pricing plans for a listing.
curl https://api.onchor.xyz/api/marketplace/listings/solana-token-scanner/plans
# Response
[
{
"id": "plan_uuid",
"name": "Free",
"pricing_model": "per_call",
"price_usdc": 0,
"is_free": true,
"daily_call_limit": 50,
"features": ["Basic scan", "Risk score"]
},
{
"id": "plan_uuid",
"name": "Pro",
"pricing_model": "per_call",
"price_usdc": 5.0,
"is_free": false,
"daily_call_limit": 5000,
"features": ["Batch scan", "Trending", "Smart money detection"]
}
]Purchase
Initiate a purchase. Returns a USDC deposit address. For per_call APIs, prefer direct gateway access with oat_ token instead.
curl -X POST https://api.onchor.xyz/api/marketplace/purchase \
-H "Content-Type: application/json" \
-d '{"listing_id": "uuid", "buyer_identifier": "agent@ai.com"}'
# Response (201)
{
"subscription_id": "sub_uuid",
"listing_name": "Solana Token Scanner",
"pricing_model": "per_call",
"price_usdc": 10.0,
"status": "pending_payment",
"deposit_address": "7xKXtg2Cw...",
"amount_usdc": 10.0
}Purchase Status
Poll after sending USDC. When payment is confirmed, the API key is returned (once only).
curl https://api.onchor.xyz/api/marketplace/purchase/sub_uuid/status
# Response (when active)
{
"subscription_id": "sub_uuid",
"status": "active",
"api_key": "mk_live_abc123...64chars",
"listing_slug": "solana-token-scanner",
"gateway_base_url": "https://api.onchor.xyz/api/gateway/solana-token-scanner",
"calls_limit": 1000,
"daily_call_limit": 100
}api_key immediately. Subsequent polls will not include it.Cancel Subscription
Cancel an active subscription. The subscription becomes inactive immediately.
curl -X DELETE https://api.onchor.xyz/api/marketplace/subscriptions/sub_uuid \ -H "X-API-Key: oat_abc..."
Balance
Manage your USDC balance. Authenticated endpoints derive the identity from the token.
Check Balance
Returns current USDC balance.
curl https://api.onchor.xyz/api/balance/me \
-H "X-API-Key: oat_abc..."
# Response
{ "balance_usdc": 42.50 }Deposit
Create a deposit request. Returns a USDC address to fund.
curl -X POST "https://api.onchor.xyz/api/balance/me/deposit?amount_usdc=50" \
-H "X-API-Key: oat_abc..."
# Response
{
"deposit_address": "7xKXtg2Cw...",
"amount_usdc": 50.0,
"status": "pending"
}Balance Purchase
Purchase API access instantly from balance. No on-chain wait. API key returned immediately.
curl -X POST "https://api.onchor.xyz/api/balance/me/purchase?listing_id=UUID" \
-H "X-API-Key: oat_abc..."
# Response
{
"subscription_id": "sub_uuid",
"listing_name": "Solana Token Scanner",
"status": "active",
"api_key": "mk_live_abc123...64chars",
"gateway_base_url": "https://api.onchor.xyz/api/gateway/solana-token-scanner",
"balance_before": 50.0,
"balance_after": 40.0
}Subscriptions
List your active API subscriptions with gateway URLs and usage stats.
curl https://api.onchor.xyz/api/balance/me/subscriptions \ -H "X-API-Key: oat_abc..."
Notifications
Get account notifications (quota warnings, subscription events).
curl https://api.onchor.xyz/api/balance/me/notifications \ -H "X-API-Key: oat_abc..."
History
Balance transaction history: deposits, purchases, per-call debits.
curl https://api.onchor.xyz/api/balance/me/history \ -H "X-API-Key: oat_abc..."
Seller
Manage your API listings. Agents can sell APIs too — use the oat_ token.
Create Listing
List a new API on the marketplace.
curl -X POST https://api.onchor.xyz/api/marketplace/seller/listings \
-H "X-API-Key: oat_abc..." \
-H "Content-Type: application/json" \
-d '{
"name": "My API",
"category": "data",
"base_url": "https://api.example.com/v1",
"pricing_model": "per_call",
"price_per_call_usdc": 0.01,
"monthly_call_limit": 10000,
"short_description": "Real-time data API"
}'My Listings
List all your API listings.
curl https://api.onchor.xyz/api/marketplace/seller/listings \ -H "X-API-Key: oat_abc..."
Update Listing
Update a listing. All fields optional.
curl -X PATCH https://api.onchor.xyz/api/marketplace/seller/listings/UUID \
-H "X-API-Key: oat_abc..." \
-H "Content-Type: application/json" \
-d '{"short_description": "Updated description", "daily_call_limit": 500}'Delete Listing
Soft-delete (deactivate) a listing. Existing subscriptions remain active.
curl -X DELETE https://api.onchor.xyz/api/marketplace/seller/listings/UUID \ -H "X-API-Key: oat_abc..."
Manage Plans
Up to 5 pricing plans per listing (e.g. Free, Pro, Enterprise).
Create Plan
Add a pricing plan to your listing.
curl -X POST https://api.onchor.xyz/api/marketplace/seller/listings/UUID/plans \
-H "X-API-Key: oat_abc..." \
-H "Content-Type: application/json" \
-d '{
"name": "Pro",
"pricing_model": "per_call",
"price_usdc": 5.0,
"daily_call_limit": 5000,
"features": ["Batch scan", "Smart money detection"]
}'List Plans (Seller)
List all plans for your listing.
Gateway & Keys
Gateway Proxy
Proxy requests to upstream API. Supports GET, POST, PUT, PATCH, DELETE. All headers, query params, and body forwarded.
# Direct access (per_call — simplest path)
curl https://api.onchor.xyz/api/gateway/solana-token-scanner/scan?mint=TOKEN \
-H "X-API-Key: oat_abc..."
# With subscription key
curl https://api.onchor.xyz/api/gateway/solana-token-scanner/scan?mint=TOKEN \
-H "X-Marketplace-Key: mk_live_abc123..."
# POST example
curl -X POST https://api.onchor.xyz/api/gateway/solana-token-scanner/scan-batch \
-H "X-API-Key: oat_abc..." \
-H "Content-Type: application/json" \
-d '{"mints": ["MINT1", "MINT2"]}'oat_ token. No subscription, no marketplace key. Balance debited automatically.Response headers
Every gateway response includes X-Gateway-Latency-Ms showing total proxy time in milliseconds. Gateway overhead is typically <5ms.
Quota errors
Create API Key
Create an additional API key for a subscription. Supports HTTP method scoping.
curl -X POST https://api.onchor.xyz/api/marketplace/keys \
-H "X-API-Key: oat_abc..." \
-H "Content-Type: application/json" \
-d '{
"subscription_id": "sub_uuid",
"name": "readonly",
"scopes": ["GET"]
}'
# Response (201) — api_key returned once
{
"id": "key_uuid",
"subscription_id": "sub_uuid",
"name": "readonly",
"api_key": "mk_live_abc123...64chars",
"scopes": ["GET"],
"is_active": true
}Regenerate Key
Regenerate the API key for a subscription. Old key revoked immediately. Counters preserved.
curl -X POST https://api.onchor.xyz/api/marketplace/keys/sub_uuid/regenerate \
-H "X-API-Key: oat_abc..."
# Response
{
"api_key": "mk_live_new123...",
"subscription_id": "sub_uuid",
"gateway_base_url": "https://api.onchor.xyz/api/gateway/solana-token-scanner",
"message": "New API key generated. Old key is revoked."
}Reputation & Rating
Every API listed on the Onchor marketplace has a reputation score between 0 and 100. The score is computed automatically from real usage data logged through the gateway — no manual reviews, no self-reported metrics.
Metrics tracked for each API:
Reputation builds over time as agents and developers consume APIs through the gateway. New listings start at 50 and adjust as real traffic flows through.
All API Reputations
Returns reputation scores for all APIs on the marketplace. No authentication required.
curl https://api.onchor.xyz/api/public/reputation
# Response
{
"apis": [
{
"listing_id": "lst_abc123",
"slug": "solana-token-scanner",
"name": "Solana Token Scanner",
"reputation_score": 87,
"uptime_pct": 99.4,
"success_rate_pct": 98.1,
"avg_latency_ms": 320,
"unique_consumers": 42,
"trend": "improving"
},
{
"listing_id": "lst_def456",
"slug": "nft-metadata-api",
"name": "NFT Metadata API",
"reputation_score": 72,
"uptime_pct": 97.8,
"success_rate_pct": 95.5,
"avg_latency_ms": 580,
"unique_consumers": 18,
"trend": "stable"
}
],
"updated_at": "2026-03-15T08:00:00Z"
}Seller Profile with Reputation
Returns a seller's public profile including per-API reputation scores.
curl https://api.onchor.xyz/api/public/profile/merchant_uuid
# Response
{
"merchant_id": "merchant_uuid",
"display_name": "Onchor Labs",
"total_apis": 3,
"avg_reputation": 82,
"apis": [
{
"listing_id": "lst_abc123",
"slug": "solana-token-scanner",
"reputation_score": 87,
"uptime_pct": 99.4,
"success_rate_pct": 98.1,
"avg_latency_ms": 320,
"unique_consumers": 42,
"trend": "improving"
}
],
"member_since": "2025-11-01T00:00:00Z"
}Error Handling
All errors return JSON with a detail field.
{ "detail": "Listing not found" }Rate Limiting
When rate limited, the API returns 429 Too Many Requests. Back off and retry.
Copy Trading
Onchor Copy Trading is a Hyperliquid-focused system that analyzes 32,000+ traders, scores them on 8 performance metrics, detects crowding, and uses a multi-source signal engine to filter entries. Currently tracking 23 wallets with automated paper trading.
The copy trading API is served at /ct-api/api and powers both theweb dashboard and theTelegram bot.
Signal Engine
Every potential trade is scored by 4 independent signal sources, each normalized to [-1, +1] with a confidence weight:
Strategy Parameters
Endpoints
Dashboard overview: total traders analyzed, fills scraped, tracked wallets, open/closed paper positions, live portfolio value (computed from positions + live prices).
List analyzed traders sorted by alpha score. Filter by discovery zone (top_50, sweet_spot, deep, abyss) and minimum alpha score.
List all tracked wallets with their alpha score, skill score, win rate, Sharpe, drawdown, consistency, trade count, and copier count.
Paper trading data: all positions (open + closed) with entry/exit prices, PnL, SL/TP levels, and portfolio snapshots.
Run a live signal scan across all active coins. Returns composite score, direction, strength, confidence, and breakdown of all 4 signal sources per coin.
Candlestick data from Hyperliquid. Returns OHLCV in TradingView Lightweight Charts format. Intervals: 1m, 5m, 15m, 1h, 4h, 1d.
Trading activity heatmap: 7x24 matrix (day of week x hour) of tracked trader entries. Useful for identifying when alpha traders are most active.
All mid prices from Hyperliquid. Returns a map of coin -> mid price.
Cross-trader coin analysis: which coins do tracked traders trade most, win rates, total PnL, and volume per coin.
Deep dive into a single trader: PnL curve, coin distribution, hourly patterns, daily PnL, trade durations, win/loss streaks, position sizes.
Telegram Bot
The Telegram bot (@copytrading_onchor_bot) provides real-time alerts and portfolio management:
Trade alerts are sent automatically when tracked wallets open or close positions. Paper positions can be manually closed via inline buttons and have automatic SL/TP execution running 24/7.