Doc Fundamentals
Funds Management
Order Management
Portfolio Management
User Authentication
Place Order

Daily API Calls
Success Rate
Avg. Response Time
The Order API is the backbone of the trading system as it allows the application to place an order through the client’s demat account.
The API requires authentication for successful execution. The authentication can be provided by passing the Access token(Bearer token).
The API is flexible with a variety of orders and allows the users to place the following type of orders:
- Limit Order
- Market Order
- Stop Loss Order
- Stop Loss – Market Order
- After Market Order
- IOC Order
The above-mentioned types of orders can be placed as intraday or delivery.
The API works either with ScripCode or ScripData, ScripData format is mentioned here.
Order Tracking
Once an order is placed, its status can be tracked through the following methods:
- Order Status API
- Order Book
- Order Confirmation via WebSocket (recommended)
Upon placing an order, the API returns a BrokerOrderId. This BrokerOrderId can then be used to fetch the ExchangeOrderId. All three of the aforementioned order APIs can help you map the BrokerOrderId to the ExchangeOrderId.
RemoteOrderId Usage
Overview
We have introduced the RemoteOrderId field as a user-defined identifier. Partners or clients can create their own RemoteOrderId and include it when placing an order. This identifier serves several purposes:
- Track Order Status: Use the RemoteOrderId to track the order status via the Order Stand API.
- Obtain ExchangeOrderId: Retrieve the ExchangeOrderId using the RemoteOrderId, which can then be used to modify the order.
Usage and Benefits
In certain scenarios, specifically with Stop-Loss (SL) orders, we have observed issues where the BrokerOrderId changes, causing clients to be unable to map the ExchangeOrderId from the broker ID. To mitigate this issue, we recommend using the RemoteOrderId.
https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V1/PlaceOrderRequest
Headers
KEY | VALUE |
---|---|
Content-Type | application/json |
Authorization | bearer {Your Access Token} |
Request body
FIELD NAME | MANDATORY | DESCRIPTION | ||
---|---|---|---|---|
p_Data | head | KeySTRING | Yes | AppKey of User or Partner |
body | OrderTypeSTRING | Yes | Represents if it is buy or sell order.B: Buy | |
ExchangeSTRING | Yes | This is the exchange of the instrumentN: NSE | ||
ExchangeTypeSTRING | Yes | This is the exchange segment of the instrumentC: Cash | ||
ScriCodeSTRING | Yes | ScripCode of the instrument | ||
ScriDataSTRING | Yes | It is the unique symbol of the instrument for which order needs to be placed, format is mentioned below. | ||
PriceDOUBLE | No | It is the price at which order needs to be placed. (0 for market orders). | ||
QtyINTEGER | Yes | Total quantity in the modified order | ||
StopLossPriceDOUBLE | No | It is the stop loss price for the order | ||
DisQtyINTEGER | No | It is the quantity to be disclosed publicly | ||
IsIntradayBOOLEAN | No | It specifies if the order is intraday or delivery orderIntraday: true | ||
AHPlacedSTRING | No | It specifies if the order is after market order or notAfter Market: Y | ||
RemoteOrderIDSTRING | Yes | This is a unique ID which user can generate for his/her reference |
Note
- If the price is not passed in the request body, its value will be considered as 0. The 0 value of price indicates order to be of at-market type. It takes market price by default.
- Disclosed quantity passed in the field “DisQty” should always be less than or equal to the value of the field “Qty”.
- The values of exchange, exchange type, ScripCode , symbol name, expiry, option type and strike can be fetched from the scrip master.
- The field “ScripData” follows a particular structure for the stocks which is mentioned below:
Symbol Format - scripData
INSTRUMENT TYPE | SYMBOL FORMAT | SAMPLE VALUE |
---|---|---|
Cash | Symbol Name_EQ | RELIANCE_EQ |
Derivatives | Futures-SYMBOL Name_yyyymmdd Derivatives -SYMBOL_YYYYMMDD_CE/PE_STRIKE | Futures - NIFTY 30 Sep 2021_20210930Options - BANKNIFTY 29 Mar 2023 CE 41600.00_20230329_CE_41600
|
Currency | Symbol Name_Expiry_Option Type_Strike Rate | GBPINR 29 Dec 2021 CE 107.2500_1325255400_CE_107.25 |
Commodity | Symbol Name_Expiry_Option Type_Strike Rate | SILVER 27 Aug 2021 CE 63750.00_1314489600_CE_63750 |
{
"head": {
"key": "{{Your App Key}}"
},
"body": {
"Exchange":"N",
"ExchangeType":"C",
"ScripCode":"1660",
"Price": "445",
"StopLossPrice": "0",
"OrderType": "Buy",
"Qty": 1,
"DisQty": "0",
"IsIntraday": true,
"iOrderValidity": "0",
"AHPlaced":"N"
}
}
Response body
FIELD NAME | VALUES | DESCRIPTION | |
---|---|---|---|
head | responseCodeSTRING | 5PPlaceOrdReqV1 | This is the unique response code for the API. |
statusSTRING | -1: Server unable to process your request0: Success1: Invalid input parameters.2: Invalid head parameters. | This is the status code which depicts the status of API request to the server. | |
statusDescriptionSTRING | Server unable to process your requestSuccessInvalid input parameters.Invalid head parameters. | This is the description of the status received from the server for the API request. | |
body | BrokerOrderIDINTEGER | - | This is the order ID generated from the Broker's end |
ClientCodeSTRING | - | This is the 5paisa demat account client code of the user | |
ExchSTRING | N: NSE | This is the exchange of the instrument | |
ExchOrderIDINTEGER | - | This is the order ID generated by the exchange. | |
ExchTypeSTRING | C: Cash | This is the exchange segment for the order | |
LocalOrderIDINTEGER | - | This is the numeric local order ID generated by the user | |
MessageSTRING | 0: Success | This is the status description of the order API request based on input parameters | |
RMSResponseCodeINTEGER | - | This is the status code of the order received from 5paisa Securities system | |
RemoteOrderIDSTRING | - | This is the unique order ID passed for the order while sending the request | |
ScripCodeINTEGER | - | This is the numeric code for the instrument in which order has been placed | |
StatusINTEGER | 0: Success | This is the status code of the API response | |
TimeDATETIME | - | This is the time at which order has been placed |
{
"body": {
"BrokerOrderID": 672112769,
"ClientCode": "CLIENT_CODE",
"Exch": "N",
"ExchOrderID": "0",
"ExchType": "C",
"LocalOrderID": 0,
"Message": "Success",
"RMSResponseCode": 1,
"RemoteOrderID": "YESBANKTESTING15",
"ScripCode": 11915,
"Status": 0,
"Time": "/Date(1658255400000+0530)/"
},
"head": {
"responseCode": "5PPlaceOrdReqV1",
"status": "0",
"statusDescription": "Success"
}
}
{
"body": null,
"head": {
"responseCode": "5PPlaceOrdReqV1",
"status": "2",
"statusDescription": "Invalid Head Parameters"
}
}
{
"body": {
"BrokerOrderID": 0,
"ClientCode": "",
"Exch":"?”,
"ExchOrderID": "",
"ExchType":"?”,
"LocalOrderID": 0,
"Message": "Authentication Fails",
"RMSResponseCode": 0,
"ScripCode": 0,
"Status": 9,
"Time": "/Date(1637494442204+0530)/"
},
"head": {
"responseCode": "5PPlaceOrdReqV1",
"status": "0",
"statusDescription": "Fail"
}
}
{
"body": {
"BrokerOrderID": 0,
"ClientCode": "",
"Exch":"?”,
"ExchOrderID": "",
"ExchType":"?”,
"LocalOrderID": 0,
"Message": "Invalid Session",
"RMSResponseCode": 0,
"ScripCode": 0,
"Status": 9,
"Time": "/Date(1637494569494+0530)/"
},
"head": {
"responseCode": "5PPlaceOrdReqV1",
"status": "0",
"statusDescription": "Fail"
}
}
{
"body": {
"BrokerOrderID": 0,
"ClientCode": "5paisa_Client",
"Exch":"?”,
"ExchOrderID": "0",
"ExchType":"?”,
"LocalOrderID": 0,
"Message": "Invalid Input Parameters.",
"RMSResponseCode": 0,
"ScripCode": 0,
"Status": 2,
"Time": "/Date(1637494757568+0530)/"
},
"head": {
"responseCode": "5PPlaceOrdReqV1",
"status": "0",
"statusDescription": "Success"
}
}