API Reference
Welcome to the Lidian API reference! This section provides comprehensive documentation for all API endpoints, data types, and integration examples.Base URLs
https://api.lidian.finance
WebSocket URLs
wss://ws.lidian.finance
Authentication
The API supports two authentication methods:1. API Key Authentication
For server-to-server communication:2. SIWE Authentication
For wallet-based authentication using Sign-In with Ethereum:Core API Endpoints
Quote Flow
- Create Quote Request (
POST /api/v1/quote-requests) - Submit swap parameters - Get Quotes (
GET /api/v1/quotes) - Retrieve competitive quotes from LPs - Accept Quote (
POST /api/v1/quotes/:id/accept) - Select best quote - Execute Swap (
POST /api/v1/swaps) - Execute the swap with signature
Order Management
- List Orders (
GET /api/v1/orders) - Get user’s orders with filtering - Get Order (
GET /api/v1/orders/:id) - Detailed order information
Public Data
- Public Orders (
GET /api/public/orders) - Recent protocol activity - Recent Quotes (
GET /api/public/quotes/recent) - Latest quotes
Real-time Updates
- Server-Sent Events (
GET /api/public/stream) - Live protocol updates - WebSocket Support (
GET /ws) - Real-time streaming (optional)
Supported Networks
Refer to Developers > Chains and Developers > Tokens for up-to-date network and token support details.Rate Limits
| Authentication | Requests/Minute | Concurrent Streams |
|---|---|---|
| API Key | 100 | 3 SSE / 3 WebSocket |
| SIWE (Wallet) | 60 | 3 SSE / 3 WebSocket |
Error Handling
Standard Error Format
Common Error Codes
INVALID_TOKEN- Unsupported token addressINVALID_CHAIN- Unsupported chainINSUFFICIENT_BALANCE- Not enough tokens for swapQUOTE_EXPIRED- Quote has expiredORDER_NOT_FOUND- Order does not existUNAUTHORIZED- Invalid authenticationRATE_LIMITED- Too many requests

