Skip to main content
The Lighter provider exposes trading and balance operations in the actions array from GET /providers. Each action lists the signer that fulfils it and the relay that says where its signed step goes. For account setup steps (the provider’s setup array, including the account tier and account mode choices), see Setup. For full parameter schemas, see the Actions API reference.

actions

Trading actions are signed by the registered API key (PerpsSigner.SDK). Deposits are the exception — a plain L1 EVM transaction signed by the user’s wallet (documented separately, see the note below).

placeOrder

Places a new market or limit order. Attached take-profit and stop-loss wires remain part of this placeOrder step. Standalone trigger orders use the separate placeTriggerOrder action below.

Order types and time-in-force

  • price is required for every type. A MARKET order needs a slippage-bounded price.
  • timeInForce is IOC, GTC, or POST_ONLY; the default is GTC. MARKET is IOC only; any other value is a validation error. When the SDK reads an order from the venue, the venue time-in-force good_till_time is reported as GTT.
  • expiresAt applies to GTC and POST_ONLY only; IOC rejects it. The default expiry is set by the signer at now + 28 days.
  • STOP_* and TAKE_PROFIT_* types and TWAP are rejected as the main type. Use placeTriggerOrder, the bundled takeProfit / stopLoss, or placeTwapOrder.
  • Bundled take-profit / stop-loss legs cannot carry size; they are sized to the main order.
  • Each bundled leg needs type (MARKET or LIMIT) and limitPrice. See placeTriggerOrder below.
  • Minimum base and quote amounts are enforced only for POST_ONLY.
On Lighter spot markets placeOrder rejects features that only exist for perpetuals: a validation error is thrown for reduceOnly, for bundled take-profit / stop-loss legs, and for any order type other than MARKET or LIMIT.

placeTriggerOrder

Places standalone take-profit or stop-loss orders for an existing position. side is the closing side: BUY closes a short, SELL closes a long. At least one of takeProfit / stopLoss is required, and the call fails with a validation error when no position is open. Legs are reduce-only and their size is clamped to the position. Each trigger can omit size to track the full position or set a fixed base-asset size for a partial close. Each leg needs type (MARKET or LIMIT) and limitPrice. A leg without limitPrice returns a 400. The leg type and the takeProfit or stopLoss key select the venue order type: On a LIMIT leg, limitPrice is the resting limit price. On a MARKET leg, limitPrice is the worst fill price that Lighter accepts after the trigger fires. It needs a value strictly below triggerPrice on a SELL leg and strictly above it on a BUY leg. If limitPrice equals triggerPrice, the tolerance is 0% and Lighter cancels the triggered order. The backend does no slippage calculation. See Trigger Orders to calculate limitPrice from a slippage percent.

placeTwapOrder

Places a TWAP parent as an ordinary signed order with order_type = 6, rather than through a dedicated TWAP transaction type. The engine fires a market sub-order every 30 seconds until the parent’s order_expiry. durationSeconds sets the parent’s order_expiry as an absolute timestamp (now + durationSeconds * 1000) rather than the -1 default-expiry sentinel a limit order uses, and must fall within [300, 2592000] seconds (5 minutes–30 days). TWAP orders are perps-only — a spot marketId is rejected. Because the wire still requires a bounding price even though sub-orders fill at market, the parent signs the extremum in its own trade direction (max for a buy, min for a sell) so its own limit can never bind. placeTwapOrder’s result carries a submit-time transaction hash on both orderId and twapId — Lighter assigns the parent’s real order index asynchronously. That hash is not a valid cancelTwapOrder input; read the real index back from the TWAP row returned by getOrders once assigned.

cancelOrder

Cancels one or more open orders by ID. Lighter order IDs (order_index) are scoped per market, so supply the market context: pass the composite "<market_id>:<order_id>" form in ids, or set assetId to the order’s market.id. ids accepts at most 100 entries per call.

Resolving an order by id (getOrder)

getOrder() accepts a Lighter order id in one of two forms:
  • A bare order_index — the value Order.orderId carries, as streamed by the orderUpdates / fills WebSocket channels.
  • A client_order_index prefixed with client_order_index: (LIGHTER_CLIENT_ORDER_INDEX_ID_PREFIX), built from the clientOrderIndex a signed placement step returns (see WasmBlobSignedActionStep on SDK / Actions). This form resolves an order before the venue has assigned an order_index — useful right after placement. When more than one row on the account carries the same client order index, getOrder returns the active one.

cancelTwapOrder

Cancels a running TWAP parent by emitting the same signed cancel-order blob as cancelOrder, keyed by the parent’s order index, rather than through a TWAP-specific cancel transaction. twapId is the parent’s order index as a decimal string. Order indexes are scoped per market, so market supplies the disambiguating market_index.

cancelAllOrders

Cancels every open order on the account. Lighter exposes this as a first-class WASM action (SignCancelAllOrders) rather than requiring per-order cancellation.

modifyOrder

Modifies one or more existing orders in-place — a Lighter modify transaction replaces the resting order wholesale.

updateLeverage

Changes the leverage and/or margin mode (cross / isolated) for a market. leverage is at least 1 and may carry up to 2 decimal places, as Provider.leveragePrecision advertises.

updatePositionMargin

Adds or removes margin on an isolated position. Use this to adjust liquidation price without changing the position size.

updateAssetCollateral

Opts a single spot asset in or out of the account’s cross-margin collateral pool. Valid only within a Unified Trading Account (accountMode = unifiedTradingAccount); on a Simple account the per-asset collateral flag does not exist and the action is rejected. Describes an L2UpdateAccountAssetConfig (tx type 42) WASM blob signed by the API key and relayed through /sendTx. Idempotent — a no-op when the asset is already in the requested state.

sendAsset

Moves the deployment collateral between the account’s perpetual and spot balances — USDC on lighter, USDG on lighter-rh. This is a same-account route transfer, not a withdrawal. sourceDex and destinationDex are perps and spot.

revokeIntegrator

Revokes the integrator approval that approveIntegrator creates. It is the revoke action of that setup step. Lighter treats an approval with every maximum fee and the approval expiry set to 0 as a revocation, so no L1 signature is needed. Trading through LI.FI needs a new approval before the next order.
Deposits are documented on Deposits. The user wallet authorizes the deployment-specific EVM deposit flow; resolve its chain and collateral through getDepositFlow() rather than assuming Ethereum/USDC for lighter-rh.
Withdrawals are documented on Withdrawals, including per-asset/per-route discovery and the standard versus fast settlement paths. Standard withdrawals are signed by the SDK key only. A fast withdrawal stages an internal TRANSFER that also needs one signature from the user’s wallet.

Integrator fees

placeOrder (including bundled take-profit / stop-loss), placeTriggerOrder, placeTwapOrder, and modifyOrder on Lighter carry the integrator-fee fields (integrator_account_index, integrator_taker_fee, integrator_maker_fee) in the unsigned WASM CreateOrder payload returned from /createAction. The backend sets these fields from LI.FI’s fee configuration. There is no request-body parameter for them on PlaceOrderParams, PlaceTriggerOrderParams, PlaceTwapOrderParams, or ModifyOrderParams. The SDK’s LighterSigner threads the fields through to the Go WASM SignCreateOrder binding. A non-zero fee requires the approveIntegrator setup step; an account that has not approved gets a setup-required error and must re-run checkSetup(). Submitted (signed) payloads are validated on /executeAction against the values issued at /createAction via a generic payload-hash check; the integrator-fee fields are part of the hashed payload like any other field.

Internal-only actions

The following action types exist in the Lighter provider’s internal registry but are deliberately not surfaced via GET /providers. They are reachable only through internal dispatch (e.g. the fast-withdrawal rewrite) and cannot be invoked directly through the public action API:

Margin modes

Each market carries a margin constraint, sourced from market_margin_mode in its market_config (on orderBookDetails): The margin mode of a position is set through marginMode on placeOrder or updateLeverage. Omitting marginMode defaults to CROSS, which is rejected on isolated-only markets; pass ISOLATED there. A leverage step carrying marginMode is added to placeOrder only when leverage is supplied.