Modify order
curl --request POST \
--url https://api.hyperliquid.xyz/exchange \
--header 'Content-Type: application/json' \
--data '
{
"action": {
"type": "modify",
"oid": 123456789,
"order": {
"a": 0,
"b": true,
"p": "27.5",
"s": "1.0",
"r": false,
"t": {
"limit": {
"tif": "Gtc"
}
},
"c": "0x1234567890abcdef1234567890abcdef"
}
},
"nonce": 1705234567890,
"signature": {
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"v": 27
},
"vaultAddress": null
}
'import requests
url = "https://api.hyperliquid.xyz/exchange"
payload = {
"action": {
"type": "modify",
"oid": 123456789,
"order": {
"a": 0,
"b": True,
"p": "27.5",
"s": "1.0",
"r": False,
"t": { "limit": { "tif": "Gtc" } },
"c": "0x1234567890abcdef1234567890abcdef"
}
},
"nonce": 1705234567890,
"signature": {
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"v": 27
},
"vaultAddress": None
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
action: {
type: 'modify',
oid: 123456789,
order: {
a: 0,
b: true,
p: '27.5',
s: '1.0',
r: false,
t: {limit: {tif: 'Gtc'}},
c: '0x1234567890abcdef1234567890abcdef'
}
},
nonce: 1705234567890,
signature: {
r: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
s: '0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321',
v: 27
},
vaultAddress: null
})
};
fetch('https://api.hyperliquid.xyz/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperliquid.xyz/exchange",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => [
'type' => 'modify',
'oid' => 123456789,
'order' => [
'a' => 0,
'b' => true,
'p' => '27.5',
's' => '1.0',
'r' => false,
't' => [
'limit' => [
'tif' => 'Gtc'
]
],
'c' => '0x1234567890abcdef1234567890abcdef'
]
],
'nonce' => 1705234567890,
'signature' => [
'r' => '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
's' => '0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321',
'v' => 27
],
'vaultAddress' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperliquid.xyz/exchange"
payload := strings.NewReader("{\n \"action\": {\n \"type\": \"modify\",\n \"oid\": 123456789,\n \"order\": {\n \"a\": 0,\n \"b\": true,\n \"p\": \"27.5\",\n \"s\": \"1.0\",\n \"r\": false,\n \"t\": {\n \"limit\": {\n \"tif\": \"Gtc\"\n }\n },\n \"c\": \"0x1234567890abcdef1234567890abcdef\"\n }\n },\n \"nonce\": 1705234567890,\n \"signature\": {\n \"r\": \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n \"s\": \"0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321\",\n \"v\": 27\n },\n \"vaultAddress\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperliquid.xyz/exchange")
.header("Content-Type", "application/json")
.body("{\n \"action\": {\n \"type\": \"modify\",\n \"oid\": 123456789,\n \"order\": {\n \"a\": 0,\n \"b\": true,\n \"p\": \"27.5\",\n \"s\": \"1.0\",\n \"r\": false,\n \"t\": {\n \"limit\": {\n \"tif\": \"Gtc\"\n }\n },\n \"c\": \"0x1234567890abcdef1234567890abcdef\"\n }\n },\n \"nonce\": 1705234567890,\n \"signature\": {\n \"r\": \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n \"s\": \"0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321\",\n \"v\": 27\n },\n \"vaultAddress\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperliquid.xyz/exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": {\n \"type\": \"modify\",\n \"oid\": 123456789,\n \"order\": {\n \"a\": 0,\n \"b\": true,\n \"p\": \"27.5\",\n \"s\": \"1.0\",\n \"r\": false,\n \"t\": {\n \"limit\": {\n \"tif\": \"Gtc\"\n }\n },\n \"c\": \"0x1234567890abcdef1234567890abcdef\"\n }\n },\n \"nonce\": 1705234567890,\n \"signature\": {\n \"r\": \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n \"s\": \"0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321\",\n \"v\": 27\n },\n \"vaultAddress\": null\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"response": {
"type": "modify",
"data": {
"statuses": [
{
"resting": {
"oid": 77738309
}
}
]
}
}
}Hyperliquid node API
Modify order | Hyperliquid exchange
Modifies an existing order on the Hyperliquid exchange. You can change the price, size, and other parameters without canceling and replacing the order.
POST
/
exchange
Modify order
curl --request POST \
--url https://api.hyperliquid.xyz/exchange \
--header 'Content-Type: application/json' \
--data '
{
"action": {
"type": "modify",
"oid": 123456789,
"order": {
"a": 0,
"b": true,
"p": "27.5",
"s": "1.0",
"r": false,
"t": {
"limit": {
"tif": "Gtc"
}
},
"c": "0x1234567890abcdef1234567890abcdef"
}
},
"nonce": 1705234567890,
"signature": {
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"v": 27
},
"vaultAddress": null
}
'import requests
url = "https://api.hyperliquid.xyz/exchange"
payload = {
"action": {
"type": "modify",
"oid": 123456789,
"order": {
"a": 0,
"b": True,
"p": "27.5",
"s": "1.0",
"r": False,
"t": { "limit": { "tif": "Gtc" } },
"c": "0x1234567890abcdef1234567890abcdef"
}
},
"nonce": 1705234567890,
"signature": {
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"v": 27
},
"vaultAddress": None
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
action: {
type: 'modify',
oid: 123456789,
order: {
a: 0,
b: true,
p: '27.5',
s: '1.0',
r: false,
t: {limit: {tif: 'Gtc'}},
c: '0x1234567890abcdef1234567890abcdef'
}
},
nonce: 1705234567890,
signature: {
r: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
s: '0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321',
v: 27
},
vaultAddress: null
})
};
fetch('https://api.hyperliquid.xyz/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperliquid.xyz/exchange",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => [
'type' => 'modify',
'oid' => 123456789,
'order' => [
'a' => 0,
'b' => true,
'p' => '27.5',
's' => '1.0',
'r' => false,
't' => [
'limit' => [
'tif' => 'Gtc'
]
],
'c' => '0x1234567890abcdef1234567890abcdef'
]
],
'nonce' => 1705234567890,
'signature' => [
'r' => '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
's' => '0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321',
'v' => 27
],
'vaultAddress' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperliquid.xyz/exchange"
payload := strings.NewReader("{\n \"action\": {\n \"type\": \"modify\",\n \"oid\": 123456789,\n \"order\": {\n \"a\": 0,\n \"b\": true,\n \"p\": \"27.5\",\n \"s\": \"1.0\",\n \"r\": false,\n \"t\": {\n \"limit\": {\n \"tif\": \"Gtc\"\n }\n },\n \"c\": \"0x1234567890abcdef1234567890abcdef\"\n }\n },\n \"nonce\": 1705234567890,\n \"signature\": {\n \"r\": \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n \"s\": \"0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321\",\n \"v\": 27\n },\n \"vaultAddress\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperliquid.xyz/exchange")
.header("Content-Type", "application/json")
.body("{\n \"action\": {\n \"type\": \"modify\",\n \"oid\": 123456789,\n \"order\": {\n \"a\": 0,\n \"b\": true,\n \"p\": \"27.5\",\n \"s\": \"1.0\",\n \"r\": false,\n \"t\": {\n \"limit\": {\n \"tif\": \"Gtc\"\n }\n },\n \"c\": \"0x1234567890abcdef1234567890abcdef\"\n }\n },\n \"nonce\": 1705234567890,\n \"signature\": {\n \"r\": \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n \"s\": \"0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321\",\n \"v\": 27\n },\n \"vaultAddress\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperliquid.xyz/exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": {\n \"type\": \"modify\",\n \"oid\": 123456789,\n \"order\": {\n \"a\": 0,\n \"b\": true,\n \"p\": \"27.5\",\n \"s\": \"1.0\",\n \"r\": false,\n \"t\": {\n \"limit\": {\n \"tif\": \"Gtc\"\n }\n },\n \"c\": \"0x1234567890abcdef1234567890abcdef\"\n }\n },\n \"nonce\": 1705234567890,\n \"signature\": {\n \"r\": \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n \"s\": \"0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321\",\n \"v\": 27\n },\n \"vaultAddress\": null\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"response": {
"type": "modify",
"data": {
"statuses": [
{
"resting": {
"oid": 77738309
}
}
]
}
}
}You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See Hyperliquid methods for the full availability breakdown.
This endpoint requires signature authentication. See our comprehensive Authentication via Signatures guide for implementation details.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
Required parameters
-
action(object, required) — The modify action object containing:type(string) — Must be"modify"oid(number or string) — Order ID to modify, or cloid if using client order IDorder(object) — New order parameters:a(number) — Asset indexb(boolean) — Is buy order (true for buy/long, false for sell/short)p(string) — New limit prices(string) — New size in units of the base assetr(boolean) — Reduce only ordert(object) — Order type specification:- For limit orders:
{"limit": {"tif": "Alo" | "Ioc" | "Gtc"}} - For trigger orders:
{"trigger": {"isMarket": boolean, "triggerPx": string, "tpsl": "tp" | "sl"}}
- For limit orders:
c(string, optional) — New client order ID (128-bit hex string)
-
nonce(number, required) — Current timestamp in milliseconds (must be recent) -
signature(object, required) — EIP-712 signature of the action
Optional parameters
vaultAddress(string, optional) — Address when trading on behalf of a vault or subaccountexpiresAfter(number, optional) — Timestamp in milliseconds after which the request is rejected
Returns
Returns an object with modification status:status—"ok"if request processedresponse— Contains modification details:type—"modify"data— Modification result information
Example request
curl -X POST https://api.hyperliquid.xyz/exchange \
-H "Content-Type: application/json" \
-d '{
"action": {
"type": "modify",
"oid": 77738308,
"order": {
"a": 0,
"b": true,
"p": "51000",
"s": "0.02",
"r": false,
"t": {"limit": {"tif": "Gtc"}}
}
},
"nonce": 1234567890123,
"signature": {...}
}'
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
import eth_account
# Initialize with your private key
account = eth_account.Account.from_key("0x...")
exchange = Exchange(account, constants.MAINNET_API_URL)
# Modify an existing order
modify_result = exchange.modify_order(
oid=77738308,
name="BTC",
is_buy=True,
sz=0.02,
limit_px=51000,
order_type={"limit": {"tif": "Gtc"}},
reduce_only=False,
)
print(modify_result)
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";
// Initialize with your private key
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new HttpTransport(); // public Hyperliquid API
const exchange = new ExchangeClient({ transport, wallet });
// Modify an existing order
const modifyResult = await exchange.modify({
oid: 77738308,
order: {
a: 0,
b: true,
p: "51000",
s: "0.02",
r: false,
t: { limit: { tif: "Gtc" } },
},
});
console.log(modifyResult);
Modification behavior
- Priority preservation — Modifying only the size preserves queue priority
- Price changes — Changing the price moves the order to the back of the queue
- Partial fills — Can modify partially filled orders (remaining size only)
- Order types — Can change between different order types
Use cases
- Price adjustment — Update limit price based on market movements
- Size scaling — Increase or decrease order size
- Strategy updates — Adjust orders without losing position in queue
- Risk management — Convert orders to reduce-only
Modifying an order is more efficient than cancel-and-replace, especially when only changing the size, as it can preserve your position in the order queue.
Some modifications may cause loss of queue priority. Price changes always move the order to the back of the queue at the new price level.
Body
application/json
Show child attributes
Show child attributes
Current timestamp in milliseconds
EIP-712 signature of the action with r, s, v components
Show child attributes
Show child attributes
Address when trading on behalf of a vault or subaccount (optional)
Timestamp in milliseconds after which the request is rejected (optional)
Last modified on June 24, 2026
Was this page helpful?