Skip to main content

Cancel Order

important
  • You must specify orderId or orderLinkId to cancel the order.
  • If orderId and orderLinkId do not match, the system will process orderId first.
  • You can only cancel unfilled or partially filled orders.

HTTP Request

POST /v5/order/cancel

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type. linear, inverse, spot, option
symboltruestringSymbol name, like BTCUSDT, uppercase only
orderIdfalsestringOrder ID. Either orderId or orderLinkId is required
orderLinkIdfalsestringUser customised order ID. Either orderId or orderLinkId is required
orderFilterfalsestringSpot trading only
  • Order
  • tpslOrder
  • StopOrder
If not passed, Order by default

Response Parameters

ParameterTypeComments
orderIdstringOrder ID
orderLinkIdstringUser customised order ID
info

The acknowledgement of an cancel order request indicates that the request was sucessfully accepted. This request is asynchronous so please use the websocket to confirm the order status.


Request Example

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

{
"category": "linear",
"symbol": "BTCPERP",
"orderLinkId": null,
"orderId":"c6f055d9-7f21-4079-913d-e6523a9cfffa"
}

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"orderId": "c6f055d9-7f21-4079-913d-e6523a9cfffa",
"orderLinkId": "linear-004"
},
"retExtInfo": {},
"time": 1672217377164
}