Orders¶
This section outlines the APIs for placing, modifying, canceling, and retrieving standard trading orders. The same endpoints serve every segment — segment in the request body selects between EQUITY, DERIVATIVE and COMMODITY.
| Request Type | Path | Description |
|---|---|---|
| POST | /order | Place a new order |
| POST | /order/modify | Modify a pending order |
| POST | /order/cancel | Cancel a pending order |
| GET | /order-book | Get the daily order book |
| GET | /order | Get details for a single order |
| GET | /order/trades | Get trades for a single order |
| GET | /trade-book | Get trade book for a segment |
Order Status Types¶
The following table describes the various order statuses that can be returned by the API:
| Status | Description |
|---|---|
| QUEUED | Order has been queued for processing |
| O-PENDING | After Market Order (AMO) is pending execution |
| SL-PENDING | Stop Loss order is pending trigger |
| PROCESSING | Order is currently being processed |
| ABORTED | Order was aborted due to system or validation issues |
| INITIATED | Order has been initiated and sent to the exchange |
| SUCCESS | Order has been successfully executed |
| CANCELLED | Order has been cancelled by user or system |
| MODIFIED | Order has been successfully modified |
| PENDING | Order is pending execution at the exchange |
| EXPIRED | Order has expired without execution |
| FAILED | Order execution failed due to technical or other issues |
| PARTIALLY FILLED | Order has been partially executed |
| PARTIALLY FILLED - CANCELLED | Order was partially executed and remaining quantity was cancelled |
| PARTIALLY FILLED - EXPIRED | Order was partially executed and remaining quantity expired |
Place Order¶
This API allows you to place a new standard order.
Endpoint
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
txn_type | string | ✅ | The transaction type. Enum: "BUY", "SELL" |
exchange | string | ✅ | The exchange to place the order on. Enum: "NSE", "BSE", "MCX" |
segment | string | ✅ | The market segment. Enum: "DERIVATIVE", "EQUITY", "COMMODITY" |
product | string | ✅ | The product type. Enum: "MARGIN", "INTRADAY", "CNC". Valid per segment: EQUITY → CNC, INTRADAY; DERIVATIVE → MARGIN, INTRADAY; COMMODITY → MARGIN, INTRADAY |
order_type | string | ✅ | The type of order. Enum: "LIMIT", "MARKET". Note: MARKET orders are converted to LIMIT orders before they reach the exchange (see note below). |
validity | string | ✅ | The order validity. Enum: "DAY". IOC is not accepted. |
security_id | string | ✅ | The unique identifier for the instrument. |
qty | integer | ✅ | The quantity of the instrument to trade. For DERIVATIVE and COMMODITY this is in units, not lots, and must be a whole multiple of the contract lot size. |
algo_id | string | ❌ | Algo identifier for the order. Optional. Defaults to "99999" for NSE and MCX, "9999999999999999" for BSE. |
limit_price | number | ❌ | The price for a LIMIT order. Required if order_type is "LIMIT". Leave it out for MARKET orders (see note below). A COMMODITY MARKET order that carries limit_price is rejected. |
is_amo | boolean | ❌ | Set to true for After Market Orders (AMO). Defaults to false. Ignored for COMMODITY — an order placed while MCX is shut is queued automatically (see Orders Placed While MCX Is Shut). |
remarks | string | ❌ | Your own free-text tag for the order — a strategy name, a signal id, anything you want to reconcile against later. Stored with the order and echoed back by Get Order Details, Get Order Book and Get Trade Book. See Order Remarks. |
Example Request
curl --location 'https://api.indstocks.com/order' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"txn_type": "BUY",
"exchange": "BSE",
"segment": "EQUITY",
"product": "CNC",
"order_type": "LIMIT",
"limit_price": 850,
"validity": "DAY",
"security_id": "500112",
"qty": 1,
"is_amo": false,
"algo_id": "99999",
"remarks": "momentum-v2/sig-4471"
}'
Response Payload (Success)
Validations
- DayValidityAllowed: Order should be placed with DAY validity
- QtyMustBeAboveZero: Qty must be specified and greater than zero
- LimitPriceMustBeAboveZero: Limit price must be specified and greater than zero
- QtyWithinFreezeQty: Qty should be less than freeze qty. A derivative order above it can be placed as a sliced smart order
- AmoMustBeTrue: In case of after market orders, amo flag must be true
- PriceWithinRange: Limit price must be within the allowed range
- MaxValueOfOption: Max value of option allowed is enforced
- QtyMultipleOfLotSize: Qty should be a multiple of lot size
- ReservedRemarks:
remarksmust not use a value reserved for INDstocks' internal channel tags (see Order Remarks)
Market Orders Are Converted to Limit Orders
API trading does not send pure MARKET orders to the exchange. If you submit order_type: "MARKET", the order is converted to a LIMIT order before it is sent. The limit price depends on the segment:
segment | Limit price of the converted order |
|---|---|
EQUITY | The live market price. |
DERIVATIVE | The live price plus (BUY) or minus (SELL) a price-protection band. |
COMMODITY | The live price plus (BUY) or minus (SELL) a protection buffer: 5% when the live price is 50 or more, 10% when it is from 10 to below 50, and 20% below 10. The result is rounded to the tick size and capped at the upper circuit limit (BUY) or the lower circuit limit (SELL). |
A converted BUY can fill at any price up to that limit, and a converted SELL at any price down to it.
Commodity (MCX) Orders¶
segment: "COMMODITY" with exchange: "MCX" is accepted on Place Order, Modify Order and Cancel Order, and commodity rows appear in the order and trade books. The fields are the same as any other order.
The rules that differ — account and contract checks, trading sessions, the off-market queue, and the size, value and price limits — are collected in Commodity (MCX) Trading.
Order Remarks¶
remarks is an optional free-text tag you attach to an order at placement. It is meant for your own bookkeeping — the strategy that generated the order, a signal id, a backtest run, a basket name. INDstocks stores it against the order and gives it back to you on every read, so you can reconcile fills against your own system without keeping a separate order-id map.
POST /order and POST /smart/order both accept it. On a sliced smart order the same remark is carried onto every slice.
Where it comes back
| Endpoint | Field |
|---|---|
GET /order | remarks |
GET /order-book | remarks |
GET /trade-book | remarks |
The field is omitted from the response when the order carried no remark.
Rules
| Rule | Behaviour |
|---|---|
| Maximum length | 100 characters. A longer value is silently truncated to the first 100 characters and the order is still placed. It is not rejected — trim it yourself if the exact text matters. |
| Set at placement only | Neither /order/modify nor /smart/order/modify accepts remarks. Modifying an order keeps the remark it was placed with. |
| Reserved values | A small set of values is reserved for INDstocks' own internal channel tags. Sending one is rejected with a RequestValidationException naming the reserved values. The current reserved value is TV-TERMINAL. Matching runs on the stored value — that is, after the 100-character truncation above — and ignores case and surrounding whitespace. So tv-terminal, " TV-TERMINAL ", and a value padded so that only the reserved tag survives truncation are all rejected. A value that merely contains a reserved word and keeps other characters after truncation (for example my-TV-TERMINAL-clone) is accepted. |
| Smart orders | A smart order's remark is carried onto every leg. When a stop-loss or target leg triggers, the live order created from it inherits the same remark. |
| Not sent to the exchange | The remark stays inside INDstocks. It is never forwarded to the exchange and never appears in exchange or contract-note records. |
Use it as a correlation key
Writing your own order id into remarks is the cheapest way to line up INDstocks fills with your strategy's internal state, because the same tag appears on the order book and on the trade book entry for every fill of that order.
It is not an idempotency key. INDstocks does not deduplicate on remarks — two orders sent with the same tag are two orders.
Modify Order¶
This API allows you to modify a pending standard order.
Endpoint
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
order_id | string | ✅ | The unique ID of the order to be modified. |
segment | string | ✅ | The market segment. Enum: "DERIVATIVE", "EQUITY", "COMMODITY" |
qty | integer | ✅ | The new quantity for the order. |
limit_price | number | ✅ | The new limit price for the order. |
remarks cannot be changed
This endpoint does not accept remarks. The order keeps the remark it was placed with. See Order Remarks.
Example Request
curl --location 'https://api.indstocks.com/order/modify' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
"segment": "DERIVATIVE",
"limit_price": 73,
"qty": 75,
"order_id": "DRV-2049"
}'
Response Payload (Success)
Validations
- OrderIdMissing: Order ID is missing or invalid
- QtyMustBeAboveZero: Qty must be specified and greater than zero
- LimitPriceMustBeAboveZero: Limit price must be specified and greater than zero
- QtyWithinFreezeQty: Qty should be less than freeze qty
- AmoMustBeTrue: In case of after market orders, amo flag must be true
- PriceWithinRange: Limit price must be within the allowed range
- MaxValueOfOption: Max value of option allowed is enforced (for derivative orders)
- QtyMultipleOfLotSize: Qty should be a multiple of lot size (for derivative orders)
- OrderCannotBeModified: Order is not eligible for modification
- For
COMMODITYorders, see Modifying and Cancelling
Cancel Order¶
This API allows you to cancel a pending standard order.
Endpoint
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
order_id | string | ✅ | The unique ID of the order to be cancelled. |
segment | string | ✅ | The market segment. Enum: "DERIVATIVE", "EQUITY", "COMMODITY" |
Example Request
curl --location 'https://api.indstocks.com/order/cancel' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
"segment": "DERIVATIVE",
"order_id": "DRV-2049"
}'
Response Payload (Success)
Validations
- OrderIdMissing: Order ID is missing or invalid
- OrderCannotBeCancelled: Order is not eligible for cancellation
- For
COMMODITYorders, see Modifying and Cancelling
Get Order Book¶
Retrieves the list of all orders placed during the current trading day.
Endpoint
Example Request
curl --location 'https://api.indstocks.com/order-book' \
--header 'Authorization: YOUR_ACCESS_TOKEN'
Response Payload (Success)
{
"status": "success",
"data": [
{
"created_at": "2025-07-02T15:47:07.079035+05:30",
"updated_at": "2025-07-02T17:43:02.635379+05:30",
"user_id": "710354",
"security_id": "58757",
"isin": "",
"name": "NIFTY 3 JUL 27400 CE",
"id": "GTT-2914581",
"exch_order_id": "",
"txn_type": "SELL",
"exchange": "NSE",
"segment": "DERIVATIVE",
"product": "MARGIN",
"order_type": "OCO",
"validity": "",
"mkt_type": "NL",
"off_mkt_flag": "",
"traded_qty": 0,
"requested_qty": 75,
"requested_price": "",
"traded_price": "",
"sl_trigger_price": "0.3",
"sl_limit_price": "0.2",
"tgt_trigger_price": "0.75",
"tgt_limit_price": "",
"status": "CANCELLED",
"extra_info": "",
"remarks": "momentum-v2/sig-4471"
},
{
"created_at": "2025-07-02T09:18:40.446948+05:30",
"updated_at": "2025-07-02T09:18:40.498595+05:30",
"user_id": "710354",
"security_id": "56998",
"isin": "",
"name": "NIFTY 3 JUL 25700 CE",
"id": "DRV-28131451",
"exch_order_id": "1300000002340881",
"txn_type": "BUY",
"exchange": "NSE",
"segment": "DERIVATIVE",
"product": "MARGIN",
"order_type": "MARKET",
"validity": "DAY",
"mkt_type": "NL",
"off_mkt_flag": "false",
"traded_qty": 75,
"requested_qty": 75,
"requested_price": "43.55",
"traded_price": "43.55",
"sl_trigger_price": "",
"sl_limit_price": "",
"tgt_trigger_price": "",
"tgt_limit_price": "",
"status": "SUCCESS",
"extra_info": ""
},
{
"created_at": "2025-07-02T17:59:57.799576+05:30",
"updated_at": "2025-07-02T18:05:03.660538+05:30",
"user_id": "710354",
"security_id": "56888",
"isin": "",
"name": "NIFTY 03 Jul ₹25550 Call",
"id": "DRV-28209665",
"exch_order_id": "",
"txn_type": "BUY",
"exchange": "NSE",
"segment": "DERIVATIVE",
"product": "MARGIN",
"order_type": "LIMIT",
"validity": "DAY",
"mkt_type": "NL",
"off_mkt_flag": "true",
"traded_qty": 0,
"requested_qty": 225,
"requested_price": "32.1",
"traded_price": "",
"sl_trigger_price": "",
"sl_limit_price": "",
"tgt_trigger_price": "",
"tgt_limit_price": "",
"status": "O-PENDING",
"extra_info": ""
}
]
}
Response Field Notes
- For derivative orders, the
isinfield may be empty. - Smart orders (GTT) will have
sl_trigger_price,sl_limit_price,tgt_trigger_price, andtgt_limit_pricefields populated. - Regular orders will have these smart order fields as empty strings.
- Orders with a trailing stop loss additionally carry
is_tsl: trueandtsl_step_size. For these,sl_trigger_priceis the live trailed trigger rather than the price originally submitted. (TSL is not yet live — no order currently returns these fields.) - Order IDs starting with "GTT-" indicate smart orders, while "EQ-", "DRV-" and "COM-" indicate equity, derivative and commodity orders.
- The
order_typefield may include "OCO" (One Cancels Other) for smart orders. - Field names use underscore notation (e.g.,
requested_price,traded_price) instead of the older "per_share" suffix. - The
extra_infofield contains rejection reasons or exchange messages when an order fails. It is empty for successful or pending orders. remarksechoes the tag you sent at placement. It is absent from the payload for orders placed without one. See Order Remarks.child_order_idis the ID of the stop-loss/target leg linked to a parent order (e.g.GTT-16326824). It is absent when the order has no leg. For a sliced smart order the leg is created a moment after placement, so poll until it appears.parent_order_idis the ID of the order that a stop-loss/target leg protects (e.g.DRV-94729043). It is absent on orders that are not legs.
Get Order Details¶
Retrieves the complete details and history of a single order.
Endpoint
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
order_id | string | ✅ | The unique ID of the order to retrieve. |
segment | string | ✅ | The market segment. Enum: "DERIVATIVE", "EQUITY", "COMMODITY" |
Example Request
curl --location --request GET 'https://api.indstocks.com/order' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
"order_id": "DRV-27373858",
"segment": "DERIVATIVE"
}'
Response Payload (Success)
{
"status": "success",
"data": {
"created_at": "2025-07-02T09:18:40.446948+05:30",
"updated_at": "2025-07-02T09:18:40.498595+05:30",
"user_id": "710354",
"security_id": "56998",
"isin": "",
"name": "NIFTY 3 JUL 25700 CE",
"id": "DRV-28131451",
"exch_order_id": "1300000002340881",
"txn_type": "BUY",
"exchange": "NSE",
"segment": "DERIVATIVE",
"product": "MARGIN",
"order_type": "MARKET",
"validity": "DAY",
"mkt_type": "NL",
"off_mkt_flag": "false",
"traded_qty": 75,
"requested_qty": 75,
"requested_price": "43.55",
"traded_price": "43.55",
"sl_trigger_price": "",
"sl_limit_price": "",
"tgt_trigger_price": "",
"tgt_limit_price": "",
"status": "SUCCESS",
"extra_info": "",
"remarks": "momentum-v2/sig-4471"
}
}
remarks
Present only when the order was placed with a remark. See Order Remarks.
child_order_id and parent_order_id
A parent order with a linked stop-loss/target leg carries child_order_id. The leg carries parent_order_id. Both are absent otherwise. For a sliced smart order the leg is created a moment after placement, so poll until child_order_id appears.
Get Trades¶
Retrieves the list of executed trades (fills) for a specific order.
Endpoint
This GET request sends a JSON body
Like Get Order Details, this endpoint takes order_id and segment as a JSON request body rather than a path parameter or query string.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
order_id | string | ✅ | The unique ID of the order to fetch trades for. |
segment | string | ✅ | The market segment. Enum: "DERIVATIVE", "EQUITY", "COMMODITY" |
Example Request
curl --location --request GET 'https://api.indstocks.com/order/trades' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"order_id": "DRV-85322703",
"segment": "DERIVATIVE"
}'
Response Payload (Success)
{
"status": "success",
"data": [
{
"fill_id": 1279916,
"exch_order_id": "1100000017281712",
"quantity": 65,
"price": 77.8,
"trade_date": "2026-07-20T09:31:20+05:30"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
fill_id | integer | Unique identifier for the trade fill. |
exch_order_id | string | Exchange-generated order ID. |
quantity | integer | Quantity filled in this trade. |
price | number | Price at which the trade was executed. |
trade_date | string | Timestamp of trade execution (ISO 8601, IST). |
No remarks here
This per-order view does not carry remarks — you already hold the order_id. Use Get Trade Book if you want the tag alongside each fill.
Get Trade Book¶
Retrieves the list of all executed trades for a specific segment during the current trading day. The trade book shows all filled orders with their execution details.
Endpoint
Query Parameters
| Parameter | Type | Description |
|---|---|---|
segment | string | The market segment. Enum: "EQUITY", "DERIVATIVE", "COMMODITY" (Required) |
Example Request
curl --location 'https://api.indstocks.com/trade-book?segment=DERIVATIVE' \
--header 'Authorization: YOUR_ACCESS_TOKEN'
Example Request for Equity Segment
curl --location 'https://api.indstocks.com/trade-book?segment=EQUITY' \
--header 'Authorization: YOUR_ACCESS_TOKEN'
Response Payload (Success)
{
"status": "success",
"data": [
{
"fill_id": 1020280,
"exch_order_id": "2400000124991381",
"quantity": 2425,
"price": 1.55,
"trade_date": "2025-11-11T17:48:23+05:30",
"trade_serial_no": "17628437030186581215",
"scrip_code": "99133",
"remarks": "momentum-v2/sig-4471"
},
{
"fill_id": 1022519,
"exch_order_id": "2400000124697541",
"quantity": 2425,
"price": 0.55,
"trade_date": "2025-11-11T17:49:17+05:30",
"trade_serial_no": "17628437564178181815",
"scrip_code": "80958"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
fill_id | integer | Unique identifier for the trade fill |
exch_order_id | string | Exchange-generated order ID |
quantity | integer | Quantity of shares/contracts traded |
price | number | Price at which the trade was executed |
trade_date | string | Timestamp of trade execution (ISO 8601 format) |
trade_serial_no | string | Unique serial number for the trade from exchange |
scrip_code | string | Security/instrument code |
remarks | string | The tag sent on the order that produced this fill. Absent when that order carried no remark. Every fill of the same order repeats the same value. See Order Remarks |
Trade Book vs Order Book
- Order Book (
/order-book): Shows all orders placed, including pending, cancelled, and executed orders - Trade Book (
/trade-book): Shows only executed trades with their fill prices and quantities - Trade book entries represent actual transactions, while order book shows order status
- A single order can have multiple trade entries if filled in parts
- Use the
segmentquery parameter to filter trades by EQUITY, DERIVATIVE or COMMODITY segment
See Also¶
- Smart Orders (GTT) — multi-leg orders with stop-loss/target legs
- Margin Calculator — check required margin before placing an order
- Glossary & Constants —
txn_type/segment/product/order_typeenums and ID prefixes - Error Bucket — RMS rejection messages and
OrderExceptionhandling - Order Updates WebSocket — real-time order status instead of polling