Skip to main content
POST 

/order/gtt/place

Place GTT Order

Good Till Triggered (GTT) order is a condition-based order that remains active until the defined condition (rule) is met. A rule is a precise condition that determines when the system should execute an order. This order can be executed as a single-leg or multi-leg operation, with each leg scheduled to place an order based on a specific rule. Once the condition is met, the order is placed automatically.

Single-Leg Trigger

This order uses one rule to place an order when the condition is satisfied. The opening strategy is called ENTRY, where you define a condition to BUY or SELL a stock when the price is above, below, or equal to the trigger price. Once the order is placed, the GTT is complete.

Multi-Leg Trigger

This order involves more than one rule and includes follow-up actions. The ENTRY strategy remains the same as in the Single-Leg Trigger, but additional actions can be set.

You can follow the ENTRY strategy with:

  • TARGET: A condition to exit the position once the desired price level is reached.
  • STOPLOSS: A condition to exit the position when the price moves unfavorably beyond a set threshold.

For example, if your ENTRY is a BUY, the TARGET and STOPLOSS will be SELL orders, and vice versa.

Trailing Stop Loss Order Beta

A trailing stop loss order is a dynamic order that automatically adjusts with market price movements, maintaining a consistent distance from the current market price as it moves.

Trailing Stop Loss (TSL) orders are implemented as Multi-leg GTT orders and in the STOPLOSS leg an additional parameter trailing_gap is required. This defines the consistent gap between your stop-loss and the market price, letting your stop-loss trail automatically. For more details on TSL orders, refer to our Trailing Stop Loss Order article.

  • While order placement requests are made through a Registered app, the X-Algo-Name header is optional and only required if you have an exchange-approved algo strategy. When applicable, the value of this header should match one of the Algo names configured in the app settings.

Request

curl --location 'https://api.upstox.com/v3/order/gtt/place' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"type": "SINGLE",
"quantity": 1,
"product": "D",
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 6,
"market_protection": 0
}
],
"instrument_token": "NSE_EQ|INE669E01016",
"transaction_type": "BUY"
}'

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

Request Body

NameRequiredTypeDescription
typeRequiredstringSpecifies the GTT order type. Indicates if it's a single or multi-leg order.
Possible values: SINGLE, MULTIPLE.
quantityRequiredintegerQuantity with which the order is to be placed.
productRequiredstringSignifies if the order was either Intraday, Delivery or MTF.
Possible values: I, D, MTF.
instrument_tokenRequiredstringKey of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix.
transaction_typeRequiredstringIndicates whether its a buy or sell order.
Possible values: BUY, SELL.
rulesRequiredarrayContains the conditions under which the order should be triggered.
rules[].strategyRequiredstringDefines the role of the rule.
Possible values: ENTRY, TARGET, STOPLOSS

ENTRY - The initial condition to place a BUY or SELL order when the trigger price is met. Having an ENTRY rule is mandatory.
TARGET - A condition to exit the position once the desired price level is reached after the ENTRY order is executed.
STOPLOSS - A condition to exit the position when the price moves unfavorably beyond a set threshold.
rules[].trigger_typeRequiredstringSpecifies the condition for triggering the order. The ENTRY strategy can have ABOVE, BELOW, or IMMEDIATE, whereas TARGET and STOPLOSS strategies can only have IMMEDIATE.
Possible values: BELOW, ABOVE, IMMEDIATE

BELOW - The order is triggered when the market price drops below the defined trigger price.
ABOVE - The order is triggered when the market price rises above the defined trigger price.
IMMEDIATE - Limit order at user-specified price is sent immediately to the exchange irrespective of the LTP. This order is valid for a day. If the primary leg gets completed then SL and Target legs are valid for 365 days.
rules[].trigger_priceRequiredfloatThe price at which the order should be triggered based on the defined condition.
rules[].trailing_gapOptionalfloatOnly applicable for STOPLOSS strategy for TSL orders. This defines the consistent gap between your stop-loss and the market price, letting your stop-loss trail automatically.
Note: The minimum value for trailing gap is 10% of difference between LTP and stop loss trigger price.
rules[].market_protectionOptionalinteger (int32)Applicable for all three ENTRY, TARGET, and STOPLOSS strategies, for Market and Stoploss Market (SL-M) orders. This will be ignored if used with Limit or Stoploss Limit (SL) orders.
Default: -1.
-1 = Automatic market protection as per guidelines. For more details, see Market Protection details.
125 = Custom market protection percentage (e.g. 2 for 2%).
0 = No market protection (Order will be rejected due to exchange restrictions on MARKET orders from API).

Responses

Response Body

{
"status": "success",
"data": {
"gtt_order_ids": ["GTT-CU25280200021013"]
},
"metadata": {
"latency": 88
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request.
Possible values: success, error
dataobjectResponse data for place order request
data.gtt_order_ids[]stringAn array holding the GTT Order ID for the request placed
metadataobjectMetadata information.
metadata.latencyintegerThe overall time taken by API platform to process the request, measured in milliseconds.

Sample Code

Place Single Leg GTT Order

curl --location 'https://api.upstox.com/v3/order/gtt/place' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"type": "SINGLE",
"quantity": 1,
"product": "D",
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 6
}
],
"instrument_token": "NSE_EQ|INE669E01016",
"transaction_type": "BUY"
}'

Place Multiple Leg GTT Order

curl --location 'https://api.upstox.com/v3/order/gtt/place' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"type": "MULTIPLE",
"quantity": 1,
"product": "I",
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 7.3
},
{
"strategy": "TARGET",
"trigger_type": "IMMEDIATE",
"trigger_price": 9
},
{
"strategy": "STOPLOSS",
"trigger_type": "IMMEDIATE",
"trigger_price": 6
}
],
"instrument_token": "NSE_EQ|INE669E01016",
"transaction_type": "BUY"
}'

Place Trailing Stop Loss GTT Order

curl --location 'https://api.upstox.com/v3/order/gtt/place' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"type": "MULTIPLE",
"quantity": 1,
"product": "I",
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 7.3
},
{
"strategy": "TARGET",
"trigger_type": "IMMEDIATE",
"trigger_price": 9
},
{
"strategy": "STOPLOSS",
"trigger_type": "IMMEDIATE",
"trigger_price": 6,
"trailing_gap": 0.1
}
],
"instrument_token": "NSE_EQ|INE669E01016",
"transaction_type": "BUY"
}'
  • A GTT order is always placed as a LIMIT order upon execution.
  • To place GTT orders with a SELL leg, EDIS authorization is required. You can authorize EDIS from any of our platforms—Web, iOS, or Android by placing a GTT order. Once authorized on any one platform, it will also be valid for API-based orders. You don't need to complete the order; simply going through the authorization flow is sufficient.
  • We currently support a maximum of three rules with no duplicate strategies.
  • A GTT order remains valid for up to one year from the date of creation if the defined condition is not met.
  • Receiving GTT order updates via Webhook requires additional setup, detailed here.
  • Receiving GTT order updates via WebSocket requires additional setup, detailed here.