Skip to main content

Batch Cancel Order

tip

This endpoint provides the batch order mode to cancel a bunch of open orders.

  • Order cancellation of future and option cannot be cancelled in one request.
  • If both future and option orders are in one request, then by given the category type, only the orders whose symbol matches the category will be operated.

HTTP Request

POST /unified/v3/private/order/cancel-batch

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type. linear,option
requesttruearrayObject
> symboltruestringSymbol name
> orderIdfalsestringOrder id. Either orderId or orderLinkId is required
> orderLinkIdfalsestringUser customised order id. Either orderId or orderLinkId is required

Response Parameters

ParameterTypeComments
resultObject
> listarrayObject
>> categorystringProducts category
>> symbolstringSymbol name
>> orderIdstringOrder id
>> orderLinkIdstringUser customised order id
retExtInfoObject
> listarrayObject
>> codeintegerSuccess/error code
>> msgstringSuccess/error message

Request Example

POST /unified/v3/private/order/cancel-batch HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN-TYPE: 2
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672818987475
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json

{
"category": "linear",
"request": [
{
"symbol": "ETHUSDT",
"orderLinkId": "test-002"
},
{
"symbol": "XRPUSDT",
"orderLinkId": "test-003"
}
]
}

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"category": "linear",
"symbol": "ETHUSDT",
"orderId": "",
"orderLinkId": "test-002"
},
{
"category": "linear",
"symbol": "XRPUSDT",
"orderId": "",
"orderLinkId": "test-003"
}
]
},
"retExtInfo": {
"list": [
{
"code": 0,
"msg": "success"
},
{
"code": 110001,
"msg": "order not exists or too late to cancel"
}
]
},
"time": 1672818989928
}