These endpoints are intended to be used via
@lifi/perps-sdk. The typed data signing and submission flow is complex and best handled by the SDK.POST /createOrder
Build order payloads for signing. Returns an array oftypedData payloads that must be signed before submitting to POST /order.
Flow
- Call this endpoint with order parameters
- Sign each
typedDatain the response array - Submit all signatures to
POST /order - Query
GET /order/{id}to check status
Request Body
Market order with TP/SL:Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
dex | string | Yes | DEX identifier |
address | string | Yes | User’s wallet address (account owner) |
signerAddress | string | No | Address that will sign the payloads. Required for USER_AGENT mode (set to agent address). Defaults to address. |
symbol | string | Yes | Trading symbol |
side | string | Yes | BUY or SELL |
type | string | Yes | MARKET or LIMIT |
size | string | Yes | Order size |
price | string | Yes | Limit price (LIMIT) or slippage limit (MARKET) |
leverage | integer | No | Leverage to set (generates updateLeverage action if different) |
reduceOnly | boolean | No | Only reduce position (default false) |
timeInForce | string | No | GTC (default), IOC, POST_ONLY, GTT |
expiresAt | string | No | ISO 8601 expiry for GTT orders |
takeProfit | TriggerOrderInput | No | Take profit trigger |
stopLoss | TriggerOrderInput | No | Stop loss trigger |
TriggerOrderInput:
| Field | Type | Required | Description |
|---|---|---|---|
triggerPrice | string | Yes | Price at which the order triggers |
limitPrice | string | No | Execution limit price (market order if omitted) |
Response 201
Action Types
| Action | When Generated |
|---|---|
updateLeverage | If leverage differs from current position leverage |
placeOrder | Always (the main order) |
placeTriggerOrder | Once per TP/SL specified |
Response 400
Validation error.
SDK: createOrder(), perps.placeOrder()
POST /cancelOrder
Build cancel payloads for signing.Flow
- Call this endpoint with order ID(s) to cancel
- Sign each
typedDatain the response array - Submit all signatures to
POST /order
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
dex | string | Yes | DEX identifier |
address | string | Yes | User’s wallet address (account owner) |
signerAddress | string | No | Address that will sign the payloads. Required for USER_AGENT mode. Defaults to address. |
ids | string[] | Yes | Order IDs to cancel (orderId from the submit response) |
Response 201
Response 400
Validation error.
Response 404
Order not found.
SDK: cancelOrder(), perps.cancelOrders()
POST /order
Submit signed order or cancel payloads from/createOrder or /cancelOrder.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
dex | string | Yes | DEX identifier |
address | string | Yes | User’s wallet address (account owner) |
signerAddress | string | No | Address that signed the payloads. Required for USER_AGENT mode. Defaults to address. |
actions | SignedOrderAction[] | Yes | Signed actions from /createOrder or /cancelOrder |
SignedOrderAction:
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Action type from the create response |
typedData | object | Yes | Original typedData from /createOrder or /cancelOrder |
signature | string | Yes | User’s or agent’s signature of the typedData |
Response 202
OrderActionResult:
| Field | Type | Description |
|---|---|---|
action | string | updateLeverage, placeOrder, placeTriggerOrder, or cancelOrder |
success | boolean | Whether the action was accepted |
orderId | string | Order ID (for placeOrder and placeTriggerOrder) |
error | string | Error message if failed |
Response 400
Validation error.
Response 401
Authentication error (invalid signature).
Response 422
Insufficient margin for the order.
SDK: submitOrder(), perps.submitSignedOrder()
GET /order/
Get the status and details of a specific order.Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | Order ID (orderId from the submit response) |
dex | query | string | Yes | DEX identifier |
address | query | string | Yes | User’s wallet address |
x-lifi-api-key | header | string | Yes | API key |
x-lifi-integrator | header | string | No | Integrator identifier |
Response 200
Order Schema
| Field | Type | Description |
|---|---|---|
orderId | string | Order ID |
symbol | string | Trading symbol |
side | string | BUY or SELL |
type | string | MARKET or LIMIT |
price | string | Limit price or execution price |
originalSize | string | Original order size |
remainingSize | string | Unfilled quantity |
filledSize | string | Filled quantity |
timeInForce | string | GTC, IOC, POST_ONLY, GTT |
expiresAt | string | Expiration time (GTT orders) |
reduceOnly | boolean | Whether reduce-only |
isTrigger | boolean | Whether this is a trigger order (TP/SL) |
triggerPrice | string | Trigger activation price |
triggerCondition | string | ABOVE or BELOW |
status | string | Order status (see below) |
averagePrice | string | Average fill price |
createdAt | string | ISO 8601 creation timestamp |
updatedAt | string | ISO 8601 last update timestamp |
Order Status Values
| Status | Description |
|---|---|
PENDING | Submitted, not yet on orderbook |
OPEN | Resting on orderbook |
PARTIALLY_FILLED | Some quantity filled |
FILLED | Fully filled |
CANCELLED | Cancelled by user |
REJECTED | Rejected by DEX |
EXPIRED | GTT order expired |
TRIGGERED | Trigger order activated (TP/SL) |
Response 404
getOrder()