curl --request PATCH \
--url https://api.ondoperps.xyz/v1/perps/orders/{orderID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": "12.00",
"price": "228.00",
"version": 0
}
'import requests
url = "https://api.ondoperps.xyz/v1/perps/orders/{orderID}"
payload = {
"size": "12.00",
"price": "228.00",
"version": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({size: '12.00', price: '228.00', version: 0})
};
fetch('https://api.ondoperps.xyz/v1/perps/orders/{orderID}', 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.ondoperps.xyz/v1/perps/orders/{orderID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'size' => '12.00',
'price' => '228.00',
'version' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.ondoperps.xyz/v1/perps/orders/{orderID}"
payload := strings.NewReader("{\n \"size\": \"12.00\",\n \"price\": \"228.00\",\n \"version\": 0\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://api.ondoperps.xyz/v1/perps/orders/{orderID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"size\": \"12.00\",\n \"price\": \"228.00\",\n \"version\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ondoperps.xyz/v1/perps/orders/{orderID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"size\": \"12.00\",\n \"price\": \"228.00\",\n \"version\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": {
"orderId": "197ec08e001658690721be129e7fa595",
"side": "buy",
"price": "228.00",
"size": "12.00",
"market": "AAPL-USD.P",
"filledSize": "0.00",
"lastFillSize": "0.00",
"filledCost": "0.00",
"fee": "0.00",
"status": "open",
"createdAt": "2025-03-05T14:30:00Z",
"amendedAt": "2025-03-05T14:32:00Z",
"version": 1,
"type": "limit",
"timeInForce": "GTC"
}
}{
"success": false,
"error": "Description of the error",
"error_code": "amend_no_change"
}{
"success": false,
"error": "Description of the error",
"error_code": "auth_missing"
}{
"success": false,
"error": "Description of the error",
"error_code": "feature_disabled"
}{
"success": false,
"error": "Description of the error",
"error_code": "order_not_found"
}{
"success": false,
"error": "the order is at version 1, not 0: it was amended since",
"error_code": "amend_version_mismatch"
}{
"success": false,
"error": "Description of the error",
"error_code": "too_many_requests"
}{
"success": false,
"error": "Description of the error",
"error_code": "unknown"
}Amend Order
Changes the size, the price, or both of an open limit order in place. The order keeps its orderId, clientOrderId, and createdAt. The orderID path parameter can be:
- An internal order ID (e.g.
197ec08e001658690721be129e7fa595). - A client order ID prefixed with
client:(e.g.client:abc123).
Send size, price, or both, with the order’s current version. A field you omit keeps its current value. size is the new total size, including any quantity already filled, so it must be greater than filledSize. To drop the rest of an order, cancel it instead.
Versions. Every amend increments the order’s version. An order that was never amended is at version 0 and omits the field. If the order was amended after the version you send, the request returns 409 amend_version_mismatch and changes nothing. Read the order again before you retry.
Queue priority. Reducing the size at the same price keeps the order’s place in the queue. Increasing the size moves the order to the back of its price level. Changing the price moves it to the back of the new price level.
Crossing the book. A new price that crosses the book trades immediately, as a new order would, and any remainder rests at the new price. These fills pay the taker fee. As with a new order, your own resting orders that it would match are canceled first (selfMatchPrevention). To reject such an amend with post_only_has_match instead, set postOnly: true. It applies to this amend only and does not change the order’s own post-only setting. An order placed as post-only is always amended as post-only: an amend whose new price would match returns post_only_has_match, whatever postOnly says.
Validation. An amend that increases the size or changes the price is validated like a new order, so Create Order’s validation errors, such as insufficient_margin or order_price_outside_safe_bounds, can also be returned. Only open limit orders resting on the book can be amended. Market and IOC orders, stop orders, TWAP child orders, and liquidation orders return order_not_amendable. To amend a take profit or stop loss, use Amend Stop Order (PATCH /v1/perps/stop_order/{orderID}).
Take profit and stop loss. You can amend an order with an attached take profit or stop loss. A new price must stay between their trigger prices (for a buy, above the stop loss and below the take profit), or the request returns stop_order_crosses_order_price. The attached orders keep their trigger prices and follow the order’s new size. To change a trigger price, use Amend Stop Order. See Take profit and stop loss.
Order delay. If an order delay applies to your account, a price amend waits for it before it is applied. Size-only amends and amends with postOnly: true are applied without the delay. The delay follows the request, not the order: send postOnly: true to amend the price of a post-only order without it.
Each amend counts as one order addition against your account’s order-action rate limit. Subscribe to orderAmendsPerps to receive each amend with the order’s previous size and price.
curl --request PATCH \
--url https://api.ondoperps.xyz/v1/perps/orders/{orderID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": "12.00",
"price": "228.00",
"version": 0
}
'import requests
url = "https://api.ondoperps.xyz/v1/perps/orders/{orderID}"
payload = {
"size": "12.00",
"price": "228.00",
"version": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({size: '12.00', price: '228.00', version: 0})
};
fetch('https://api.ondoperps.xyz/v1/perps/orders/{orderID}', 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.ondoperps.xyz/v1/perps/orders/{orderID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'size' => '12.00',
'price' => '228.00',
'version' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.ondoperps.xyz/v1/perps/orders/{orderID}"
payload := strings.NewReader("{\n \"size\": \"12.00\",\n \"price\": \"228.00\",\n \"version\": 0\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://api.ondoperps.xyz/v1/perps/orders/{orderID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"size\": \"12.00\",\n \"price\": \"228.00\",\n \"version\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ondoperps.xyz/v1/perps/orders/{orderID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"size\": \"12.00\",\n \"price\": \"228.00\",\n \"version\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": {
"orderId": "197ec08e001658690721be129e7fa595",
"side": "buy",
"price": "228.00",
"size": "12.00",
"market": "AAPL-USD.P",
"filledSize": "0.00",
"lastFillSize": "0.00",
"filledCost": "0.00",
"fee": "0.00",
"status": "open",
"createdAt": "2025-03-05T14:30:00Z",
"amendedAt": "2025-03-05T14:32:00Z",
"version": 1,
"type": "limit",
"timeInForce": "GTC"
}
}{
"success": false,
"error": "Description of the error",
"error_code": "amend_no_change"
}{
"success": false,
"error": "Description of the error",
"error_code": "auth_missing"
}{
"success": false,
"error": "Description of the error",
"error_code": "feature_disabled"
}{
"success": false,
"error": "Description of the error",
"error_code": "order_not_found"
}{
"success": false,
"error": "the order is at version 1, not 0: it was amended since",
"error_code": "amend_version_mismatch"
}{
"success": false,
"error": "Description of the error",
"error_code": "too_many_requests"
}{
"success": false,
"error": "Description of the error",
"error_code": "unknown"
}Authorizations
Path Parameters
Body
Send size, price, or both. Any other field returns amend_field_not_supported.
If true, the amend returns post_only_has_match instead of trading when the new price would match. Applies to this amend only and does not change the order's own post-only setting. An order placed as post-only is always amended as post-only, so false does not let it trade.
false
Response
Amended order