Cancel an order and place a replacement non-atomically
curl --request POST \
--url https://api.limitless.exchange/orders/cancel-replace \
--header 'Content-Type: application/json' \
--header 'lmts-api-key: <api-key>' \
--data '
{
"cancel": {
"orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
"clientOrderId": "partner-order-001"
},
"replacement": {
"order": {
"salt": "1778155025318314496",
"maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"makerAmount": 5000000,
"takerAmount": 10000000,
"feeRateBps": 0,
"side": 0,
"signature": "0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"nonce": 0,
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "btc-100k",
"postOnly": true,
"clientOrderId": "replacement-order-001",
"timestamp": 1735689600000,
"recvWindow": 1500,
"stpPolicy": "cancel_maker"
},
"mode": "STOP_ON_FAILURE",
"onBehalfOf": 12345
}
'import requests
url = "https://api.limitless.exchange/orders/cancel-replace"
payload = {
"cancel": {
"orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
"clientOrderId": "partner-order-001"
},
"replacement": {
"order": {
"salt": "1778155025318314496",
"maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"makerAmount": 5000000,
"takerAmount": 10000000,
"feeRateBps": 0,
"side": 0,
"signature": "0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"nonce": 0,
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "btc-100k",
"postOnly": True,
"clientOrderId": "replacement-order-001",
"timestamp": 1735689600000,
"recvWindow": 1500,
"stpPolicy": "cancel_maker"
},
"mode": "STOP_ON_FAILURE",
"onBehalfOf": 12345
}
headers = {
"lmts-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'lmts-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cancel: {
orderId: '6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203',
clientOrderId: 'partner-order-001'
},
replacement: {
order: {
salt: '1778155025318314496',
maker: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
signer: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
tokenId: '19633204485790857949828516737993423758628930235371629943999544859324645414627',
makerAmount: 5000000,
takerAmount: 10000000,
feeRateBps: 0,
side: 0,
signature: '0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901',
signatureType: 2,
taker: '0x0000000000000000000000000000000000000000',
expiration: '0',
nonce: 0,
price: 0.75
},
ownerId: 12345,
orderType: 'GTC',
marketSlug: 'btc-100k',
postOnly: true,
clientOrderId: 'replacement-order-001',
timestamp: 1735689600000,
recvWindow: 1500,
stpPolicy: 'cancel_maker'
},
mode: 'STOP_ON_FAILURE',
onBehalfOf: 12345
})
};
fetch('https://api.limitless.exchange/orders/cancel-replace', 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.limitless.exchange/orders/cancel-replace",
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([
'cancel' => [
'orderId' => '6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203',
'clientOrderId' => 'partner-order-001'
],
'replacement' => [
'order' => [
'salt' => '1778155025318314496',
'maker' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'signer' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'tokenId' => '19633204485790857949828516737993423758628930235371629943999544859324645414627',
'makerAmount' => 5000000,
'takerAmount' => 10000000,
'feeRateBps' => 0,
'side' => 0,
'signature' => '0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901',
'signatureType' => 2,
'taker' => '0x0000000000000000000000000000000000000000',
'expiration' => '0',
'nonce' => 0,
'price' => 0.75
],
'ownerId' => 12345,
'orderType' => 'GTC',
'marketSlug' => 'btc-100k',
'postOnly' => true,
'clientOrderId' => 'replacement-order-001',
'timestamp' => 1735689600000,
'recvWindow' => 1500,
'stpPolicy' => 'cancel_maker'
],
'mode' => 'STOP_ON_FAILURE',
'onBehalfOf' => 12345
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"lmts-api-key: <api-key>"
],
]);
$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.limitless.exchange/orders/cancel-replace"
payload := strings.NewReader("{\n \"cancel\": {\n \"orderId\": \"6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203\",\n \"clientOrderId\": \"partner-order-001\"\n },\n \"replacement\": {\n \"order\": {\n \"salt\": \"1778155025318314496\",\n \"maker\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"signer\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"tokenId\": \"19633204485790857949828516737993423758628930235371629943999544859324645414627\",\n \"makerAmount\": 5000000,\n \"takerAmount\": 10000000,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"nonce\": 0,\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"btc-100k\",\n \"postOnly\": true,\n \"clientOrderId\": \"replacement-order-001\",\n \"timestamp\": 1735689600000,\n \"recvWindow\": 1500,\n \"stpPolicy\": \"cancel_maker\"\n },\n \"mode\": \"STOP_ON_FAILURE\",\n \"onBehalfOf\": 12345\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("lmts-api-key", "<api-key>")
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.limitless.exchange/orders/cancel-replace")
.header("lmts-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cancel\": {\n \"orderId\": \"6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203\",\n \"clientOrderId\": \"partner-order-001\"\n },\n \"replacement\": {\n \"order\": {\n \"salt\": \"1778155025318314496\",\n \"maker\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"signer\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"tokenId\": \"19633204485790857949828516737993423758628930235371629943999544859324645414627\",\n \"makerAmount\": 5000000,\n \"takerAmount\": 10000000,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"nonce\": 0,\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"btc-100k\",\n \"postOnly\": true,\n \"clientOrderId\": \"replacement-order-001\",\n \"timestamp\": 1735689600000,\n \"recvWindow\": 1500,\n \"stpPolicy\": \"cancel_maker\"\n },\n \"mode\": \"STOP_ON_FAILURE\",\n \"onBehalfOf\": 12345\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitless.exchange/orders/cancel-replace")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["lmts-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cancel\": {\n \"orderId\": \"6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203\",\n \"clientOrderId\": \"partner-order-001\"\n },\n \"replacement\": {\n \"order\": {\n \"salt\": \"1778155025318314496\",\n \"maker\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"signer\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"tokenId\": \"19633204485790857949828516737993423758628930235371629943999544859324645414627\",\n \"makerAmount\": 5000000,\n \"takerAmount\": 10000000,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"nonce\": 0,\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"btc-100k\",\n \"postOnly\": true,\n \"clientOrderId\": \"replacement-order-001\",\n \"timestamp\": 1735689600000,\n \"recvWindow\": 1500,\n \"stpPolicy\": \"cancel_maker\"\n },\n \"mode\": \"STOP_ON_FAILURE\",\n \"onBehalfOf\": 12345\n}"
response = http.request(request)
puts response.read_body{
"cancel": {
"status": "SUCCESS",
"orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
"clientOrderId": "old-order-001"
},
"replacement": {
"status": "SUCCESS",
"data": {
"order": {
"id": "9e31c452-8a2b-42d1-b327-65f18d07dc96",
"salt": "1778155025318314496",
"maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"taker": "0x0000000000000000000000000000000000000000",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"makerAmount": "5000000",
"takerAmount": "10000000",
"expiration": "0",
"signatureType": 0,
"nonce": "0",
"feeRateBps": 0,
"signature": "0x1234",
"orderType": "GTC",
"price": "0.5",
"side": 0,
"marketId": "7348",
"ownerId": 12345,
"createdAt": "2026-08-05T12:00:00.000Z",
"updatedAt": "2026-08-05T12:00:00.000Z",
"market": {
"id": 7348,
"slug": "btc-100k",
"title": "Will Bitcoin reach $100k?",
"status": "FUNDED",
"yesPositionId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"noPositionId": "34633204485790857949828516737993423758628930235371629943999544859324645414627"
}
},
"makerMatches": [],
"execution": {
"matched": false,
"settlementStatus": "UNMATCHED",
"clientOrderId": "replacement-001",
"feeRateBps": 0,
"effectiveFeeBps": 0,
"totalsRaw": {
"contractsGross": "0",
"contractsFee": "0",
"contractsNet": "0",
"usdGross": "0",
"usdFee": "0",
"usdNet": "0"
}
}
}
}
}Trading
Cancel and Replace Order
Cancels one order and conditionally submits a replacement. Cancellation and replacement have independent outcomes.
POST
/
orders
/
cancel-replace
Cancel an order and place a replacement non-atomically
curl --request POST \
--url https://api.limitless.exchange/orders/cancel-replace \
--header 'Content-Type: application/json' \
--header 'lmts-api-key: <api-key>' \
--data '
{
"cancel": {
"orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
"clientOrderId": "partner-order-001"
},
"replacement": {
"order": {
"salt": "1778155025318314496",
"maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"makerAmount": 5000000,
"takerAmount": 10000000,
"feeRateBps": 0,
"side": 0,
"signature": "0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"nonce": 0,
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "btc-100k",
"postOnly": true,
"clientOrderId": "replacement-order-001",
"timestamp": 1735689600000,
"recvWindow": 1500,
"stpPolicy": "cancel_maker"
},
"mode": "STOP_ON_FAILURE",
"onBehalfOf": 12345
}
'import requests
url = "https://api.limitless.exchange/orders/cancel-replace"
payload = {
"cancel": {
"orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
"clientOrderId": "partner-order-001"
},
"replacement": {
"order": {
"salt": "1778155025318314496",
"maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"makerAmount": 5000000,
"takerAmount": 10000000,
"feeRateBps": 0,
"side": 0,
"signature": "0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"nonce": 0,
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "btc-100k",
"postOnly": True,
"clientOrderId": "replacement-order-001",
"timestamp": 1735689600000,
"recvWindow": 1500,
"stpPolicy": "cancel_maker"
},
"mode": "STOP_ON_FAILURE",
"onBehalfOf": 12345
}
headers = {
"lmts-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'lmts-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cancel: {
orderId: '6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203',
clientOrderId: 'partner-order-001'
},
replacement: {
order: {
salt: '1778155025318314496',
maker: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
signer: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
tokenId: '19633204485790857949828516737993423758628930235371629943999544859324645414627',
makerAmount: 5000000,
takerAmount: 10000000,
feeRateBps: 0,
side: 0,
signature: '0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901',
signatureType: 2,
taker: '0x0000000000000000000000000000000000000000',
expiration: '0',
nonce: 0,
price: 0.75
},
ownerId: 12345,
orderType: 'GTC',
marketSlug: 'btc-100k',
postOnly: true,
clientOrderId: 'replacement-order-001',
timestamp: 1735689600000,
recvWindow: 1500,
stpPolicy: 'cancel_maker'
},
mode: 'STOP_ON_FAILURE',
onBehalfOf: 12345
})
};
fetch('https://api.limitless.exchange/orders/cancel-replace', 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.limitless.exchange/orders/cancel-replace",
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([
'cancel' => [
'orderId' => '6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203',
'clientOrderId' => 'partner-order-001'
],
'replacement' => [
'order' => [
'salt' => '1778155025318314496',
'maker' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'signer' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'tokenId' => '19633204485790857949828516737993423758628930235371629943999544859324645414627',
'makerAmount' => 5000000,
'takerAmount' => 10000000,
'feeRateBps' => 0,
'side' => 0,
'signature' => '0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901',
'signatureType' => 2,
'taker' => '0x0000000000000000000000000000000000000000',
'expiration' => '0',
'nonce' => 0,
'price' => 0.75
],
'ownerId' => 12345,
'orderType' => 'GTC',
'marketSlug' => 'btc-100k',
'postOnly' => true,
'clientOrderId' => 'replacement-order-001',
'timestamp' => 1735689600000,
'recvWindow' => 1500,
'stpPolicy' => 'cancel_maker'
],
'mode' => 'STOP_ON_FAILURE',
'onBehalfOf' => 12345
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"lmts-api-key: <api-key>"
],
]);
$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.limitless.exchange/orders/cancel-replace"
payload := strings.NewReader("{\n \"cancel\": {\n \"orderId\": \"6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203\",\n \"clientOrderId\": \"partner-order-001\"\n },\n \"replacement\": {\n \"order\": {\n \"salt\": \"1778155025318314496\",\n \"maker\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"signer\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"tokenId\": \"19633204485790857949828516737993423758628930235371629943999544859324645414627\",\n \"makerAmount\": 5000000,\n \"takerAmount\": 10000000,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"nonce\": 0,\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"btc-100k\",\n \"postOnly\": true,\n \"clientOrderId\": \"replacement-order-001\",\n \"timestamp\": 1735689600000,\n \"recvWindow\": 1500,\n \"stpPolicy\": \"cancel_maker\"\n },\n \"mode\": \"STOP_ON_FAILURE\",\n \"onBehalfOf\": 12345\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("lmts-api-key", "<api-key>")
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.limitless.exchange/orders/cancel-replace")
.header("lmts-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cancel\": {\n \"orderId\": \"6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203\",\n \"clientOrderId\": \"partner-order-001\"\n },\n \"replacement\": {\n \"order\": {\n \"salt\": \"1778155025318314496\",\n \"maker\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"signer\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"tokenId\": \"19633204485790857949828516737993423758628930235371629943999544859324645414627\",\n \"makerAmount\": 5000000,\n \"takerAmount\": 10000000,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"nonce\": 0,\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"btc-100k\",\n \"postOnly\": true,\n \"clientOrderId\": \"replacement-order-001\",\n \"timestamp\": 1735689600000,\n \"recvWindow\": 1500,\n \"stpPolicy\": \"cancel_maker\"\n },\n \"mode\": \"STOP_ON_FAILURE\",\n \"onBehalfOf\": 12345\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitless.exchange/orders/cancel-replace")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["lmts-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cancel\": {\n \"orderId\": \"6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203\",\n \"clientOrderId\": \"partner-order-001\"\n },\n \"replacement\": {\n \"order\": {\n \"salt\": \"1778155025318314496\",\n \"maker\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"signer\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"tokenId\": \"19633204485790857949828516737993423758628930235371629943999544859324645414627\",\n \"makerAmount\": 5000000,\n \"takerAmount\": 10000000,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"nonce\": 0,\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"btc-100k\",\n \"postOnly\": true,\n \"clientOrderId\": \"replacement-order-001\",\n \"timestamp\": 1735689600000,\n \"recvWindow\": 1500,\n \"stpPolicy\": \"cancel_maker\"\n },\n \"mode\": \"STOP_ON_FAILURE\",\n \"onBehalfOf\": 12345\n}"
response = http.request(request)
puts response.read_body{
"cancel": {
"status": "SUCCESS",
"orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
"clientOrderId": "old-order-001"
},
"replacement": {
"status": "SUCCESS",
"data": {
"order": {
"id": "9e31c452-8a2b-42d1-b327-65f18d07dc96",
"salt": "1778155025318314496",
"maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"taker": "0x0000000000000000000000000000000000000000",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"makerAmount": "5000000",
"takerAmount": "10000000",
"expiration": "0",
"signatureType": 0,
"nonce": "0",
"feeRateBps": 0,
"signature": "0x1234",
"orderType": "GTC",
"price": "0.5",
"side": 0,
"marketId": "7348",
"ownerId": 12345,
"createdAt": "2026-08-05T12:00:00.000Z",
"updatedAt": "2026-08-05T12:00:00.000Z",
"market": {
"id": 7348,
"slug": "btc-100k",
"title": "Will Bitcoin reach $100k?",
"status": "FUNDED",
"yesPositionId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"noPositionId": "34633204485790857949828516737993423758628930235371629943999544859324645414627"
}
},
"makerMatches": [],
"execution": {
"matched": false,
"settlementStatus": "UNMATCHED",
"clientOrderId": "replacement-001",
"feeRateBps": 0,
"effectiveFeeBps": 0,
"totalsRaw": {
"contractsGross": "0",
"contractsFee": "0",
"contractsNet": "0",
"usdGross": "0",
"usdFee": "0",
"usdNet": "0"
}
}
}
}
}Cancel one order and submit its replacement in one request. The two actions are not atomic: cancellation and replacement have independent outcomes, and a successful cancellation does not guarantee a successful replacement.
If the request passes replacement preflight but
Request-level errors are separate from these operation results. Authentication, authorization, scope, body validation, replacement preflight, receive-window, and unexpected server errors return their ordinary HTTP error status instead of a cancel/replace result.
Request
| Field | Type | Description |
|---|---|---|
cancel | object | Identifies the order to cancel. Provide exactly one of orderId or clientOrderId. |
replacement | object | A standard signed order request. It accepts the same fields as POST /orders, except onBehalfOf. |
mode | string | STOP_ON_FAILURE or ALLOW_FAILURE. Controls whether replacement is attempted after cancellation fails. |
onBehalfOf | number | Optional profile ID for an authorized partner sub-account. Applies to both cancellation and replacement. |
replacement.ownerId must own the order being canceled. Put onBehalfOf only at the operation level, not inside replacement.
Failure modes
| Mode | Cancellation fails | Replacement result |
|---|---|---|
STOP_ON_FAILURE | Stops this operation | NOT_ATTEMPTED |
ALLOW_FAILURE | Continues this operation | Placement is attempted and reports SUCCESS, FAILURE, or UNKNOWN independently |
Authentication and signing
Authentication matchesPOST /orders/cancel: HMAC (apiToken), Privy, and session authentication are accepted. Programmatic integrations should use a scoped API token with the trading scope and HMAC-sign the exact request body and path /orders/cancel-replace; see Authentication.
The cancellation itself is not EIP-712 signed. For a direct request, the replacement is a normal order and must contain an EIP-712 signature. The authenticated profile must be a valid signer of the order being canceled.
For an authorized partner sub-account, set the operation-level onBehalfOf to the sub-account profile ID and set replacement.ownerId to the same ID. This path requires delegated_signing in addition to trading. If the replacement omits its order signature, the server signs it only for a managed server-wallet sub-account under the existing delegated signing rules.
Example: stop after cancellation failure
The order values below illustrate the request shape. Generateorder.signature from the complete replacement payload instead of copying the placeholder signature.
{
"cancel": {
"clientOrderId": "old-order-001"
},
"replacement": {
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "btc-100k",
"clientOrderId": "replacement-001",
"order": {
"salt": "1778155025318314496",
"maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"taker": "0x0000000000000000000000000000000000000000",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
"makerAmount": 5000000,
"takerAmount": 10000000,
"expiration": "0",
"nonce": 0,
"price": 0.5,
"feeRateBps": 0,
"side": 0,
"signature": "0x1234",
"signatureType": 0
}
},
"mode": "STOP_ON_FAILURE"
}
old-order-001 is not found, the response is 409 Conflict:
{
"cancel": {
"status": "FAILURE",
"error": {
"code": "ORDER_NOT_FOUND",
"message": "Order not found"
}
},
"replacement": {
"status": "NOT_ATTEMPTED"
}
}
Example: allow replacement after cancellation failure
Changingmode to ALLOW_FAILURE attempts the same replacement even if cancellation fails. A failed cancellation with an accepted replacement still returns 409 Conflict because the complete cancel-and-replace operation did not succeed:
{
"cancel": {
"status": "FAILURE",
"error": {
"code": "ORDER_NOT_FOUND",
"message": "Order not found"
}
},
"replacement": {
"status": "SUCCESS",
"data": {
"order": {
"id": "9e31c452-8a2b-42d1-b327-65f18d07dc96"
},
"makerMatches": [],
"execution": {
"matched": false,
"settlementStatus": "UNMATCHED",
"clientOrderId": "replacement-001",
"feeRateBps": 0,
"effectiveFeeBps": 0,
"totalsRaw": {
"contractsGross": "0",
"contractsFee": "0",
"contractsNet": "0",
"usdGross": "0",
"usdFee": "0",
"usdNet": "0"
}
}
}
}
}
Response semantics
cancel.status can be SUCCESS, FAILURE, or UNKNOWN. replacement.status can be SUCCESS, FAILURE, UNKNOWN, or NOT_ATTEMPTED.
| Outcome | HTTP status |
|---|---|
Cancellation and replacement are both SUCCESS | 200 OK |
Cancellation fails under STOP_ON_FAILURE; replacement is NOT_ATTEMPTED | 409 Conflict |
Cancellation fails under ALLOW_FAILURE; replacement is SUCCESS | 409 Conflict |
| The service returns any other non-success top-level result | 409 Conflict |
replacement.status: "SUCCESS" means the order matching engine accepted the placement. It does not guarantee on-chain settlement. A matched replacement remains top-level SUCCESS when replacement.data.execution.settlementStatus is FAILED; the settlement failure and reason remain nested under execution. There is no top-level SETTLEMENT_FAILED replacement status.Authorizations
Scoped API token with HMAC-SHA256 signing. Requires three headers: lmts-api-key (token ID), lmts-timestamp (ISO-8601), lmts-signature (Base64-encoded HMAC). See Authentication docs for details.
Body
application/json
Order to cancel; provide exactly one identifier
- Option 1
- Option 2
Show child attributes
Show child attributes
Replacement order fields. This is the POST /orders request shape without onBehalfOf; delegation is set on the enclosing cancel-replace operation.
Show child attributes
Show child attributes
Whether to stop this operation or attempt replacement after cancellation failure
Available options:
ALLOW_FAILURE, STOP_ON_FAILURE Example:
"STOP_ON_FAILURE"
Authorized partner sub-account profile ID. Applies to both cancellation and replacement.
Required range:
x >= 1Example:
12345
⌘I