Skip to main content

Order & Report

Single Order History

An order book electronically records all open (buy and sell) orders for a specific stock, bond, currency pair and futures.

It's important to note that just because an order has been placed successfully through the API, it doesn't guarantee its successful execution. To accurately determine the status of your order, it is recommended to retrieve the current status of the order using the unique order id.

Method: POST

https://connect.thefirstock.com/api/V4/singleOrderHistory

Request Details

API Parameters
Parameter Description Example
userId
String
Identifier for the user upon login, unique to each user in the system. AA0013
jKey
String
Authentication token obtained from
the login API
d9b4e1b1c79042476
orderNumber
String
Unique identifier for the order,
provided upon successful placement
23111100000112

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

singleOrderHistory = thefirstock.firstock_SingleOrderHistory(
   userId="{{userId}}",
   orderNumber="23111100000112"
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/logout' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jKey": "{{jKey}}",
    "userId": "{{userId}}",
    "orderNumber": "23111100000112"
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();

firstock.singleOrderHistory(
  userId: {{userId}},
  { orderNumber: "11030800009600" },
  (err, result) => {
    console.log("Error, ", err);
    console.log("Result: ", result);
  }
);
using thefirstock;

class Program
{
    public static void Main()
    {
        Firstock firstock = new Firstock(userId: {{userId}},);
        var result = firstock.singleOrderHistory(orderNumber: "11030800009600");
    }
}

Success Response details

API Parameters
Parameter Description Example
data.userId
String
Identifier for the user upon login, unique
to each user in the system.
AA0013
data.exchange
String
Exchange on which the order is placed
(e.g., NSE, BSE, NFO, BFO)
NSE
data.orderNumber
String
Unique identifier for the order,
provided upon successful placement
1234567890111
data.tradingSymbol
String
Encoded trading symbol of the security ITC-EQ
data.price
String
Price at which the order is to be executed 13.00
data.quantity
String
Number of shares or contracts to be traded 1
data.product
String
Product code indicating the type of trade
C -> Cash and Carry,
M -> F&O Normal,
I -> Intraday
M
data.status
String
Indicates the outcome of the order status Rejected
data.transactionType
String
Transaction type, either Buy (B) or Sell (S) B
data.orderTime
String
The exact time when the order was placed. 14:45:11
15-02-2023
data.fillShares
String
Total number of shares or units
traded in this specific order.
0
data.averagePrice
String
average price at which the stock was purchased 0
data.priceType
String
Type of order pricing
(e.g., LMT / MKT / SL-LMT / SL-MKT)
LMT
data.rejectReason
String
If order is rejected, reason in text form ORA:Product
not enabled on
exchange NSE
data.remarks
String
Any message Entered during order entry singleOrderHistory
data.disclosedQuantity
String
Order disclosed quantity. 0
data.retention
String
Order validity terms
(e.g., DAY / EOS / IOC)
DAY
data.pricePrecision
String
The level of precision used in pricing. 2
data.tickSize
String
The minimum price movement in the trading instrument. 0.05
data.lotSize
String
The standard number of units in one lot. 1
{
  "status": "success", 
    "data": [   
    {      
      "userId": "AA0011",   
      "orderNumber": "1234567890111",     
      "exchange": "NSE",    
      "tradingSymbol": "ITC-EQ", 
      "quantity": "1", 
      "transactionType": "B",    
      "priceType": "LMT",   
      "retention": "DAY",  
      "token": "1660",    
      "lotSize": "1",      
      "tickSize": "0.05",     
      "price": "0.00",   
      "product": "M",    
      "status": "REJECTED",  
      "orderTime": "14:45:11 15-02-2023",   
      "fillShares": "",   
      "averagePrice": "",   
      "remarks": "singleOrderHistory",   
      "rejectReason": "ORA:Product Regular not enabled on exchange NSE"  
    }
  ]
}

Failure response details

API Error Parameters
Parameter Description Example
status
String
Indicates the result status of the
API operation
failed
code
String
HTTP status code associated with the error 401
name
String
Specifies the type or category of the
error encountered
INVALID_JKEY
error.field
String
Field in the request that triggered the error jKey
error.message
String
Detailed message describing the error jKey parameter is invalid
{  
  "status": "failed", 
    "code": "401", 
    "name": "INVALID_JKEY", 
    "error": {     
      "field": "jKey",   
      "message": "jKey parameter is invalid" 
  }
}