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

Base URLs

Production accepts requests with no API key; they use LI.FI’s default fees. Development and Staging require an API key.

Authentication

An API key is optional on Production (https://li.quest/v1/perps). Development and Staging require one. The API key identifies your integration for fees:
  • No API key — the request uses LI.FI’s default fees. This is a supported configuration.
  • A valid API key — LI.FI validates the key and applies the fees agreed for your integration.
  • An invalid API key, or a key that is not linked to an integration — the request is rejected before any fee or order is built.
Register at the LI.FI Partner Portal to get an API key. Pass the following headers:

x-lifi-integrator is an assertion, not a credential

x-lifi-integrator only checks a claim against the identity your API key already established:
  • Matches the authenticated identity — accepted.
  • Differs from the authenticated identity — ignored. The backend uses the API-key identity and does not reject the request. Send the key’s own integration id, or omit the header.
  • Sent with no API key — has no effect. Without a key there is no authenticated identity to match, so the request uses LI.FI’s default fees.
In the SDK, pass these as configuration options:
The SDK sends x-lifi-integrator only when both apiKey and integrator are set. See Getting Started for the key-only, key-plus-assertion, and no-key configurations.

Hyperliquid builder fee

Hyperliquid orders carry a LI.FI builder fee, which the trading address must approve via the approveBuilderFee setup step. Without the approval, createAction returns 409 / 2070 (SetupRequired).
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 LI.FI API calls through your backend (see Browser apps: proxy pattern). The optional integrator assertion carries no secret and does not change this requirement.

Browser apps: proxy pattern

Point apiUrl at a route on your own server. The route adds x-lifi-api-key (and optionally x-lifi-integrator) and forwards the request to LI.FI. The browser never holds the key.
Rules for the proxy:
  • Forward the request body and content-type untouched.
  • Do not cache responses.
  • Restrict the path to the routes you use; do not expose admin routes.
The proxy only covers LI.FI HTTP calls. Account reads, checkSetup, and provider WebSocket streams go from the SDK directly to the provider, so they still originate in the browser.

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:

Response Headers

Responses include the x-lifi-requestid header for request correlation and debugging. A request that fails before the server creates its request context can have no header.
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):

HTTP Error Status Codes

Rate Limits

Rate limits apply per one-minute window. The backend counts a request against the integration of its API key, so all the keys of one integration share one budget. A key with no integration counts against the key id. A request with no key counts against the hashed client IP. The default budget is 300 requests each minute. createAction and executeAction have their own default of 30 requests each minute for a request with no key, and for a key with no rateLimit of its own. Contact LI.FI support for higher limits. Every response carries x-ratelimit-limit, x-ratelimit-remaining, and x-ratelimit-reset. A 429 response also carries retry-after.

Endpoints Overview

Market Data (Public)

Account

Account-level reads (account summary, positions, orders, fills, activity, single order) are served by the SDK directly from each provider, not by LI.FI HTTP endpoints. Use @lifi/perps-sdk: getAccount, getPositions, getOrders, getFills, getActivity, getOrder. See SDK / Account.

Actions