Skip to content

Exchange endpoint

Place, cancel, and modify orders, update leverage and margin, transfer between accounts, and schedule a dead-man's switch.

Updated Nov 4, 2026Builders3 min read
On this page

All state-changing actions are sent to POST /exchange as signed payloads. The action.type field selects the operation.

Sign every request

The exchange endpoint rejects unsigned actions. Use an API wallet and never expose the master key to a client.

Asset IDs

  • Perpetuals: the index in the universe array from meta.
  • Spot: 10000 + index in spotMeta.universe.
  • Outcome markets: 20000 + index.

See assets and tick sizes for a worked example.

Place an order

POST/exchangeSignedWeight 4

Place one or more orders. Orders in one request are matched in sequence.

Request body

NameTypeRequiredDescription
ordersarrayYesOne or more order objects.
orders[].assetintegerYesAsset ID.
orders[].isBuybooleanYesTrue for buy/long, false for sell/short.
orders[].limitPxstringYesLimit price; required even for market orders (use a far price).
orders[].szstringYesSize in base units.
orders[].reduceOnlybooleanYesPrevent the order from increasing or flipping the position.
orders[].tifstringYesGtc, Ioc, or Alo.
orders[].cloidstringNo128-bit hex client order ID.
groupingstringYesna, normalTpsl, or positionTpsl.
code
curl -s https://api.nexwest.app/exchange \
  -H "Content-Type: application/json" \
  -d '{
    "action": {
      "type": "order",
      "orders": [{
        "asset": 0,
        "isBuy": true,
        "limitPx": "104000",
        "sz": "0.01",
        "reduceOnly": false,
        "tif": "Gtc"
      }],
      "grouping": "na"
    },
    "nonce": 1762732800123,
    "signature": { "r": "0x...", "s": "0x...", "v": 27 }
  }'

The response contains statuses with one entry per order: resting, filled, or error.

Cancel orders

POST/exchangeSignedWeight 2

Cancel up to 100 orders by order ID.

code
{
  "type": "cancel",
  "cancels": [{ "asset": 0, "oid": 91490942 }]
}

Use cancelByCloid when you track client order IDs. Use scheduleCancel to set a dead-man's switch: if no action is received before time, all open orders are canceled.

Modify an order

POST/exchangeSignedWeight 3

Change the price or size of a resting order without losing queue priority.

Modifying an order preserves its oid but may reset time priority if the price changes. A modify that would cross the book is rejected.

Leverage and margin

ActionFieldsNotes
updateLeverageasset, isCross, leverageLeverage is an integer; cannot exceed market max
updateIsolatedMarginasset, isBuy, ntliPositive adds margin, negative removes
usdClassTransfern, toPerpMove USDC between spot and perps
subAccountTransfersubAccountUser, usd, directionMove USDC to or from a sub-account

Expiry and rate limits

Some actions accept expiresAfter (milliseconds). User-signed actions such as usdClassTransfer do not. An expired action is rejected and consumes 5x the usual address weight.

Batched requests consume weight per action. See rate limits.

Was this page helpful?