Skip to main content

Batch Cancel Order

This endpoint allows you to cancel more than one open order in a single request.

important
  • You must specify orderId or orderLinkId.
  • If orderId and orderLinkId is not matched, the system will process orderId first.
  • You can cancel unfilled or partially filled orders.
  • A maximum of 20 orders (option), 10 orders (inverse), 10 orders (linear), 10 orders (spot) can be cancelled per request.

HTTP Request

POST /v5/order/cancel-batch

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type
  • UTA2.0: linear, option, spot, inverse
  • UTA1.0: linear, option, spot
  • requesttruearrayObject
    > symboltruestringSymbol name, like BTCUSDT, uppercase only
    > orderIdfalsestringOrder ID. Either orderId or orderLinkId is required
    > orderLinkIdfalsestringUser customised order ID. Either orderId or orderLinkId is required

    Response Parameters

    ParameterTypeComments
    resultObject
    > listarrayObject
    >> categorystringProduct type
    >> symbolstringSymbol name
    >> orderIdstringOrder ID
    >> orderLinkIdstringUser customised order ID
    retExtInfoObject
    > listarrayObject
    >> codenumberSuccess/error code
    >> msgstringSuccess/error message
    info

    The ack of cancel order request indicates that the request is successfully accepted. Please use websocket order stream to confirm the order status


    Request Example

    POST /v5/order/cancel-batch HTTP/1.1
    Host: api-testnet.bybit.com
    X-BAPI-SIGN: XXXXX
    X-BAPI-API-KEY: XXXXX
    X-BAPI-TIMESTAMP: 1672223356634
    X-BAPI-RECV-WINDOW: 5000
    Content-Type: application/json

    {
    "category": "spot",
    "request": [
    {
    "symbol": "BTCUSDT",
    "orderId": "1666800494330512128"
    },
    {
    "symbol": "ATOMUSDT",
    "orderLinkId": "1666800494330512129"
    }
    ]
    }

    Response Example

    {
    "retCode": 0,
    "retMsg": "OK",
    "result": {
    "list": [
    {
    "category": "spot",
    "symbol": "BTCUSDT",
    "orderId": "1666800494330512128",
    "orderLinkId": "spot-btc-03"
    },
    {
    "category": "spot",
    "symbol": "ATOMUSDT",
    "orderId": "",
    "orderLinkId": "1666800494330512129"
    }
    ]
    },
    "retExtInfo": {
    "list": [
    {
    "code": 0,
    "msg": "OK"
    },
    {
    "code": 170213,
    "msg": "Order does not exist."
    }
    ]
    },
    "time": 1713434299047
    }