Skip to main content

Cancel Multi Orderโ€‹

Use this API to cancel all open orders in one go. You can filter by segment or tag to cancel specific orders, or cancel all open orders with a single request. This applies to both AMO and regular orders. The order_ids of the cancelled orders will be returned in the response.

A maximum of 50 orders can be cancelled in a single request. Any request exceeding this limit will be rejected. The Cancel Multi Order API is subject to a different rate limit compared to the standard limits applied across the system. For more information on the rate limits for this API, please check here.

Requestโ€‹

curl --location --request DELETE 'https://api.upstox.com/v2/order/multi/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'

For additional samples in various languages, please refer to the Sample code section on this page.

Query Parametersโ€‹

NameRequiredTypeDescription
segmentfalsestringThe segment associated with the open orders.
Possible values: NSE_EQ, BSE_EQ, NSE_FO, BSE_FO, MCX_FO, NCD_FO, BCD_FO, NSE_COM.
tagfalsestringThe tag associated with the open orders.

Responses

Response Bodyโ€‹

{
"status": "success",
"data": {
"order_ids": [
"1644490272000",
"1644490272001",
"1644490272003"
]
},
"errors": null,
"summary": {
"total": 3,
"success": 3,
"error": 0
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Possible values: success, partial_success, error.

success - when all the cancel order request are successful.
partial_success - when some cancel order request encountered errors.
error - when all the cancel order request encountered errors.
dataobjectSuccessful response data for cancel multi order request.
data.order_idsarrayList of reference order IDs associated with successfully cancelled orders.
errorsarrayAn array containing the main content of the error response for partial_success and error scenarios.
errors[].error_codestringA specific error code.
errors[].messagestringDescriptive error message.
errors[].property_pathstringIndicates which part of the request triggered the error. It can be null.
errors[].invalid_valuestringShows the value causing the error. It can be null.
errors[].instrument_keystringA Key of instrument for a specific order.
errors[].order_idstringOrder ID associated to specific order. It can be null.
summaryobjectA summary of the outcomes for the batch of orders processed, detailing total orders, successful completions, and errors.
summary.totalintegerThe total number of order present in the payload for cancel multi orders.
summary.successintegerIndicates the successful cancelled orders.
summary.errorintegerIndicates the unsuccessful cancelled orders.

Sample Codeโ€‹

Cancel all the open ordersโ€‹

curl --location --request DELETE 'https://api.upstox.com/v2/order/multi/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'

Cancel all the open orders for a given segmentโ€‹

curl --location --request DELETE 'https://api.upstox.com/v2/order/multi/cancel?segment=NSE_FO' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'

Cancel all the open orders for a given tagโ€‹

curl --location --request DELETE 'https://api.upstox.com/v2/order/multi/cancel?tag=xyz' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
Loading...