Skip to content

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 /trades/{order_id} 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

Text Only
POST /order

Request Body

Parameter Type 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"
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.
is_amo boolean Set to true for After Market Orders (AMO).
limit_price number The price for a LIMIT order. Required if order_type is "LIMIT".
algo_id string Required. Algo identifier for the order. Use "99999" for regular orders.

Example Request

Bash
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"
}'

Response Payload (Success)

JSON
{
    "status": "success",
    "data": {
        "order_id": "DRV-29301125",
        "order_status": "O-PENDING"
    }
}

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

Modify Order

This API allows you to modify a pending standard order.

Endpoint

Text Only
POST /order/modify

Request Body

Parameter Type Description
segment string The market segment. Enum: "DERIVATIVE", "EQUITY"
order_id string The unique ID of the order to be modified.
qty integer The new quantity for the order.
limit_price number The new limit price for the order.

Example Request

Bash
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"
}'

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

Text Only
POST /order/cancel

Request Body

Parameter Type Description
segment string The market segment. Enum: "DERIVATIVE", "EQUITY"
order_id string The unique ID of the order to be cancelled.

Example Request

Bash
curl --location 'https://api.indstocks.com/order/cancel' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
  "segment": "DERIVATIVE",
  "order_id": "DRV-2049"
}'

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

Text Only
GET /order-book

Example Request

Bash
curl --location 'https://api.indstocks.com/order-book' \
--header 'Authorization: YOUR_ACCESS_TOKEN'

Response Payload (Success)

JSON
{
  "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"
    },
    {
      "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"
    },
    {
      "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"
    }
  ]
}

Response Field Notes

  • For derivative orders, the isin field may be empty.
  • Smart orders (GTT) will have sl_trigger_price, sl_limit_price, tgt_trigger_price, and tgt_limit_price fields populated.
  • Regular orders will have these smart order fields as empty strings.
  • Order IDs starting with "GTT-" indicate smart orders, while "DRV-" indicates derivative orders.
  • The order_type field 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.

Get Order Details

Retrieves the complete details and history of a single order.

Endpoint

Text Only
GET /order

Request Body

Parameter Type Description
order_id string The unique ID of the order to retrieve.
segment string The market segment. Enum: "DERIVATIVE"

Example Request

Bash
curl --location --request GET 'https://api.indstocks.com/order' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
    "order_id": "DRV-27373858",
    "segment": "DERIVATIVE"
}'

Response Payload (Success)

JSON
{
  "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"
  }
}


Get Trades

Retrieves the list of executed trades for a specific order.

Endpoint

Text Only
GET /trades/{order_id}

Path Parameter * order_id: The unique ID of the order to fetch trades for.

Example Request

Bash
curl --location 'https://api.indstocks.com/trades/DRV-2049' \
--header 'Authorization: YOUR_ACCESS_TOKEN'

Response Payload (Success)

JSON
{
  "status": "success",
  "data": [
    {
      "trade_id": "INDT20250512XYZ789",
      "order_id": "INDM20250512ABC123",
      "exchange_order_id": "1000000001234567",
      "exchange_trade_id": "2000000009876543",
      "exchange_segment": "NSE_EQ",
      "security_id": "12345",
      "trading_symbol": "RELIANCE-EQ",
      "transaction_type": "BUY",
      "product_type": "CNC",
      "quantity": 5,
      "price": 2500.45,
      "trade_timestamp": "2025-05-12T10:15:35Z"
    }
  ]
}


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

Text Only
GET /trade-book

Query Parameters

Parameter Type Description
segment string The market segment. Enum: "EQUITY", "DERIVATIVE" (Required)

Example Request

Bash
curl --location 'https://api.indstocks.com/trade-book?segment=DERIVATIVE' \
--header 'Authorization: YOUR_ACCESS_TOKEN'

Example Request for Equity Segment

Bash
curl --location 'https://api.indstocks.com/trade-book?segment=EQUITY' \
--header 'Authorization: YOUR_ACCESS_TOKEN'

Response Payload (Success)

JSON
{
  "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"
    },
    {
      "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

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 segment query parameter to filter trades by EQUITY or DERIVATIVE segment