> ## 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.

# Cancel individual orders

> Cancel specific open orders by order hash on the SX Bet exchange.

<Note>**Rate limit:** All `POST /orders/*` endpoints share a combined limit of 5,500 requests/min. See [Rate Limits](/developers/rate-limits).</Note>


## OpenAPI

````yaml POST /orders/cancel/v2
openapi: 3.0.1
info:
  title: SX Bet API
  version: 1.0.0
  description: >-
    REST API for the SX Bet decentralized sports betting exchange. Retrieve
    sports data, markets, and orderbook information. Post, cancel, and fill
    orders with signed payloads.


    Base URLs:

    - **Mainnet**: `https://api.sx.bet`

    - **Testnet**: `https://api.toronto.sx.bet`
servers:
  - url: https://api.sx.bet
    description: Mainnet (SX Network, chainId 4162)
  - url: https://api.toronto.sx.bet
    description: Testnet (Toronto, chainId 79479957)
security: []
tags:
  - name: Connection
    description: Server metadata and heartbeat management
  - name: Sports Data
    description: Sports, leagues, teams, fixtures, and live scores
  - name: Markets
    description: Active, specific, and popular betting markets
  - name: Trades
    description: Matched trades and portfolio history
  - name: Orders
    description: Orderbook queries, posting, cancelling, and filling orders
paths:
  /orders/cancel/v2:
    post:
      tags:
        - Orders
      summary: Cancel orders
      description: >-
        This endpoint cancels existing orders on the exchange that you placed as
        a market maker. If passed orders that do not exist, they simply fail
        silently while the others will succeed.
      operationId: cancelOrders
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - orderHashes
                - signature
                - salt
                - maker
                - timestamp
              properties:
                orderHashes:
                  type: array
                  items:
                    type: string
                  description: The order hashes to cancel
                signature:
                  type: string
                  description: >-
                    Your wallet signature over the cancel payload. See the Order
                    Signing reference for details on how to compute this.
                salt:
                  type: string
                  description: A random 32 bytes hex string to protect against replay
                maker:
                  type: string
                  description: The account from which you are cancelling orders
                timestamp:
                  type: integer
                  description: >-
                    The current timestamp in UNIX seconds to protect against
                    replay
            example:
              orderHashes:
                - >-
                  0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506
              signature: 0x...
              salt: 0x...
              maker: 0xYourWalletAddress
              timestamp: 1704067200
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: '`success` or `failure` if the request succeeded or not'
                  data:
                    type: object
                    properties:
                      cancelledCount:
                        type: number
                        description: How many orders were cancelled, of the orders passed
                      orders:
                        type: array
                        description: >-
                          An array of Cancelled Order objects. Omitted if cancel
                          count is 0.
                        items:
                          type: object
                          properties:
                            orderHash:
                              type: string
                              description: Cancelled order hash
                            pendingFills:
                              type: array
                              description: >-
                                The pending fills awaiting confirmation on
                                chain. Expected to succeed and fill order.
                              items:
                                type: object
                                properties:
                                  fillHash:
                                    type: string
                                    description: The fill hash which is pending
                                  pendingFillAmount:
                                    type: string
                                    description: >-
                                      The amount of the order that this fill is
                                      attempting to fill
              example:
                status: success
                data:
                  cancelledCount: 1
                  orders:
                    - orderHash: >-
                        0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45
                      pendingFills:
                        - fillHash: >-
                            0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l
                          pendingFillAmount: '1806995918'
        '400':
          description: >-
            Error Codes:


            `CANCEL_REQUEST_ALREADY_PROCESSED` — This cancellation is already
            processed


            `SIGNATURE_MISMATCH` — The provided signature does not match the
            cancel payload
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  errorCode:
                    type: string
      x-codeSamples:
        - lang: javascript
          label: Sign & Cancel Orders
          source: >-
            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());
        - lang: python
          label: Sign & Cancel Orders
          source: >-
            import os, secrets, requests

            from eth_account import Account


            account = Account.from_key(os.environ["SX_PRIVATE_KEY"])


            order_hashes =
            ["0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506"]

            salt = "0x" + secrets.token_bytes(32).hex()

            timestamp = int(__import__("time").time())

            chain_id = 4162  # Mainnet — use 79479957 for testnet


            signed = Account.sign_typed_data(
                account.key,
                domain_data={
                    "name": "CancelOrderV2SportX",
                    "version": "1.0",
                    "chainId": chain_id,
                    "salt": salt,
                },
                message_types={
                    "Details": [
                        {"name": "orderHashes", "type": "string[]"},
                        {"name": "timestamp", "type": "uint256"},
                    ]
                },
                message_data={"orderHashes": order_hashes, "timestamp": timestamp},
            )


            result = requests.post(
                "https://api.sx.bet/orders/cancel/v2",  # Mainnet — use https://api.toronto.sx.bet for testnet
                json={
                    "orderHashes": order_hashes,
                    "signature": "0x" + signed.signature.hex(),
                    "salt": salt,
                    "maker": account.address,
                    "timestamp": timestamp,
                },
            )

            print(result.json())

````