Skip to main content

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

  1. Create Quote Request (POST /api/v1/quote-requests) - Submit swap parameters
  2. Get Quotes (GET /api/v1/quotes) - Retrieve competitive quotes from LPs
  3. Accept Quote (POST /api/v1/quotes/:id/accept) - Select best quote
  4. 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

Error Handling

Standard Error Format

Common Error Codes

  • INVALID_TOKEN - Unsupported token address
  • INVALID_CHAIN - Unsupported chain
  • INSUFFICIENT_BALANCE - Not enough tokens for swap
  • QUOTE_EXPIRED - Quote has expired
  • ORDER_NOT_FOUND - Order does not exist
  • UNAUTHORIZED - Invalid authentication
  • RATE_LIMITED - Too many requests