Skip to main content

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 install @limitless-exchange/sdk

Quick Start

1

Configure environment variables

Create a .env file in your project root (and add it to .gitignore):
LIMITLESS_API_KEY=lmts_your_api_key_here
PRIVATE_KEY=0xYourPrivateKeyHere
The SDK automatically reads LIMITLESS_API_KEY from the environment if no apiKey is passed to the constructor.
2

Initialize the HTTP client

import { HttpClient } from '@limitless-exchange/sdk';

const httpClient = new HttpClient({
  baseURL: 'https://api.limitless.exchange',
});
3

Fetch active markets

import { MarketFetcher } from '@limitless-exchange/sdk';

const marketFetcher = new MarketFetcher(httpClient);

const markets = await marketFetcher.getActiveMarkets({
  limit: 10,
  sortBy: 'newest',
});

for (const market of markets) {
  console.log(market.slug, market.title);
}
4

Authenticate for trading

For operations that require authentication (placing orders, fetching portfolio), supply your API key and wallet:
import { ethers } from 'ethers';

const httpClient = new HttpClient({
  baseURL: 'https://api.limitless.exchange',
  apiKey: process.env.LIMITLESS_API_KEY,
});

const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!);

Environment Variables

VariableRequiredDescription
LIMITLESS_API_KEYFor authenticated endpointsAuto-loaded by the SDK. Generate at limitless.exchange under profile menu.
PRIVATE_KEYFor order signingEthereum private key used for EIP-712 order signatures. Never commit to version control.

Client constructor

The recommended entrypoint is the root Client class, which composes all domain services (markets, portfolio, orders, API tokens, partner accounts, delegated orders):
import { Client } from '@limitless-exchange/sdk';

const client = new Client({
  baseURL: 'https://api.limitless.exchange',
  apiKey: 'lmts_...',
});
For partner integrations using HMAC authentication:
const client = new Client({
  baseURL: 'https://api.limitless.exchange',
  hmacCredentials: {
    tokenId: 'your-token-id',
    secret: 'your-base64-secret',
  },
});
OptionTypeDefaultDescription
baseURLstringAPI base URL
apiKeystringprocess.env.LIMITLESS_API_KEYAPI key for authentication
hmacCredentials{ tokenId, secret }HMAC credentials for scoped API token auth (see Programmatic API)
timeoutnumber30000Request timeout in milliseconds
additionalHeadersRecord<string, string>{}Additional headers sent with every request

HttpClient (lower-level)

You can also use HttpClient directly for more control:
import { HttpClient } from '@limitless-exchange/sdk';

const httpClient = new HttpClient({
  baseURL: 'https://api.limitless.exchange',
  apiKey: 'lmts_...',
});

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.

Disclaimer

USE AT YOUR OWN RISK. This SDK and the Limitless Exchange protocol are provided as-is with no warranties. You are solely responsible for any funds used or lost. By using this SDK, you acknowledge that prediction markets involve financial risk. The Limitless Exchange is not available to users in the United States or other restricted jurisdictions. Ensure compliance with your local laws before trading.