The Ably Websocket API is being deprecated on July 1, 2026. See the migration guide →
import { Wallet, hexlify, randomBytes } from "ethers";
const wallet = new Wallet(process.env.SX_PRIVATE_KEY);
const salt = hexlify(randomBytes(32));
const timestamp = Math.floor(Date.now() / 1000);
const chainId = 4162; // Mainnet — use 79479957 for testnet
const domain = {
name: "CancelAllOrdersSportX",
version: "1.0",
chainId,
salt,
};
const types = {
Details: [{ name: "timestamp", type: "uint256" }],
};
const signature = await wallet.signTypedData(domain, types, { timestamp });
const apiPayload = {
signature,
salt,
maker: wallet.address,
timestamp,
};
const result = await fetch("https://api.sx.bet/orders/cancel/all", { // Mainnet — use https://api.toronto.sx.bet for testnet
method: "POST",
body: JSON.stringify(apiPayload),
headers: { "Content-Type": "application/json" },
});{
"status": "success",
"data": {
"cancelledCount": 1,
"orders": [
{
"orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
"pendingFills": [
{
"fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
"pendingFillAmount": "1806995918"
}
]
}
],
"notCancelled": [
{
"orderHash": "0x9b1a4f5e7c0d3b2a6e8f1c4d5e7a9b0c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a",
"reason": "order_locked"
}
]
}
}Cancel all your open orders across all markets on SX Bet.
import { Wallet, hexlify, randomBytes } from "ethers";
const wallet = new Wallet(process.env.SX_PRIVATE_KEY);
const salt = hexlify(randomBytes(32));
const timestamp = Math.floor(Date.now() / 1000);
const chainId = 4162; // Mainnet — use 79479957 for testnet
const domain = {
name: "CancelAllOrdersSportX",
version: "1.0",
chainId,
salt,
};
const types = {
Details: [{ name: "timestamp", type: "uint256" }],
};
const signature = await wallet.signTypedData(domain, types, { timestamp });
const apiPayload = {
signature,
salt,
maker: wallet.address,
timestamp,
};
const result = await fetch("https://api.sx.bet/orders/cancel/all", { // Mainnet — use https://api.toronto.sx.bet for testnet
method: "POST",
body: JSON.stringify(apiPayload),
headers: { "Content-Type": "application/json" },
});{
"status": "success",
"data": {
"cancelledCount": 1,
"orders": [
{
"orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
"pendingFills": [
{
"fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
"pendingFillAmount": "1806995918"
}
]
}
],
"notCancelled": [
{
"orderHash": "0x9b1a4f5e7c0d3b2a6e8f1c4d5e7a9b0c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a",
"reason": "order_locked"
}
]
}
}Documentation Index
Fetch the complete documentation index at: https://docs.sx.bet/llms.txt
Use this file to discover all available pages before exploring further.
POST /orders/* endpoints share a combined limit of 5,500 requests/min. See Rate Limits.data.notCancelled with a reason; the remaining orders are cancelled normally.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.