Skip to main content
All mutating operations follow the create -> sign -> execute pattern through two unified endpoints. The action field determines the operation.
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 /createAction

Build action payloads for signing. Returns an array of typedData payloads that must be signed before executing via POST /executeAction.
POST /v1/perps/createAction

Request Body

{
  "provider": "hyperliquid",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "signerAddress": "0x5678901234abcdef5678901234abcdef56789012",
  "action": "placeOrder",
  "params": {
    "asset": { "assetId": "BTC", "market": "hyperliquid" },
    "side": "BUY",
    "type": "MARKET",
    "size": "0.1",
    "price": "95500.00",
    "leverage": 10,
    "takeProfit": { "triggerPrice": "100000.00" },
    "stopLoss": { "triggerPrice": "90000.00", "limitPrice": "89800.00" }
  }
}

Request Fields

FieldTypeRequiredDescription
providerstringYesProvider identifier (e.g. hyperliquid)
addressstringYesUser’s wallet address (account owner)
signerAddressstringNoAddress that will sign the payloads. Required for USER_AGENT mode (set to agent address). Defaults to address.
actionstringYesAction type (see table below)
paramsobjectYesAction-specific parameters

Action Types

ActionDescriptionParams
placeOrderPlace a new orderPlaceOrderParams
placeTriggerOrderPlace standalone TP/SLPlaceTriggerOrderParams
cancelOrderCancel one or more ordersCancelOrderParams
modifyOrderModify existing ordersModifyOrderParams
updateLeverageChange leverage for an assetUpdateLeverageParams
updatePositionMarginAdd/remove position marginUpdatePositionMarginParams
withdrawalWithdraw fundsWithdrawalParams
approveAgentAuthorize an agent walletApproveAgentParams
approveBuilderFeeApprove builder fee{} (empty)
userSetAbstractionSet account abstraction (user-signed)SetAbstractionParams
agentSetAbstractionSet account abstraction (agent-signed)SetAbstractionParams
sendAssetTransfer assets between sub-exchangesSendAssetParams

AssetIdentity

Many action params use an asset field with the AssetIdentity type:
FieldTypeRequiredDescription
assetIdstringYesProvider’s canonical asset ID (e.g., "BTC", "xyz:PURR", "@142")
marketstringYesMarket category (e.g., "hyperliquid", "xyz", "spot")

PlaceOrderParams

FieldTypeRequiredDescription
assetAssetIdentityYesTarget asset
sidestringYesBUY or SELL
typestringNoMARKET, LIMIT, or TRIGGER_ONLY (default MARKET)
sizestringYesOrder size
pricestringNoLimit price (LIMIT) or slippage limit (MARKET)
leveragenumberNoLeverage to set (generates updateLeverage action if different)
reduceOnlybooleanNoOnly reduce position (default false)
timeInForcestringNoGTC (default), IOC, POST_ONLY, GTT
expiresAtstringNoUnix ms timestamp 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)

PlaceTriggerOrderParams

Place standalone TP/SL on an existing position.
FieldTypeRequiredDescription
assetAssetIdentityYesTarget asset
sidestringYesBUY or SELL
takeProfitTriggerOrderInputNoTake profit trigger
stopLossTriggerOrderInputNoStop loss trigger

CancelOrderParams

FieldTypeRequiredDescription
idsstring[]YesOrder IDs to cancel

ModifyOrderParams

FieldTypeRequiredDescription
modificationsModifyOrderInput[]YesArray of modifications
Each ModifyOrderInput:
FieldTypeRequiredDescription
idstringYesOrder ID to modify
pricestringNoNew limit price
sizestringNoNew order size
triggerPricestringNoNew trigger price
limitPricestringNoNew trigger limit price

UpdateLeverageParams

FieldTypeRequiredDescription
assetAssetIdentityYesTarget asset
leveragenumberYesNew leverage value

UpdatePositionMarginParams

FieldTypeRequiredDescription
assetAssetIdentityYesTarget asset
actionstringYesadd or remove
amountstringYesMargin amount

WithdrawalParams

FieldTypeRequiredDescription
destinationstringYesDestination address (e.g. Arbitrum L1 for Hyperliquid)
amountstringYesAmount to withdraw

ApproveAgentParams

FieldTypeRequiredDescription
agentAddressstringYesAgent wallet address to authorize
agentTtlMsnumberNoAgent approval TTL in milliseconds

SetAbstractionParams

FieldTypeRequiredDescription
abstractionstringNoAbstraction mode identifier

SendAssetParams

FieldTypeRequiredDescription
collateralstringYesCollateral type
sourceDexstringYesSource sub-exchange
destinationDexstringYesDestination sub-exchange
amountstringYesAmount to transfer

Response 201

{
  "actions": [
    {
      "action": "updateLeverage",
      "typedData": {
        "domain": { "..." },
        "types": { "..." },
        "primaryType": "...",
        "message": { "..." }
      }
    },
    {
      "action": "placeOrder",
      "typedData": { "..." }
    }
  ]
}
Each ActionStep:
FieldTypeDescription
actionstringAction type from the request
typedDataobjectEIP-712 typed data to sign

Response 400

Validation error.

POST /executeAction

Submit signed payloads from /createAction.
POST /v1/perps/executeAction

Request Body

{
  "provider": "hyperliquid",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "action": "placeOrder",
  "actions": [
    {
      "action": "updateLeverage",
      "typedData": { "...typedData from createAction..." },
      "signature": "0xabcd1234..."
    },
    {
      "action": "placeOrder",
      "typedData": { "...typedData from createAction..." },
      "signature": "0xefgh5678..."
    }
  ]
}
FieldTypeRequiredDescription
providerstringYesProvider identifier
addressstringYesUser’s wallet address (account owner)
signerAddressstringNoAddress that signed the payloads. Required for USER_AGENT mode. Defaults to address.
actionstringYesAction type from the create request
actionsSignedActionStep[]YesSigned actions from /createAction
Each SignedActionStep:
FieldTypeRequiredDescription
actionstringYesAction type from the create response
typedDataobjectYesOriginal typedData from /createAction
signaturestringYesSigner’s signature of the typedData

Response 202

{
  "results": [
    {
      "action": "updateLeverage",
      "success": true
    },
    {
      "action": "placeOrder",
      "success": true,
      "orderId": "12345678"
    }
  ]
}
Each ActionResult:
FieldTypeDescription
actionstringAction type
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.

GET /order/

Get the status and details of a specific order.
GET /v1/perps/order/12345678?provider=hyperliquid&address=0x1234...

Parameters

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

Response 200

{
  "orderId": "12345678",
  "asset": {
    "assetId": "BTC",
    "market": "hyperliquid",
    "displaySymbol": "BTC",
    "displayQuote": "USDC"
  },
  "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
assetAssetDisplayAsset identity (assetId, market, displaySymbol, displayQuote)
sidestringBUY or SELL
typestringMARKET, LIMIT, STOP_MARKET, STOP_LIMIT, TAKE_PROFIT_MARKET, TAKE_PROFIT_LIMIT, TRIGGER_ONLY
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 provider
EXPIREDGTT order expired
TRIGGEREDTrigger order activated (TP/SL)

Response 404

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