Overview
The Limitless Exchange TypeScript SDK provides a type-safe client for interacting with both CLOB and NegRisk prediction markets. It handles authentication, EIP-712 order signing, market data fetching, portfolio tracking, and real-time WebSocket streaming out of the box.Source code and issue tracker are available on GitHub.
Installation
- npm
- yarn
- pnpm
Quick Start
Configure environment variables
Create a The SDK automatically reads
.env file in your project root (and add it to .gitignore):LIMITLESS_API_KEY from the environment if no apiKey is passed to the constructor.Environment Variables
| Variable | Required | Description |
|---|---|---|
LIMITLESS_API_KEY | Legacy auth only | Deprecated API key value, auto-loaded by the SDK. |
LMTS_TOKEN_ID | Partner/programmatic mode | Scoped token ID used for HMAC request signing. |
LMTS_TOKEN_SECRET | Partner/programmatic mode | Base64 token secret used for HMAC request signing. |
PRIVATE_KEY | For order signing | Ethereum private key used for EIP-712 order signatures. Never commit to version control. |
Client constructor
The recommended entrypoint is the rootClient class, which composes all domain services (markets, portfolio, orders, API tokens, partner accounts, delegated orders):
With
hmacCredentials set, the SDK automatically generates and sends lmts-api-key, lmts-timestamp, and lmts-signature on each request. Do not manually build HMAC headers when using the SDK client.| Option | Type | Default | Description |
|---|---|---|---|
baseURL | string | — | API base URL |
apiKey | string | process.env.LIMITLESS_API_KEY | Legacy API key authentication |
hmacCredentials | { tokenId, secret } | — | HMAC credentials for scoped API token auth (see Programmatic API) |
timeout | number | 30000 | Request timeout in milliseconds |
additionalHeaders | Record<string, string> | {} | Additional headers sent with every request |
HttpClient (lower-level)
You can also useHttpClient directly for more control:
What You Can Build
Markets
Discover markets, fetch orderbooks, and query NegRisk groups.
Market Pages
Browse markets by category with navigation, filters, and pagination.
Trading and Orders
Create GTC and FOK orders, manage approvals, and cancel orders.
Portfolio and Positions
Track CLOB and AMM positions, PnL, and trade history.
API Tokens
Derive, list, and revoke scoped HMAC tokens for partner integrations.
Partner Accounts
Create sub-accounts with server wallets or EOA verification.
Delegated Orders
Place orders on behalf of sub-accounts with server-side signing.
WebSocket Streaming
Real-time orderbook, price, position, and transaction events.
Server Wallet Redemption and Withdrawal
For partner server-wallet sub-accounts, the SDK now provides helper methods for payout settlement and treasury movement (v1.0.6+):POST /portfolio/redeem— claim resolved positionsPOST /portfolio/withdraw— transfer ERC20 funds from managed sub-accounts
apiToken auth: trading for redeem and withdrawal for withdraw.
See the full flow and scope guidance in Programmatic API.