Skip to main content

Cancel GTT Order

This API allows the cancellation of an existing Good Till Trigger (GTT) order that has not yet been triggered. Once canceled, all associated legs will be canceled and will no longer be monitored for execution, and all related trigger conditions will be discarded.


Request

curl --location --request DELETE 'https://api.upstox.com/v3/order/gtt/cancel' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--header 'Content-Type: application/json' \
--data '{
"gtt_order_id": "GTT-C25280200137522"
}'

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

Request Body

NameRequiredTypeDescription
gtt_order_idtruestringThe order ID for which the order must be cancelled.

Responses

Response Body

{
"status": "success",
"data": {
"gtt_order_ids": ["GTT-CU25280200018007"]
},
"metadata": {
"latency": 65
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request.
Possible values: success, error
dataobjectResponse data for cancel order request.
data.gtt_order_idstringThe Order ID submitted for cancellation.
metadataobjectMetadata information.
metadata.latencyintegerThe overall time taken by API platform to process the request, measured in milliseconds.

Sample Code

Cancel GTT Order

import requests

url = 'https://api.upstox.com/v3/order/gtt/cancel'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}',
}

data = {
'gtt_order_id': 'GTT-C25280200137522'
}

try:
# Send the DELETE request
response = requests.delete(url, json=data, headers=headers)

# Print the response status code and body
print('Response Code:', response.status_code)
print('Response Body:', response.json())

except Exception as e:
# Handle exceptions
print('Error:', str(e))

Loading...