Skip to main content
The LI.FI Perps API provides REST endpoints for perpetual futures trading across multiple DEXes.

Base URLs

EnvironmentURL
Developmenthttps://develop.li.quest/v1/perps

Authentication

All requests require an API key. Register at the LI.FI Partner Portal to get your API key and integrator name. Pass the following headers with every request:
x-lifi-api-key: your-api-key
x-lifi-integrator: your-app-name
HeaderRequiredDescription
x-lifi-api-keyYesAPI key provided by LI.FI (enforced at infrastructure level)
x-lifi-integratorNoYour integrator identifier for tracking and analytics
In the SDK, pass these as configuration options:
import { createPerpsClient } from '@lifi/perps-sdk';

const client = createPerpsClient({
  integrator: 'your-app-name',
  apiKey: 'your-api-key',
});
Never expose your x-lifi-api-key in client-side code (browser JavaScript, frontend bundles). The key is visible in browser developer tools and network tabs. For frontend integrations, proxy API calls through your backend to keep the key secret.

Request Format

  • All POST request bodies use application/json
  • Query parameters are used for GET requests
  • String numeric values (prices, sizes, amounts) avoid floating-point precision issues

Response Format

Successful responses return JSON with appropriate HTTP status codes:
StatusMeaning
200Success — response body contains requested data
201Created — resource created and ready for next step
202Accepted — operation submitted for asynchronous processing

Response Headers

All responses include the x-lifi-requestid header for request correlation and debugging:
x-lifi-requestid: req_abc123xyz789
Include the x-lifi-requestid value when reporting issues to LI.FI support. This ID is logged server-side and allows us to trace your specific request.

Error Format

All errors follow the same structure with numeric error codes (2000+ range):
{
  "code": 2002,
  "tool": "hyperliquid",
  "message": "Invalid request parameters"
}
FieldTypeDescription
codeintegerNumeric error code (see Error Codes)
toolstringThe DEX that generated the error
messagestringHuman-readable error description

HTTP Error Status Codes

StatusDescription
400Validation error — invalid parameters
401Authentication error — invalid signature
403Forbidden — agent not authorized
404Not found — market, order, or resource does not exist
408Timeout — request or upstream operation timed out
409Conflict — nonce already used
410Gone — nonce expired, retry the operation
422Unprocessable — insufficient margin or balance
424Failed dependency — upstream DEX error

Rate Limits

Rate limits are applied per API key. Contact LI.FI support for rate limit details and higher tier access.

Endpoints Overview

Market Data (Public)

MethodPathDescription
GET/dexesList DEX platforms
GET/marketsList all markets (optional symbol filter)
GET/pricesGet all mid prices
GET/ohlcv/{symbol}Get OHLCV chart data
GET/orderbook/{symbol}Get orderbook snapshot

Authorization

MethodPathDescription
POST/createAuthorizationBuild authorization payloads
POST/authorizationSubmit signed authorizations

Withdrawal

MethodPathDescription
POST/createWithdrawalBuild withdrawal payload
POST/withdrawalSubmit signed withdrawal

Account

MethodPathDescription
GET/accountGet account summary
GET/historyGet order history

Trading

MethodPathDescription
POST/createOrderBuild order payloads
POST/cancelOrderBuild cancel payloads
POST/orderSubmit signed order/cancel
GET/order/{id}Get order details