Skip to main content

Cancel order

A cancelled order is a previously submitted order to buy or sell a security that gets cancelled before it executes on an exchange.

As long as an order remains active or in a state of pending in the system, it can be canceled.

Method: POST

https://connect.thefirstock.com/api/V3/cancelOrder

Request details

ParameterDescriptionData TypesExample
userIdUser Id of the login userString"AA1999"
jKeyKey Obtained on login success.String" d9b4e1b1c79042476fd96
11eed81003b2dc34c3f13b0
b60a4842fd5a24c9f3f2v"
orderNumberorderNumber, which needs to be cancelledString"89089875"
curl --location 'https://connect.thefirstock.com/api/V3/cancelOrder' \
--header 'Content-Type: application/json' \
--data '{
"userId": "AA123",
"jKey": "e6a211bea63adff386578988e1cf4a9521c4744e6a39ad63174c8797e2af8c38",
"orderNumber": "11030800009600"
}'

Success response details

ParameterDescriptionData typesExamples
data.requestTimeReaponse received time.String "14:45:38 15-02-2023"
statusSuccessString"Success"
data.orderNumberorderNumber of the canceled order.String"1234567890111"

Failure response details

ParameterDescriptionData TypeExample
statusFailedString"Failed"
codeHTTP CodeString"404"
nameType of errorString"ORDER_NOT_FOUND"
error.fieldError fieldString"orderNumber"
error.messageError messageString"Order not found to cancel"

Sample response

{
"status": "Success",
"data": {
"requestTime": "14:45:38 15-02-2023",
"orderNumber": "1234567890111"
}
}