Orders¶
This section outlines the APIs for placing, modifying, canceling, and retrieving standard trading orders.
| 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" |
segment | string | ✅ | The market segment. Enum: "DERIVATIVE", "EQUITY" |
product | string | ✅ | The product type. Enum: "MARGIN", "INTRADAY", "CNC" |
order_type | string | ✅ | The type of order. Enum: "LIMIT", "MARKET". Note: MARKET orders are automatically converted to LIMIT at the live price (see note below). |
validity | string | ✅ | The order validity. Enum: "DAY", "IOC" |
security_id | string | ✅ | The unique identifier for the instrument. |
qty | integer | ✅ | The quantity of the instrument to trade. |
algo_id | string | ✅ | Algo identifier for the order. Use "99999" for NSE, "9999999999999999" for BSE orders. |
limit_price | number | ❌ | The price for a LIMIT order. Required if order_type is "LIMIT". For MARKET orders, the live market price is used as the limit price. |
is_amo | boolean | ❌ | Set to true for After Market Orders (AMO). Defaults to false. |
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
- 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 support pure MARKET orders. If you submit order_type: "MARKET", the order is automatically converted to a LIMIT order priced at the current live market price before being sent to the exchange.
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.
Both POST /order and POST /smart/order accept it.
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" |
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
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" |
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
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 "DRV-" indicates derivative 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.
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" |
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.
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" |
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" (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 or DERIVATIVE 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