API Documentation
Build on Kayxa with our REST API and WebSocket feeds. Create trading bots, custom dashboards, and integrations.
Authentication
Pass API key via <1>X-Api-Key</1> header.
Base URL
/api/v1
API Key Scopes
Markets
Browse, search, and fetch market data including prices, order books, holders, and comments.
Trading
Execute trades, get quotes, manage limit orders, view P&L, and split/merge positions.
Account
Balance management, authentication, and user profile.
Withdrawals
Create, track, and cancel withdrawal requests across multiple rails.
Referral
Apply referral codes, check status, and view referral earnings.
Compliance
Policy acceptance, risk disclosure status, and regulatory checks.
Activity Feed
Global trade feed and top trades by notional USD with time windows.
Real-Time
WebSocket subscriptions and Server-Sent Events for live data.
Rate Limits
Standard Tier
120 requests/minute
Premium Tier
600 requests/minute
Auth Endpoints
10 requests/minute
Rate limit headers (<1>X-RateLimit-Remaining</1>) are included in all API responses.
WebSocket Quick Start
// Connect to WebSocket
const ws = new WebSocket('wss://your-api-host/ws');
// Subscribe to a market
ws.send(JSON.stringify({
type: 'subscribe',
channel: 'market:<address>'
}));
// Subscribe to all trades
ws.send(JSON.stringify({
type: 'subscribe',
channel: 'global:trades'
}));
// Ping/pong keepalive
ws.send(JSON.stringify({ type: 'ping' }));Available channels: <1>market:<address></1>, <2>global:markets</2>, <3>global:trades</3>
Kayxa REST and WebSocket API Documentation
The Kayxa API provides programmatic access to all market data, trade execution, account balances, and position information on the platform. Developers can integrate Kayxa prediction market data into their own applications, build trading bots, create analytics dashboards, and automate strategies using the REST and WebSocket APIs. All API endpoints are rate-limited and require authentication via API keys generated in your account settings.
The REST API supports market listing, individual market lookup by slug or contract address, real-time price data, order book snapshots, and historical trade logs. Authentication is handled via bearer tokens in the Authorization header. All responses are JSON-formatted. Markets are identified by their on-chain contract address on Polygon or by the slug format asset-updown-timeframe-timestamp. The API supports GET requests for data retrieval and POST requests for trade execution when using a valid API key with trading permissions.
The WebSocket API provides real-time streaming data for market price changes, trade events, and order book updates. Connect to the WebSocket endpoint and subscribe to specific market channels or the global trades feed to receive low-latency updates as they happen. WebSocket connections support ping/pong keepalive to maintain persistent connections. Market data is pushed whenever a trade occurs, a market resolves, or a new market is created by the rolling market worker. Use the global:markets channel to receive notifications when new 15-minute markets are created for BTC, ETH, SOL, XRP, DOGE, BNB, HYPE, and MSTR.
Kayxa is built on Polygon blockchain with smart contracts written in Solidity. The BinaryMarket.sol contract handles individual market logic including buy, resolve, and claim functions. The KayxaCore.sol factory contract manages market creation and admin credit operations. All on-chain transactions are executed by the admin wallet so API users never need to manage private keys or pay gas fees. Balances are tracked off-chain in USDC and settled on-chain during deposit and withdrawal operations. Chainlink oracle price feeds on Polygon mainnet power automated market resolution for all crypto price prediction markets.