Skip to main content
Endpoints for order placement, cancellation, and status queries. All mutating operations follow the create → sign → submit pattern.
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 of typedData payloads that must be signed before submitting to POST /order.
POST /v1/perps/createOrder

Flow

  1. Call this endpoint with order parameters
  2. Sign each typedData in the response array
  3. Submit all signatures to POST /order
  4. Query GET /order/{id} to check status

Request Body

Market order with TP/SL:
{
  "dex": "hyperliquid",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "symbol": "BTC",
  "side": "BUY",
  "type": "MARKET",
  "size": "0.1",
  "price": "95500.00",
  "leverage": 10,
  "reduceOnly": false,
  "takeProfit": {
    "triggerPrice": "100000.00"
  },
  "stopLoss": {
    "triggerPrice": "90000.00",
    "limitPrice": "89800.00"
  }
}
Simple limit order:
{
  "dex": "hyperliquid",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "symbol": "ETH",
  "side": "BUY",
  "type": "LIMIT",
  "size": "1.0",
  "price": "3150.00",
  "reduceOnly": false,
  "timeInForce": "GTC"
}

Request Fields

FieldTypeRequiredDescription
dexstringYesDEX identifier
addressstringYesUser’s wallet address (account owner)
signerAddressstringNoAddress that will sign the payloads. Required for USER_AGENT mode (set to agent address). Defaults to address.
symbolstringYesTrading symbol
sidestringYesBUY or SELL
typestringYesMARKET or LIMIT
sizestringYesOrder size
pricestringYesLimit price (LIMIT) or slippage limit (MARKET)
leverageintegerNoLeverage to set (generates updateLeverage action if different)
reduceOnlybooleanNoOnly reduce position (default false)
timeInForcestringNoGTC (default), IOC, POST_ONLY, GTT
expiresAtstringNoISO 8601 expiry for GTT orders
takeProfitTriggerOrderInputNoTake profit trigger
stopLossTriggerOrderInputNoStop loss trigger
TriggerOrderInput:
FieldTypeRequiredDescription
triggerPricestringYesPrice at which the order triggers
limitPricestringNoExecution limit price (market order if omitted)

Response 201

{
  "actions": [
    {
      "action": "updateLeverage",
      "description": "Set BTC leverage to 10x",
      "typedData": { "..." }
    },
    {
      "action": "placeOrder",
      "description": "Place BUY 0.1 BTC @ 95500.00",
      "typedData": {
        "domain": {
          "name": "HyperliquidSignTransaction",
          "version": "1",
          "chainId": 42161,
          "verifyingContract": "0x0000000000000000000000000000000000000000"
        },
        "types": {
          "EIP712Domain": [
            { "name": "name", "type": "string" },
            { "name": "version", "type": "string" },
            { "name": "chainId", "type": "uint256" },
            { "name": "verifyingContract", "type": "address" }
          ]
        },
        "primaryType": "Agent",
        "message": {
          "source": "a",
          "connectionId": "0x..."
        }
      }
    },
    {
      "action": "placeTriggerOrder",
      "description": "Take profit at 100000.00",
      "typedData": { "..." }
    },
    {
      "action": "placeTriggerOrder",
      "description": "Stop loss at 90000.00 (limit 89800.00)",
      "typedData": { "..." }
    }
  ]
}

Action Types

ActionWhen Generated
updateLeverageIf leverage differs from current position leverage
placeOrderAlways (the main order)
placeTriggerOrderOnce per TP/SL specified

Response 400

Validation error. SDK: createOrder(), perps.placeOrder()

POST /cancelOrder

Build cancel payloads for signing.
POST /v1/perps/cancelOrder

Flow

  1. Call this endpoint with order ID(s) to cancel
  2. Sign each typedData in the response array
  3. Submit all signatures to POST /order

Request Body

{
  "dex": "hyperliquid",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "ids": ["0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d", "12345678"]
}
FieldTypeRequiredDescription
dexstringYesDEX identifier
addressstringYesUser’s wallet address (account owner)
signerAddressstringNoAddress that will sign the payloads. Required for USER_AGENT mode. Defaults to address.
idsstring[]YesOrder IDs to cancel (orderId from the submit response)

Response 201

{
  "actions": [
    {
      "action": "cancelOrder",
      "description": "Cancel order 0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
      "typedData": { "..." }
    },
    {
      "action": "cancelOrder",
      "description": "Cancel order 12345678",
      "typedData": { "..." }
    }
  ]
}

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.
POST /v1/perps/order

Request Body

{
  "dex": "hyperliquid",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "actions": [
    {
      "action": "updateLeverage",
      "typedData": { "...typedData from createOrder action 1..." },
      "signature": "0xabcd1234..."
    },
    {
      "action": "placeOrder",
      "typedData": { "...typedData from createOrder action 2..." },
      "signature": "0xefgh5678..."
    }
  ]
}
FieldTypeRequiredDescription
dexstringYesDEX identifier
addressstringYesUser’s wallet address (account owner)
signerAddressstringNoAddress that signed the payloads. Required for USER_AGENT mode. Defaults to address.
actionsSignedOrderAction[]YesSigned actions from /createOrder or /cancelOrder
Each SignedOrderAction:
FieldTypeRequiredDescription
actionstringYesAction type from the create response
typedDataobjectYesOriginal typedData from /createOrder or /cancelOrder
signaturestringYesUser’s or agent’s signature of the typedData

Response 202

{
  "results": [
    {
      "action": "updateLeverage",
      "success": true
    },
    {
      "action": "placeOrder",
      "success": true,
      "orderId": "12345678"
    },
    {
      "action": "placeTriggerOrder",
      "success": true,
      "orderId": "87654321"
    }
  ]
}
Each OrderActionResult:
FieldTypeDescription
actionstringupdateLeverage, placeOrder, placeTriggerOrder, or cancelOrder
successbooleanWhether the action was accepted
orderIdstringOrder ID (for placeOrder and placeTriggerOrder)
errorstringError 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.
GET /v1/perps/order/12345678?dex=hyperliquid&address=0x1234...

Parameters

NameInTypeRequiredDescription
idpathstringYesOrder ID (orderId from the submit response)
dexquerystringYesDEX identifier
addressquerystringYesUser’s wallet address
x-lifi-api-keyheaderstringYesAPI key
x-lifi-integratorheaderstringNoIntegrator identifier

Response 200

{
  "orderId": "12345678",
  "symbol": "BTC",
  "side": "BUY",
  "type": "MARKET",
  "price": "95500.00",
  "originalSize": "0.1",
  "remainingSize": "0.0",
  "filledSize": "0.1",
  "timeInForce": "GTC",
  "reduceOnly": false,
  "isTrigger": false,
  "status": "FILLED",
  "averagePrice": "95050.00",
  "createdAt": "2025-01-15T10:30:00Z",
  "updatedAt": "2025-01-15T10:30:01Z"
}

Order Schema

FieldTypeDescription
orderIdstringOrder ID
symbolstringTrading symbol
sidestringBUY or SELL
typestringMARKET or LIMIT
pricestringLimit price or execution price
originalSizestringOriginal order size
remainingSizestringUnfilled quantity
filledSizestringFilled quantity
timeInForcestringGTC, IOC, POST_ONLY, GTT
expiresAtstringExpiration time (GTT orders)
reduceOnlybooleanWhether reduce-only
isTriggerbooleanWhether this is a trigger order (TP/SL)
triggerPricestringTrigger activation price
triggerConditionstringABOVE or BELOW
statusstringOrder status (see below)
averagePricestringAverage fill price
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last update timestamp

Order Status Values

StatusDescription
PENDINGSubmitted, not yet on orderbook
OPENResting on orderbook
PARTIALLY_FILLEDSome quantity filled
FILLEDFully filled
CANCELLEDCancelled by user
REJECTEDRejected by DEX
EXPIREDGTT order expired
TRIGGEREDTrigger order activated (TP/SL)

Response 404

{
  "code": 2024,
  "tool": "hyperliquid",
  "message": "Order not found"
}
SDK: getOrder()