๐Ÿ”Œ API & Developers

Hyperliquid twapOrder and twapCancel API: POST /exchange Fields and Responses

โš ๏ธ Disclosure: Some links on this page are affiliate links. If you sign up through them, I may earn a commission โ€” at no extra cost to you.
The twapOrder and twapCancel actions are sent to POST https://api.hyperliquid.xyz/exchange with Content-Type: application/json. The field names and response shapes below are from the Hyperliquid exchange endpoint documentation, checked 2026-11-17. The docs point to the Hyperliquid Python SDK for signature generation; this article documents the action payload and response shapes.

If you need an account, create a Hyperliquid account. This is a referral link; we may receive a commission. Per the Hyperliquid Referrals page, using a referral code gives a 4% fee discount on the first $25M of volume; referral discounts do not apply to vaults or sub-accounts because those are treated as independent accounts in the clearinghouse.

Common request fields

Both actions use the same outer exchange request fields:

FieldRequiredMeaning
actionYesThe action object, either twapOrder or twapCancel.
nonceYesRecommended to use the current timestamp in milliseconds.
signatureYesSignature object generated by the Hyperliquid Python SDK.
vaultAddressNo42-character hexadecimal address of a vault or subaccount. Subaccounts and vaults do not have private keys; the master account signs and sets this field.
expiresAfterNoTimestamp in milliseconds after which the action is rejected. Actions canceled because of a stale expiresAfter field consume 5x the usual address-based rate limit.
For a (asset), perpetuals use the index in the universe field returned by the meta response. The exchange endpoint documentation defines the generic asset mapping โ€” perpetual indices, and spot assets as 10000 + index in spotMeta.universe โ€” but does not separately confirm which encodings the twapOrder and twapCancel actions accept. For the generic asset-ID reference, see Hyperliquid API Asset IDs.

twapOrder action

The twapOrder action object is:

{
  "type": "twapOrder",
  "twap": {
    "a": 0,
    "b": true,
    "s": "1.0",
    "r": false,
    "m": 60,
    "t": true
  }
}

KeyTypeMeaning
aNumberAsset
bBooleanisBuy
sStringSize
rBooleanreduceOnly
mNumberMinutes
tBooleanRandomize
The documentation defines t only as randomize; it does not specify the randomization algorithm in this section.

A reference Python payload is:

action = {
    "type": "twapOrder",
    "twap": {
        "a": 0,
        "b": True,
        "s": "1.0",
        "r": False,
        "m": 60,
        "t": True,
    },
}

This is a payload reference, not a tested request. Pass the action with a nonce and the SDK-generated signature to your Hyperliquid SDK exchange call.

twapOrder response

A successful response includes twapId:

{
  "status": "ok",
  "response": {
    "type": "twapOrder",
    "data": {
      "status": {
        "running": {
          "twapId": 77738308
        }
      }
    }
  }
}

An error response has the same outer shape:

{
  "status": "ok",
  "response": {
    "type": "twapOrder",
    "data": {
      "status": {
        "error": "Invalid TWAP duration: 1 min(s)"
      }
    }
  }
}

twapCancel action

๐Ÿ’ก Hyperliquid

Like what you're reading? Try it yourself โ€” this link supports ChartedTrader at no cost to you.

Create a Hyperliquid account โ†’
๐ŸŽ You receive: 4% fee discount on first $25M volume ยท per account, lifetime

The twapCancel action object is:

{
  "type": "twapCancel",
  "a": 0,
  "t": 77738308
}

KeyTypeMeaning
aNumberAsset
tNumbertwap_id

twapCancel response

Success:

{
  "status": "ok",
  "response": {
    "type": "twapCancel",
    "data": {
      "status": "success"
    }
  }
}

Error:

{
  "status": "ok",
  "response": {
    "type": "twapCancel",
    "data": {
      "status": {
        "error": "TWAP was never placed, already canceled, or filled."
      }
    }
  }
}

How twapOrder differs structurally from the regular order action

The regular order action uses an orders array and includes price and order-type fields:

{
  "type": "order",
  "orders": [
    {
      "a": 0,
      "b": true,
      "p": "1891.4",
      "s": "0.02",
      "r": false,
      "t": {
        "limit": {
          "tif": "Gtc"
        }
      },
      "c": "0x1234567890abcdef1234567890abcdef"
    }
  ],
  "grouping": "na"
}

In the regular order action, a is asset, b is isBuy, p is price, s is size, r is reduceOnly, t is type, and c is an optional client order ID. The action may also include optional grouping and builder fields.

AspecttwapOrderRegular order
Order containerSingle twap objectorders array
PriceNo p fieldp price field
t fieldBoolean randomizeOrder type object, such as limit or trigger
Client order IDNo c fieldOptional c cloid
Grouping / builderNot part of the documented twapOrder actionOptional grouping and builder fields
Success responsedata.status.running.twapIddata.statuses array with resting, filled, or error entries
For regular limit-order TIF behavior, see Hyperliquid API Limit Order TIF. For TWAP setup and sizing, see Hyperliquid TWAP 7-Day Order Setup & Sizing Math. For troubleshooting a TWAP that does not trigger as expected, see Hyperliquid TWAP Not Triggering? Fix.

Sources

Create a Hyperliquid account if you are building against the exchange endpoint. This is a referral link; we may earn a commission. Per the Hyperliquid Referrals page, using a referral code gives a 4% fee discount on the first $25M of volume; referral discounts do not apply to vaults or sub-accounts.

Continue with Hyperliquid

Browse the Hyperliquid guide hub for the complete user journey.

๐Ÿงฎ Free Hyperliquid calculators

Fee Calculator โ†’
Hyperliquid vs centralized exchange fee comparison
PnL & Liquidation โ†’
Perp PnL + liquidation price
Position Size โ†’
Risk-aware position sizing for HL perps
Hyperliquid

Ready to get started? Use the link below โ€” it helps support ChartedTrader at no cost to you.

Create a Hyperliquid account โ†’
๐ŸŽ You receive: 4% fee discount on first $25M volume ยท per account, lifetime
๐Ÿ“ˆ

About the author

I'm a systematic trader running live strategies on IB (USDJPY momentum) and Hyperliquid (crypto perps). Questions? Reach out.

๐Ÿ“š Related Articles

๐Ÿ”Œ
API & Developers

Hyperliquid HIP-3: user_fills dex Parameter Missing Fix (2026)

Fix HIP-3 fill tracking on Hyperliquid by parsing the dex prefix from coin, paging userFillsByTime, and using documented WebSocket userFills subscriptions.

July 11, 2026 โฑ 7 min read
๐Ÿ”Œ
API & Developers

Hyperliquid vaultTransfer API: Deposit or Withdraw Vault Funds via POST /exchange

Use Hyperliquid's vaultTransfer action on POST /exchange to add or remove vault funds. Covers vaultAddress, isDeposit, usd, expiresAfter, response, and hip3LiquidatorTransfer differences.

November 16, 2026 โฑ 3 min read
๐Ÿ”Œ
API & Developers

Hyperliquid API Limit Order TIF: Gtc, Ioc, and Alo in the Order Action (2026)

How Hyperliquid limit orders encode TIF in the exchange endpoint: Gtc has no special first-hit behavior, Ioc cancels the unfilled part, and Alo cancels instead of matching.

November 13, 2026 โฑ 3 min read