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,
"nonce": 0,
"feeRateBps": 0,
"side": 0,
"signature": "0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "biden-vs-trump-2024",
"postOnly": true,
"clientOrderId": "client-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,
"nonce": 0,
"feeRateBps": 0,
"side": 0,
"signature": "0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "biden-vs-trump-2024",
"postOnly": True,
"clientOrderId": "client-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,
nonce: 0,
feeRateBps: 0,
side: 0,
signature: '0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b',
signatureType: 2,
taker: '0x0000000000000000000000000000000000000000',
expiration: '0',
price: 0.75
},
ownerId: 12345,
orderType: 'GTC',
marketSlug: 'biden-vs-trump-2024',
postOnly: true,
clientOrderId: 'client-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,
'nonce' => 0,
'feeRateBps' => 0,
'side' => 0,
'signature' => '0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b',
'signatureType' => 2,
'taker' => '0x0000000000000000000000000000000000000000',
'expiration' => '0',
'price' => 0.75
],
'ownerId' => 12345,
'orderType' => 'GTC',
'marketSlug' => 'biden-vs-trump-2024',
'postOnly' => true,
'clientOrderId' => 'client-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 \"nonce\": 0,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"biden-vs-trump-2024\",\n \"postOnly\": true,\n \"clientOrderId\": \"client-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 \"nonce\": 0,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"biden-vs-trump-2024\",\n \"postOnly\": true,\n \"clientOrderId\": \"client-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 \"nonce\": 0,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"biden-vs-trump-2024\",\n \"postOnly\": true,\n \"clientOrderId\": \"client-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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"clientOrderId": "<string>"
},
"replacement": {
"status": "SUCCESS",
"data": {
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"salt": "1778155025318314496",
"maker": "<string>",
"signer": "<string>",
"tokenId": "<string>",
"signatureType": 0,
"signature": "<string>",
"orderType": "GTC",
"side": 0,
"marketId": "<string>",
"ownerId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"market": {
"id": 7348,
"slug": "btc-up-or-down-1-hour",
"title": "BTC Up or Down - Hourly",
"status": "FUNDED",
"yesPositionId": "11514974713064423461...",
"noPositionId": "14525308260861904048...",
"group": {
"id": 42,
"slug": "btc-price-markets",
"title": "BTC Price Markets"
}
},
"makerAmount": 5000000,
"takerAmount": 10000000,
"nonce": 0,
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"rankName": "<string>",
"points": 123,
"referredUsersCount": 123,
"isTop100": true,
"leaderboardPosition": 123
},
"taker": "<string>",
"expiration": "2023-11-07T05:31:56Z",
"feeRateBps": 123,
"price": 0.75
},
"execution": {
"matched": true,
"settlementStatus": "MINED",
"feeRateBps": 25,
"effectiveFeeBps": 26,
"totalsRaw": {
"contractsGross": "1000000",
"contractsFee": "1000",
"contractsNet": "999000",
"usdGross": "500000",
"usdFee": "500",
"usdNet": "499500"
},
"reason": "settlement transaction reverted",
"eligibleAt": "2026-06-08T10:15:30.000Z",
"tradeEventId": "4aa706dd-6c57-4f3c-945a-99818dfd95f1",
"txHash": "0xabc123",
"clientOrderId": "client-order-001",
"stpMakerCancels": [
"4aa706dd-6c57-4f3c-945a-99818dfd95f1"
]
},
"makerMatches": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"matchedSize": "1000000",
"fillPrice": "0.55",
"fillCost": "550000",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"maker": "<string>",
"price": "0.55",
"side": 0,
"tokenId": "<string>",
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"points": 0,
"referredUsersCount": 0
}
}
}
]
}
}
}{
"message": [
{
"field": "orderIds",
"message": "orderIds should not be empty"
}
],
"error": "Bad Request",
"statusCode": 400
}{
"message": "<string>",
"error": "<string>",
"statusCode": 123
}{
"message": "<string>"
}{
"message": "<string>",
"error": "<string>",
"statusCode": 123
}{
"cancel": {
"status": "SUCCESS",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"clientOrderId": "<string>"
},
"replacement": {
"status": "SUCCESS",
"data": {
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"salt": "1778155025318314496",
"maker": "<string>",
"signer": "<string>",
"tokenId": "<string>",
"signatureType": 0,
"signature": "<string>",
"orderType": "GTC",
"side": 0,
"marketId": "<string>",
"ownerId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"market": {
"id": 7348,
"slug": "btc-up-or-down-1-hour",
"title": "BTC Up or Down - Hourly",
"status": "FUNDED",
"yesPositionId": "11514974713064423461...",
"noPositionId": "14525308260861904048...",
"group": {
"id": 42,
"slug": "btc-price-markets",
"title": "BTC Price Markets"
}
},
"makerAmount": 5000000,
"takerAmount": 10000000,
"nonce": 0,
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"rankName": "<string>",
"points": 123,
"referredUsersCount": 123,
"isTop100": true,
"leaderboardPosition": 123
},
"taker": "<string>",
"expiration": "2023-11-07T05:31:56Z",
"feeRateBps": 123,
"price": 0.75
},
"execution": {
"matched": true,
"settlementStatus": "MINED",
"feeRateBps": 25,
"effectiveFeeBps": 26,
"totalsRaw": {
"contractsGross": "1000000",
"contractsFee": "1000",
"contractsNet": "999000",
"usdGross": "500000",
"usdFee": "500",
"usdNet": "499500"
},
"reason": "settlement transaction reverted",
"eligibleAt": "2026-06-08T10:15:30.000Z",
"tradeEventId": "4aa706dd-6c57-4f3c-945a-99818dfd95f1",
"txHash": "0xabc123",
"clientOrderId": "client-order-001",
"stpMakerCancels": [
"4aa706dd-6c57-4f3c-945a-99818dfd95f1"
]
},
"makerMatches": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"matchedSize": "1000000",
"fillPrice": "0.55",
"fillCost": "550000",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"maker": "<string>",
"price": "0.55",
"side": 0,
"tokenId": "<string>",
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"points": 0,
"referredUsersCount": 0
}
}
}
]
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}Cancel and Replace Order
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,
"nonce": 0,
"feeRateBps": 0,
"side": 0,
"signature": "0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "biden-vs-trump-2024",
"postOnly": true,
"clientOrderId": "client-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,
"nonce": 0,
"feeRateBps": 0,
"side": 0,
"signature": "0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b",
"signatureType": 2,
"taker": "0x0000000000000000000000000000000000000000",
"expiration": "0",
"price": 0.75
},
"ownerId": 12345,
"orderType": "GTC",
"marketSlug": "biden-vs-trump-2024",
"postOnly": True,
"clientOrderId": "client-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,
nonce: 0,
feeRateBps: 0,
side: 0,
signature: '0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b',
signatureType: 2,
taker: '0x0000000000000000000000000000000000000000',
expiration: '0',
price: 0.75
},
ownerId: 12345,
orderType: 'GTC',
marketSlug: 'biden-vs-trump-2024',
postOnly: true,
clientOrderId: 'client-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,
'nonce' => 0,
'feeRateBps' => 0,
'side' => 0,
'signature' => '0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b',
'signatureType' => 2,
'taker' => '0x0000000000000000000000000000000000000000',
'expiration' => '0',
'price' => 0.75
],
'ownerId' => 12345,
'orderType' => 'GTC',
'marketSlug' => 'biden-vs-trump-2024',
'postOnly' => true,
'clientOrderId' => 'client-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 \"nonce\": 0,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"biden-vs-trump-2024\",\n \"postOnly\": true,\n \"clientOrderId\": \"client-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 \"nonce\": 0,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"biden-vs-trump-2024\",\n \"postOnly\": true,\n \"clientOrderId\": \"client-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 \"nonce\": 0,\n \"feeRateBps\": 0,\n \"side\": 0,\n \"signature\": \"0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b\",\n \"signatureType\": 2,\n \"taker\": \"0x0000000000000000000000000000000000000000\",\n \"expiration\": \"0\",\n \"price\": 0.75\n },\n \"ownerId\": 12345,\n \"orderType\": \"GTC\",\n \"marketSlug\": \"biden-vs-trump-2024\",\n \"postOnly\": true,\n \"clientOrderId\": \"client-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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"clientOrderId": "<string>"
},
"replacement": {
"status": "SUCCESS",
"data": {
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"salt": "1778155025318314496",
"maker": "<string>",
"signer": "<string>",
"tokenId": "<string>",
"signatureType": 0,
"signature": "<string>",
"orderType": "GTC",
"side": 0,
"marketId": "<string>",
"ownerId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"market": {
"id": 7348,
"slug": "btc-up-or-down-1-hour",
"title": "BTC Up or Down - Hourly",
"status": "FUNDED",
"yesPositionId": "11514974713064423461...",
"noPositionId": "14525308260861904048...",
"group": {
"id": 42,
"slug": "btc-price-markets",
"title": "BTC Price Markets"
}
},
"makerAmount": 5000000,
"takerAmount": 10000000,
"nonce": 0,
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"rankName": "<string>",
"points": 123,
"referredUsersCount": 123,
"isTop100": true,
"leaderboardPosition": 123
},
"taker": "<string>",
"expiration": "2023-11-07T05:31:56Z",
"feeRateBps": 123,
"price": 0.75
},
"execution": {
"matched": true,
"settlementStatus": "MINED",
"feeRateBps": 25,
"effectiveFeeBps": 26,
"totalsRaw": {
"contractsGross": "1000000",
"contractsFee": "1000",
"contractsNet": "999000",
"usdGross": "500000",
"usdFee": "500",
"usdNet": "499500"
},
"reason": "settlement transaction reverted",
"eligibleAt": "2026-06-08T10:15:30.000Z",
"tradeEventId": "4aa706dd-6c57-4f3c-945a-99818dfd95f1",
"txHash": "0xabc123",
"clientOrderId": "client-order-001",
"stpMakerCancels": [
"4aa706dd-6c57-4f3c-945a-99818dfd95f1"
]
},
"makerMatches": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"matchedSize": "1000000",
"fillPrice": "0.55",
"fillCost": "550000",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"maker": "<string>",
"price": "0.55",
"side": 0,
"tokenId": "<string>",
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"points": 0,
"referredUsersCount": 0
}
}
}
]
}
}
}{
"message": [
{
"field": "orderIds",
"message": "orderIds should not be empty"
}
],
"error": "Bad Request",
"statusCode": 400
}{
"message": "<string>",
"error": "<string>",
"statusCode": 123
}{
"message": "<string>"
}{
"message": "<string>",
"error": "<string>",
"statusCode": 123
}{
"cancel": {
"status": "SUCCESS",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"clientOrderId": "<string>"
},
"replacement": {
"status": "SUCCESS",
"data": {
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"salt": "1778155025318314496",
"maker": "<string>",
"signer": "<string>",
"tokenId": "<string>",
"signatureType": 0,
"signature": "<string>",
"orderType": "GTC",
"side": 0,
"marketId": "<string>",
"ownerId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"market": {
"id": 7348,
"slug": "btc-up-or-down-1-hour",
"title": "BTC Up or Down - Hourly",
"status": "FUNDED",
"yesPositionId": "11514974713064423461...",
"noPositionId": "14525308260861904048...",
"group": {
"id": 42,
"slug": "btc-price-markets",
"title": "BTC Price Markets"
}
},
"makerAmount": 5000000,
"takerAmount": 10000000,
"nonce": 0,
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"rankName": "<string>",
"points": 123,
"referredUsersCount": 123,
"isTop100": true,
"leaderboardPosition": 123
},
"taker": "<string>",
"expiration": "2023-11-07T05:31:56Z",
"feeRateBps": 123,
"price": 0.75
},
"execution": {
"matched": true,
"settlementStatus": "MINED",
"feeRateBps": 25,
"effectiveFeeBps": 26,
"totalsRaw": {
"contractsGross": "1000000",
"contractsFee": "1000",
"contractsNet": "999000",
"usdGross": "500000",
"usdFee": "500",
"usdNet": "499500"
},
"reason": "settlement transaction reverted",
"eligibleAt": "2026-06-08T10:15:30.000Z",
"tradeEventId": "4aa706dd-6c57-4f3c-945a-99818dfd95f1",
"txHash": "0xabc123",
"clientOrderId": "client-order-001",
"stpMakerCancels": [
"4aa706dd-6c57-4f3c-945a-99818dfd95f1"
]
},
"makerMatches": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"matchedSize": "1000000",
"fillPrice": "0.55",
"fillCost": "550000",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"maker": "<string>",
"price": "0.55",
"side": 0,
"tokenId": "<string>",
"owner": {
"id": 123,
"account": "<string>",
"client": "<string>",
"tradeWalletOption": "eoa",
"smartWallet": "<string>",
"username": "<string>",
"displayName": "<string>",
"pfpUrl": "<string>",
"socialUrl": "<string>",
"points": 0,
"referredUsersCount": 0
}
}
}
]
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}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 cancelled. Put onBehalfOf only at the operation level, not inside replacement.
The x-on-behalf-of header is not supported by this endpoint.
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
Use a scoped API token with thetrading 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 cancelled.
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,
"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 replacement even if cancellation fails. The replacement reports its own result. The response remains 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": "FAILURE",
"error": {
"code": "400",
"message": "Insufficient balance"
}
}
}
Validation and outcomes
Request-level authentication, authorization, validation, market, signature, maintenance-mode, and receive-window failures return their ordinary HTTP status without a cancel/replace result. Maintenance-mode and receive-window rejections use425 Too Early.
A successful cancellation does not guarantee replacement success. Insufficient balance or allowance can produce cancel.status: "SUCCESS" with replacement.status: "FAILURE" and an HTTP-status error code such as "400"; the endpoint returns 409 Conflict.
A receive-window or trading-availability rejection can likewise produce a successful cancellation with replacement.status: "FAILURE" and error.code: "425".
{
"cancel": {
"status": "SUCCESS",
"orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203"
},
"replacement": {
"status": "FAILURE",
"error": {
"code": "425",
"message": "order receive window expired: elapsed=2500ms, window=1500ms"
}
}
}
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 attempted | 409 Conflict |
| The service returns any other non-success top-level result | 409 Conflict |
ORDER_NOT_FOUND; request failures use their decimal HTTP status such as 400, 404, 409, 425, or 500; other failures use INTERNAL_ERROR. FAILURE identifies a known failure and UNKNOWN an inconclusive outcome. Cancellation authorization failures remain request-level 401 or 403 responses.
replacement.status: "SUCCESS" means the placement was accepted. 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
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
ALLOW_FAILURE, STOP_ON_FAILURE "STOP_ON_FAILURE"
Authorized partner sub-account profile ID. Applies to both cancellation and replacement.
x >= 112345
Response
Cancellation and replacement both succeeded
Independent cancellation and replacement outcomes.
- Option 1
- Option 2
Show child attributes
Show child attributes
The matching engine accepted the replacement. The canonical created-order, owner, maker-match, and execution schemas are reused; nested settlementStatus may still be FAILED with a free-form reason.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes