JavaScript
import { Wallet, hexlify, randomBytes } from "ethers";
const wallet = new Wallet(process.env.SX_PRIVATE_KEY);
const orderHashes = [
"0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506",
];
const salt = hexlify(randomBytes(32));
const timestamp = Math.floor(Date.now() / 1000);
const chainId = 4162; // Mainnet — use 79479957 for testnet
const domain = {
name: "CancelOrderV2SportX",
version: "1.0",
chainId,
salt,
};
const types = {
Details: [
{ name: "orderHashes", type: "string[]" },
{ name: "timestamp", type: "uint256" },
],
};
const signature = await wallet.signTypedData(domain, types, { orderHashes, timestamp });
const result = await fetch("https://api.sx.bet/orders/cancel/v2", { // Mainnet — use https://api.toronto.sx.bet for testnet
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
orderHashes,
signature,
salt,
maker: wallet.address,
timestamp,
}),
});
console.log(await result.json());{
"status": "success",
"data": {
"cancelledCount": 1,
"orders": [
{
"orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
"pendingFills": [
{
"fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
"pendingFillAmount": "1806995918"
}
]
}
],
"notCancelled": [
{
"orderHash": "0x9b1a4f5e7c0d3b2a6e8f1c4d5e7a9b0c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a",
"reason": "not_found_or_inactive"
}
]
}
}Orders
Cancel individual orders
Cancel specific open orders by order hash on the SX Bet exchange.
POST
/
orders
/
cancel
/
v2
JavaScript
import { Wallet, hexlify, randomBytes } from "ethers";
const wallet = new Wallet(process.env.SX_PRIVATE_KEY);
const orderHashes = [
"0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506",
];
const salt = hexlify(randomBytes(32));
const timestamp = Math.floor(Date.now() / 1000);
const chainId = 4162; // Mainnet — use 79479957 for testnet
const domain = {
name: "CancelOrderV2SportX",
version: "1.0",
chainId,
salt,
};
const types = {
Details: [
{ name: "orderHashes", type: "string[]" },
{ name: "timestamp", type: "uint256" },
],
};
const signature = await wallet.signTypedData(domain, types, { orderHashes, timestamp });
const result = await fetch("https://api.sx.bet/orders/cancel/v2", { // Mainnet — use https://api.toronto.sx.bet for testnet
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
orderHashes,
signature,
salt,
maker: wallet.address,
timestamp,
}),
});
console.log(await result.json());{
"status": "success",
"data": {
"cancelledCount": 1,
"orders": [
{
"orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
"pendingFills": [
{
"fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
"pendingFillAmount": "1806995918"
}
]
}
],
"notCancelled": [
{
"orderHash": "0x9b1a4f5e7c0d3b2a6e8f1c4d5e7a9b0c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a",
"reason": "not_found_or_inactive"
}
]
}
}Rate limit: All
POST /orders/* endpoints share a combined limit of 5,500 requests/min. See Rate Limits.Partial success: Order hashes from the request that were not cancelled are returned in
data.notCancelled with a reason; the remaining orders are cancelled normally.Body
application/json
The order hashes to cancel
Your wallet signature over the cancel payload. See the Order Signing reference for details on how to compute this.
A random 32 bytes hex string to protect against replay
The account from which you are cancelling orders
The current timestamp in UNIX seconds to protect against replay
Last modified on May 11, 2026
⌘I
