Skip to content

Latest commit

 

History

History
146 lines (110 loc) · 5.88 KB

File metadata and controls

146 lines (110 loc) · 5.88 KB

Limitless Exchange API Overview

Introduction

The Limitless Exchange API provides programmatic access to a decentralized prediction market platform built on the Base blockchain (Chain ID: 8453). The API enables trading, portfolio management, and real-time market data access.

Official SDKs are the preferred way to interact with this API. Python: limitless-sdk (pip install limitless-sdk). TypeScript: @limitless-exchange/sdk (npm install @limitless-exchange/sdk). Both handle authentication, EIP-712 signing, and venue caching automatically.

Base URL

Production: https://api.limitless.exchange
WebSocket: wss://ws.limitless.exchange

API Categories

Category Description Authentication
Authentication Wallet-based login/logout None
Markets Browse and search prediction markets Optional
Trading Historical prices, orderbook, market events Optional
Orders Create and manage buy/sell orders Required
Portfolio User positions, trades, and rewards Required
Claiming & Redeeming Redeem winning positions on-chain N/A (on-chain)

Key Concepts

Market Types

  1. CLOB Markets (single-clob): Central Limit Order Book markets where users place limit orders
  2. AMM Markets: Automated Market Maker markets with liquidity pools
  3. NegRisk Groups (group-negrisk): Grouped markets with multiple related outcomes sharing collateral

Trading Mechanics

  • YES/NO Tokens: Each market has two outcome tokens (positionIds[0] = YES, positionIds[1] = NO)
  • Prices: Expressed as decimals (0.01-0.99), representing probability
  • USDC Collateral: All trades settled in USDC (6 decimals)
  • EIP-712 Signing: Orders require cryptographic signatures
  • Checksummed Addresses: All addresses must be EIP-55 checksummed

Venue System (CRITICAL for Trading)

Each CLOB market has a venue object containing contract addresses. You must:

  1. Fetch market data via GET /markets/{slug} to get venue.exchange and venue.adapter
  2. Use venue.exchange as the verifyingContract in EIP-712 order signing
  3. Cache venue data per market (it's static and doesn't change)

See Smart Contract Addresses for the complete list of trading venue contracts.

Required Token Approvals

Order Type Market Type Approve To
BUY All CLOB USDC → venue.exchange
SELL Simple CLOB CT → venue.exchange
SELL NegRisk/Grouped CT → venue.exchange AND venue.adapter

Authentication Methods

Method Header Status
API Key X-API-Key: lmts_... Required for programmatic access
Cookie Session Cookie: limitless_session=... Deprecated (removal imminent)

DEPRECATION NOTICE: Cookie-based session authentication is deprecated and will be removed within weeks. Migrate to API keys immediately. See Authentication Guide for details.

API Key (Recommended)

Generate an API key via the Limitless Exchange UI (profile menu → Api keys) and include it in all requests:

curl -H "X-API-Key: lmts_your_key_here" https://api.limitless.exchange/markets

Quick Reference

Endpoint Summary

Method Endpoint Description
GET /auth/signing-message Get nonce for authentication
POST /auth/login Authenticate with wallet signature
POST /auth/logout End session
GET /markets/active Browse active markets
GET /markets/{slug} Get market details
GET /markets/{slug}/orderbook Get orderbook
POST /orders Create signed order
DELETE /orders/{orderId} Cancel order
GET /portfolio/positions Get user positions
GET /portfolio/trades Get trade history

Documentation Structure

docs/
├── overview.md              # This file
├── contracts.md             # Smart contract addresses
├── endpoints/
│   ├── authentication.md    # Auth endpoints
│   ├── markets.md           # Market browsing/search
│   ├── trading.md           # Trading data endpoints
│   ├── orders.md            # Order management
│   └── portfolio.md         # Portfolio & history
├── schemas/
│   ├── market.md            # Market data structures
│   ├── order.md             # Order data structures
│   └── portfolio.md         # Portfolio data structures
├── quickstart/
│   ├── python.md            # Python implementation
│   ├── java.md              # Java implementation
│   └── typescript.md        # TypeScript implementation
├── guides/
│   ├── authentication.md    # Auth flow guide
│   ├── placing-orders.md    # Order creation guide
│   ├── claiming-redeeming.md # Claiming & redeeming positions
│   ├── websockets.md        # Real-time data guide
│   └── faq.md               # Common questions
└── user-questions/          # Real developer issues
    ├── smart-wallet-signer-mismatch.md
    ├── signature-verification-failed.md
    ├── order-not-filling.md
    └── invalid-token-id.md

Rate Limits

The API implements rate limiting. Check response headers for current limits.

Error Handling

Standard HTTP status codes:

  • 200: Success
  • 400: Bad request (invalid parameters)
  • 401: Unauthorized (authentication required)
  • 404: Resource not found
  • 500: Server error

Error responses include a message field with details.

Support