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:
| Field | Required | Meaning |
|---|---|---|
action | Yes | The action object, either twapOrder or twapCancel. |
nonce | Yes | Recommended to use the current timestamp in milliseconds. |
signature | Yes | Signature object generated by the Hyperliquid Python SDK. |
vaultAddress | No | 42-character hexadecimal address of a vault or subaccount. Subaccounts and vaults do not have private keys; the master account signs and sets this field. |
expiresAfter | No | Timestamp in milliseconds after which the action is rejected. Actions canceled because of a stale expiresAfter field consume 5x the usual address-based rate limit. |
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
}
}
| Key | Type | Meaning |
|---|---|---|
a | Number | Asset |
b | Boolean | isBuy |
s | String | Size |
r | Boolean | reduceOnly |
m | Number | Minutes |
t | Boolean | Randomize |
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
Like what you're reading? Try it yourself โ this link supports ChartedTrader at no cost to you.
Create a Hyperliquid account โThe twapCancel action object is:
{
"type": "twapCancel",
"a": 0,
"t": 77738308
}
| Key | Type | Meaning |
|---|---|---|
a | Number | Asset |
t | Number | twap_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.
| Aspect | twapOrder | Regular order |
|---|---|---|
| Order container | Single twap object | orders array |
| Price | No p field | p price field |
t field | Boolean randomize | Order type object, such as limit or trigger |
| Client order ID | No c field | Optional c cloid |
| Grouping / builder | Not part of the documented twapOrder action | Optional grouping and builder fields |
| Success response | data.status.running.twapId | data.statuses array with resting, filled, or error entries |
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.