Skip to main content

Place Order Sandbox Enabled Deprecated

API to place an order to the exchange. The instrument_token required for the stock or contracts should be obtained from the BOD instruments.

Upon successfully placing the order with the exchange, a unique order_id is provided in the success response, which can be utilized for order modification or cancellation. If you intend to place an order outside of market hours, the 'is_amo' (After Market Order) should be set to 'true'. You can assign a tag(unique identifier) to your order, allowing you to retrieve orders associated with that tag using the Order History API.

Request

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "D",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_EQ|INE669E01016",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": false
}'
Important

The is_amo flag in the order request will be ignored, and the system will automatically infer its value based on the current market session. If an order is placed during active trading hours, it will be processed as a live order regardless of whether is_amo: true was sent.

Additional samples in various languages are available in the Sample Code section on this page.

Request Body

NameRequiredTypeDescription
quantitytrueinteger (int32)Quantity with which the order is to be placed.
For commodity - number of lots is accepted.
For other Futures & Options and equities - number of units is accepted in multiples of the tick size.
producttruestringSignifies if the order was either Intraday or Delivery.
Possible values: I, D, MTF.
validitytruestringIt can be one of the following - DAY(default), IOC.
Possible values: DAY, IOC.
pricetruenumber (float)Price at which the order will be placed
tagfalsestringTag for a particular order
instrument_tokentruestringKey of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix.
order_typetruestringType of order. It can be one of the following MARKET refers to market order LIMIT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market.
Possible values: MARKET, LIMIT, SL, SL-M.
transaction_typetruestringIndicates whether its a buy or sell order.
Possible values: BUY, SELL.
disclosed_quantitytrueinteger (int32)The quantity that should be disclosed in the market depth
trigger_pricetruenumber (float)If the order is a stop loss order then the trigger price to be set is mentioned here
is_amotruebooleanSignifies if the order is an After Market Order
Responses

Response Body

{
"status": "success",
"data": {
"order_id": "1644490272000"
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobjectResponse data for place order request
data.order_idstringAn order ID for the order request placed

Sample Code

Place a delivery market order

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "D",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_EQ|INE669E01016",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": false
}'

Place a delivery limit order

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "D",
"validity": "DAY",
"price": 13,
"tag": "string",
"instrument_token": "NSE_EQ|INE669E01016",
"order_type": "LIMIT",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 13.2,
"is_amo": false
}'

Place a delivery stop-loss order

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "D",
"validity": "DAY",
"price": 14.05,
"tag": "string",
"instrument_token": "NSE_EQ|INE669E01016",
"order_type": "SL",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 13,
"is_amo": false
}'

Place a delivery stop-loss order market

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "D",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_EQ|INE669E01016",
"order_type": "SL-M",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 15,
"is_amo": false
}'

Place an intraday market order

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "I",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_EQ|INE528G01035",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": false
}'

Place an intraday limit order

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "I",
"validity": "DAY",
"price": 20.0,
"tag": "string",
"instrument_token": "NSE_EQ|INE528G01035",
"order_type": "LIMIT",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 20.1,
"is_amo": false
}'

Place an intraday stop-loss order

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "I",
"validity": "DAY",
"price": 20.0,
"tag": "string",
"instrument_token": "NSE_EQ|INE528G01035",
"order_type": "SL",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 19.5,
"is_amo": false
}'

Place an intraday stop-loss market order

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "I",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_EQ|INE528G01035",
"order_type": "SL-M",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 21.5,
"is_amo": false
}'

Place a delivery market amo (after market order)

curl --location 'https://api-hft.upstox.com/v2/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 1,
"product": "D",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_EQ|INE669E01016",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": true
}'

Loading...