Download OpenAPI specification:Download
ODIN Rest API allows the developer to create a custom trading application for Web or Mobile communicating with ODIN Order Management System (OMS). This REST based API allows user to develop the following functionalities for Trading Application / Portal.
Salient Features:
The changes made in the document along with the version no. and release dates.
| Version No. | Description | Revised Date |
| 10.0.5.0 | API version updated to match with exchange approved version. No changes in the API. | 31-10-2025 |
ODIN API is a set of REST APIs that provide the platform along with required data to build a Trading Platform, the API specifications is used for communicating with ODIN API Gateway. API specifications are based on the REST protocol that covers the functionalities which are need to develop a trading application like Login / Logout, Order Management (Place Order, Modify Order, Cancel order), Reports like Order Book, Trade Book, Position, Holding & Limit, etc. The REST API supports JSON based request and responses along with data compression.
Basic Flow to Implement the APIs:
STEP 1:Make a Login API call using login credential to obtain the access token.
STEP 2: Use access token obtained from Login API in all the subsequent API calls.
STEP 3: Setting obtained access token and content-type is shown below.
Header:
Content-Type: application/json
Authorization: Bearer eyJ1c2VySUQiOiJSVVBFU0giLCJpYXQiOjE1NTIxMjIwOTEsImV4cCI6MTU1MjIwODQ5MX0
All GET and DELETE request parameters go as query parameters, and POST and PUT request parameters as json (application/json) parameters, responses from the API are always JSON. Any non-alphanumeric character should be URL encoded in query string and path parameters.
Successful Request
All responses from the API server are in JSON format with the content-type application/json unless explicitly stated otherwise. A successful 200 OK response always has a JSON response body with a status as success. The data key contains the full response payload.
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "success",
"code": "",
"message": "",
"data": "{}"
}
HTTP/1.1 500 Server error
Content-Type: application/json
{
"status": "error",
"code": "",
"message": "",
"errors": "[]"
}
The HTTP Status Codes used by the RESTful API.
| HTTP Error Code | Description |
| 400 | Bad Request - Missing or bad request parameters or values. Error message will indicate which one and why. |
| 401 | Unauthorized - The access token provided is expired, revoked, malformed, or invalid. Client should refresh relogin and then try again. |
| 404 | Not Found - Request resource was not found. |
| 405 | Method Not Allowed - Request method (GET, POST etc.) is not allowed on the requested endpoint |
| 500 | Internal Server Error - API is not working as expected. The request is probably valid but needs to be requested again later. |
| 503 | Service Unavailable - The API endpoint is down. |
The User APIs allows to generate access token (sessionid) using the client’s Login credentials. Additionally, user API, has calls for knowing User profile and fund balance summary.
This call can be used in case if the client has forgotten the password or he wants to register TOTP and OTP is to be sent on the registered mobile number.
| user_id required | string User Id to be in CAPITALISED only |
| api_key required | string API key provided during subscription |
| source required | string Enum: "WEBAPI" "MOBILEAPI" Login source of user |
{- "user_id": "TEST1",
- "api_key": "aasdszzzzz11",
- "source": "WEBAPI"
}{- "status": "success",
- "code": "s-101",
- "message": "OTP sent to reset Password"
}This API needs to be used for signing-in to the application using login credentials. A successful sign-in would return an ‘access token’ and a 'broadcast_access_token' in the response.
'access_token' needs to be included in all subsequent API invocations as part of http header 'Authorization' token.
'broadcast_access_token' would be required for establishing a connection with the feed endpoint ('broadCastSocket' received in the response). Kindly refer Price Feed API for further details.
| login_type | password | second_auth_type | second_auth |
| PASSWORD | password | REGISTER | Not Required |
| TOKEN | register_token | OTP/TOTP/FINGERPRINT | OTP value/TOTP value/Registered UDID |
| PASSWORD | password | OTP/TOTP/FINGERPRINT | OTP value/TOTP value/Registered UDID |
| MPIN | MPIN Registered | OTP/TOTP/FINGERPRINT | OTP value/TOTP value/Registered UDID |
| user_id required | string User Id to be in CAPITALISED only |
| login_type | string Default: "PASSWORD" Enum: "PASSWORD" "MPIN" "FINGERPRINT" Login type, whether user is login with password, MPIN or fingerprint and respectively need to pass value in password field. |
| password required | string Password/MPIN/Fingerprint to validate |
| second_auth_type | string Enum: "OTP" "TOTP" "FINGERPRINT" "REGISTER" Second factor authentication type, and need to pass value in second_auth field. |
| second_auth required | string Two factor authentication credentials |
| api_key required | string API key provided during subscription |
| source required | string Enum: "WEBAPI" "MOBILEAPI" Login source of user |
{- "user_id": "TEST1",
- "login_type": "PASSWORD",
- "password": "Xyz@123",
- "second_auth_type": "TOTP",
- "second_auth": "222396",
- "api_key": "aasdszzzzz11",
- "source": "WEBAPI"
}{- "status": "success",
- "code": "s-101",
- "message": "Success message",
- "data": {
- "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0b2tlbiIsImlhdCI6MTU4MjUzOTM4NiwibWVtYmVySWQiOjkwOTA",
- "broadcast_access_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0b2tlbiIsImlhdCI6MTYyMzk4MTAyNSwibWVtYmVySWQiO",
- "user_name": "Rest Client",
- "login_time": "2020-03-10 10:10:10",
- "exchanges": [
- "NSE_EQ",
- "BSE_EQ",
- "NSE_FO"
], - "bcastExchanges": [
- "NSE_EQ",
- "BSE_EQ",
- "NSE_FO",
- "BSE_FO"
], - "product_types": [
- "INTRADAY",
- "DELIVERY",
- "PTST",
- "COVER",
- "BRACKET"
], - "product_types_exchange": {
- "NSE_EQ": [
- "INTRADAY",
- "DELIVERY",
- "PTST",
- "COVER",
- "BRACKET"
], - "BSE_EQ": [
- "INTRADAY",
- "DELIVERY",
- "COVER"
], - "NSE_FO": [
- "INTRADAY",
- "DELIVERY",
- "COVER",
- "BRACKET"
]
}, - "mpin_enabled": true,
- "fingerprint_enabled": true,
- "others": {
- "groupId": "HO",
- "broadCastSocket": "wss://broadcast.server.com:4509",
- "messageSocket": "wss://socketio.server.com:4512",
- "POA": "0",
- "participantCode": "",
- "dervParticipantCode": ""
}
}
}This call would validate the access token.
| Authorization | string Example: {{access_token}} |
{- "status": "success",
- "code": "s-101",
- "message": "Session verified.",
- "data": "{\"status\":\"false\",\"message\":\"TRUE\",\"dropped\":\"true\"}"
}This API can be used to retrieve the latest balance with broker for allowed segments.
{- "status": "success",
- "code": "s-101",
- "message": "Success message",
- "data": {
- "equity": {
- "id": 1,
- "name": "Equities",
- "net_available": 24966.45,
- "total_available": 24966.45,
- "total_utilised": 2496,
- "total_withdrawable": 22006,
- "net_payin_payout": 21000,
- "available": {
- "cash": 21000,
- "collateral": 0,
- "credit_for_sale": 0,
- "option_credit_for_sale": 0
}, - "utilised": {
- "limit": 21000,
- "pnl_realised": 0,
- "pnl_unrealised": 0,
- "option_premium": 0
}
}, - "commodity": {
- "id": 1,
- "name": "Commodity",
- "net_available": 24966.45,
- "total_available": 24966.45,
- "total_utilised": 2496,
- "total_withdrawable": 22006,
- "net_payin_payout": 21000,
- "available": {
- "cash": 21000,
- "collateral": 0,
- "credit_for_sale": 0,
- "option_credit_for_sale": 0
}, - "utilised": {
- "limit": 21000,
- "pnl_realised": 0,
- "pnl_unrealised": 0,
- "option_premium": 0
}
}, - "currency": {
- "id": 1,
- "name": "Currency",
- "net_available": 24966.45,
- "total_available": 24966.45,
- "total_utilised": 2496,
- "total_withdrawable": 22006,
- "net_payin_payout": 21000,
- "available": {
- "cash": 21000,
- "collateral": 0,
- "credit_for_sale": 0,
- "option_credit_for_sale": 0
}, - "utilised": {
- "limit": 21000,
- "pnl_realised": 0,
- "pnl_unrealised": 0,
- "option_premium": 0
}
}
}
}Use this API to retrieve User details such as name, email, mobile no and other relevant details. The data will be in encrypted format. The methodology to decrypt and decryption key will be same as shared on mail.
{- "status": "success",
- "code": "s-101",
- "message": "User profile data successfully fetched",
- "data": "AXRQK4JIN1OYG1+TiFsG0n1lPbic96bfhaLYs1kTNpi2EqJVoxQ+g/roX4m3kxhE7fHJjrp1rEXxNEh51xCdxDnjg7dDl5m93XADPQkm+iMsLTP33absjCfgp+rM1nise7peEgAlCq0hA5mDN4QesmMvGjOVkbfoDxz8IoY4okM="
}This section provided to information of API calls to do the order management i.e. place fresh order, modify or cancel already submitted valid orders. Retrieve the order and trade book.
Using Order API, various type of orders Intraday, Delivery, Bracket Order, Cover order, etc. can be placed. Order type here is used as Product Type in System. Kindly refer to the respective API call for more detail.
Global Constants
Here are some of the constants enum values used for placing order.
| Params | Values | Description |
| product_type | INTRADAY | It consists of one leg only. Open orders will be squared off automatically before market close. |
| DELIVERY | Order position will be carried over to next day under holding. | |
| BTST | Buy today sell tomorrow. It will be squared off automatically before next day market close. | |
| COVER | It consists of two legs. MAIN_LEG which is market order and SL_LEG which will be square off stop loss order of MAIN_LEG. Open orders will be squared off automatically before market close. | |
| BRACKET | It consists of three leg order. MAIN_LEG which is placed as Market or Limit, SL_LEG which is square off stop loss order and PROFIT_LEG which is square off order. Open orders will be squared of automatically before market close. | |
| MTF | Margin Trading or Margin Trading Facility (MTF) is a facility provided by brokers to their clients in which the client does not have to pay full amount for carrying overnight positions. | |
| order_type | RL | Regular limit order. |
| RL-MKT | Regular market order. | |
| SL | Stoploss limit order. | |
| SL-MKT | Stoploss market order. | |
| validity | DAY | Order valid for the same day. |
| IOC | Order valid only for immediate execution else cancelled. | |
| GTD | Order valid for specified number of days. | |
| GTC | Order valid until user cancels the order. | |
| EOS | Order valid for the specific session. | |
| order_status | PENDING | Order is pending or partially executed at exchange. |
| EXECUTED | Order is fully executed at exchange. | |
| CANCELLED | Order is cancelled at exchange. | |
| OMS_XMITTED/ OMSXMITTED | Order is received by OMS but not submitted to exchange. | |
| OMS_REJECT/ OMSREJECT | Order is rejected by OMS. | |
| ORDER_ERROR/ ORDERERROR | Order is not valid, rejected by exchange. | |
| ADMIN_REJECT/ ADMINREJECT | Order is rejected by OMS Admin. | |
| EXCHANGE_XMITTED/ EXXMITTED | Order is submitted to exchange, but confirmation is not received. | |
| AMO_SUBMITTED/ AMOACCEPTED | AMO order is received by OMS. | |
| AMO_CANCELLED/ AMOWITHDRAWN | AMO order is cancelled. |
The Place order API lets you place a new order.
required | object Scrip information can be sent in 2 ways. either by sending exchange and scrip token or by sending scrip details i.e. exchange, symbol, series, expiry, strike price & option type. |
| transaction_type required | string Order is BUY or SELL. |
| product_type required | string Product type of the order. |
| order_type required | string Type of order. |
| quantity required | integer Number of quantity to transact. |
| price | number Default: 0 Price at which order will be placed |
| trigger_price | number Price at which order will be triggered applicable for Order Type as Stop Loss Limit or Stop Loss Market. |
| disclosed_quantity | integer Number of quantity to be disclosed to the market. |
| validity | string Default: "DAY" Order validity |
| validity_days | integer Number of days order needs to be carried ahead for validity GTD orders. |
| is_amo | boolean Default: false Whether order is an AMO order or not? |
| order_identifier | string <= 8 characters An optional field to apply to an order to track it. |
| part_code | string Participant code |
| algo_id | string Algo id for strategry generated orders |
| strategy_id | string Strategy id for strategry generated orders |
| vender_code | string Vender code for inhouse application |
{- "scrip_info": {
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "symbol": null,
- "series": null,
- "expiry_date": null,
- "strike_price": null,
- "option_type": null
}, - "transaction_type": "BUY",
- "product_type": "DELIVERY",
- "order_type": "RL",
- "quantity": 50,
- "price": 100,
- "trigger_price": 0,
- "disclosed_quantity": 25,
- "validity": "DAY",
- "is_amo": false,
- "order_identifier": "108108108"
}{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The Modify order API lets you modify a pending order.
| exchange required | string Exchange segment |
| order_id required | string Order id. It must be URL encoded as it contains special characters. |
| order_type required | string Type of order. |
| quantity required | integer Number of quantity to transact. |
| traded_quantity required | integer Cumulative traded quantity of the order. Data to be passed in this field is available in order book response. |
| price | number Default: 0 Price at which order will be placed |
| trigger_price | number Price at which order will be triggered applicable for Order Type as Stop Loss Limit or Stop Loss Market. |
| disclosed_quantity | integer Number of quantity to be disclosed to the market. |
| validity | string Default: "DAY" Order validity |
| validity_days | integer Number of days order needs to be carried ahead for validity GTD orders. |
{- "order_type": "RL",
- "quantity": 50,
- "traded_quantity": 50,
- "price": 0,
- "trigger_price": 0,
- "disclosed_quantity": 25,
- "validity": "DAY"
}{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The Cancel order API lets you cancel a pending order.
| exchange required | string Exchange segment |
| order_id required | string Order id. It must be URL encoded as it contains special characters. |
{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}A cover order is a two-legged order. First leg is market order and second leg is stop loss order.
required | object Scrip information can be sent in 2 ways. either by sending exchange and scrip token or by sending scrip details i.e. exchange, symbol, series, expiry, strike price & option type. |
| transaction_type required | string Order is BUY or SELL. |
object | |
object | |
| order_identifier | string <= 8 characters An optional field to apply to an order to track it. |
| part_code | string Participant code |
| algo_id | string Algo id for strategry generated orders |
| strategy_id | string Strategy id for strategry generated orders |
| vender_Code | string Vender code for inhouse application |
{- "scrip_info": {
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "symbol": null,
- "series": null,
- "expiry_date": null,
- "strike_price": null,
- "option_type": null
}, - "main_leg": {
- "order_type": "RL-MKT",
- "quantity": 50,
- "price": 0
}, - "stoploss_leg": {
- "legs": [
- {
- "quantity": 0,
- "price": 97,
- "trigger_price": 98
}
]
}, - "order_identifier": "108108108"
}{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The Modify cover order API lets you modify a pending cover order.
| exchange required | string Exchange segment |
| order_id required | string order id, It must be URL encoded as it contains special characters. |
object | |
object |
{- "main_leg": {
- "order_type": "RL-MKT",
- "quantity": 50,
- "traded_quantity": 50,
- "price": 0
}, - "stoploss_leg": {
- "legs": [
- {
- "quantity": 0,
- "price": 97,
- "trigger_price": 98
}
]
}
}{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The Cancel cover order API lets you cancel a pending cover order.
| exchange required | string Exchange segment |
| order_id required | string Order id. It must be URL encoded as it contains special characters. |
{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}Bracket order is three-legged order. Along with the execution of main leg order, the system places two more orders i.e. profit leg and stoploss leg. It allows traders to place an order along with Stop loss and Profit order in single request.
required | object Scrip information can be sent in 2 ways. either by sending exchange and scrip token or by sending scrip details i.e. exchange, symbol, series, expiry, strike price & option type. |
| transaction_type required | string Order is BUY or SELL. |
object | |
object | |
object | |
| order_identifier | string <= 8 characters An optional field to apply to an order to track it. |
| part_code | string Participant code |
| algo_id | string Algo id for strategry generated orders |
| strategy_id | string Strategy id for strategry generated orders |
| vender_Code | string Vender code for inhouse application |
{- "scrip_info": {
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "symbol": null,
- "series": null,
- "expiry_date": null,
- "strike_price": null,
- "option_type": null
}, - "transaction_type": "BUY",
- "main_leg": {
- "order_type": "RL",
- "quantity": 50,
- "price": 0,
- "trigger_price": 0
}, - "stoploss_leg": {
- "legs": {
- "quantity": 0,
- "price": 97,
- "trigger_price": 98
}, - "trail": {
- "ltp_jump_price": 1.25,
- "stoploss_jump_price": 0.75
}
}, - "profit_leg": {
- "legs": [
- {
- "quantity": 0,
- "price": 102
}
]
}, - "order_identifier": "108108108"
}{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The Modify bracket order API lets you modify a pending bracket order. The expected parameter in the API order_id should be the main leg order id (as received in response from place bracket order API).
| exchange required | string Exchange segment |
| order_id required | string Order id. It must be URL encoded as it contains special characters. |
object | |
object | |
object | |
object |
{- "main_leg": {
- "order_type": "RL",
- "quantity": 50,
- "traded_quantity": 50,
- "price": 100,
- "trigger_price": 0
}, - "stoploss_leg": {
- "legs": [
- {
- "quantity": 0,
- "price": 97,
- "trigger_price": 98
}
], - "trail": {
- "ltp_jump_price": 1.25,
- "stoploss_jump_price": 0.75
}
}, - "profit_leg": {
- "legs": [
- {
- "quantity": 0,
- "price": 102
}
]
}, - "fields_modified": {
- "main_leg_price": true,
- "main_leg_qty": true,
- "stoploss_leg_price": true,
- "stoploss_trail_price": true,
- "profit_leg_price": true
}
}{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The exit bracket order API lets you exit the that particular order of a user.
| exchange required | string Exchange segment |
| order_id required | string Order id |
{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The Trade Book API lets you fetch list of trades executed of current day by the user
| offset required | integer Specifies the page number of the collection to be displayed |
| limit required | integer Limits the number of items on a page |
| order_id | string Pass order id to filter records based on order id. It must be URL encoded as it contains special characters. |
{- "status": "success",
- "code": "s-101",
- "message": "Success message",
- "data": {
- "order_id": "123456",
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "trade_no": "12345678",
- "exchange_order_no": "87987978",
- "transaction_type": "BUY",
- "product_type": "DELIVERY",
- "order_type": "RL",
- "trade_quantity": 50,
- "trade_price": 100,
- "symbol": "ACC",
- "series": "EQ",
- "instrument": "EQUITIES",
- "expiry_date": "",
- "strike_price": null,
- "option_type": "",
- "trade_timestamp": "2020-01-20 12:10:10",
- "initiated_by": "WEBAPI",
- "modified_by": "",
- "order_identifier": "108108108"
}, - "metadata": {
- "total_records": 500
}
}The Order book API lets you fetch all orders of a user along with the latest status.
| offset required | integer Specifies the page number of the collection to be displayed |
| limit required | integer Limits the number of items on a page |
| order_id | string Pass order id to filter records based on order id. It must be URL encoded as it contains special characters. |
{- "status": "success",
- "code": "s-101",
- "message": "Success message",
- "data": [
- {
- "order_id": "123456",
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "exchange_order_no": "87987978",
- "status": "PENDING",
- "error_reason": "",
- "transaction_type": "BUY",
- "product_type": "INTRADAY",
- "order_type": "RL",
- "total_quantity": 50,
- "pending_quantity": 10,
- "traded_quantity": 40,
- "disclosed_quantity": 25,
- "order_price": 100,
- "trigger_price": 0,
- "validity": "DAY",
- "validity_days": 0,
- "symbol": "ACC",
- "series": "EQ",
- "instrument": "EQUITIES",
- "expiry_date": "",
- "strike_price": null,
- "option_type": "",
- "order_timestamp": "2020-01-20 12:10:10",
- "exchange_timestamp": "2020-01-20 12:11:10",
- "initiated_by": "TEST",
- "modified_by": "TEST",
- "is_amo_order": false,
- "order_identifier": "108108108",
- "bracket_details": {
- "parent_order_id": "123456",
- "leg_indicator": "MAIN_LEG",
- "stoploss_price": 100,
- "stoploss_trigger_price": 102,
- "profit_price": 105,
- "stoploss_jump_price": "1,",
- "ltp_jump_price": 1,
- "bo_order_id": "1",
- "bo_order_status": "PENDING",
- "bo_modify_flag": 7
}
}
], - "metadata": {
- "total_records": 500
}
}Order history keeps audit trail (modifications/changes) of an order. It will provide track of a particular order along with its activities done.
| order_id required | string order id, It must be URL encoded as it contains special characters. |
{- "status": "success",
- "code": "s-101",
- "message": "Success message",
- "data": [
- {
- "order_id": "123456",
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "exchange_order_no": "87987978",
- "status": "PENDING",
- "error_reason": "",
- "transaction_type": "BUY",
- "product_type": "INTRADAY",
- "order_type": "RL",
- "total_quantity": 50,
- "pending_quantity": 10,
- "traded_quantity": 40,
- "disclosed_quantity": 25,
- "order_price": 100,
- "trigger_price": 0,
- "validity": "DAY",
- "validity_days": 0,
- "symbol": "ACC",
- "series": "EQ",
- "instrument": "EQUITIES",
- "expiry_date": "",
- "strike_price": null,
- "option_type": "",
- "order_timestamp": "2020-01-20 12:10:10",
- "exchange_timestamp": "2020-01-20 12:11:10",
- "initiated_by": "TEST",
- "modified_by": "TEST",
- "is_amo_order": false,
- "order_identifier": "108108108",
- "bracket_details": {
- "parent_order_id": "123456",
- "leg_indicator": "MAIN_LEG",
- "stoploss_price": 100,
- "stoploss_trigger_price": 102,
- "profit_price": 105,
- "stoploss_jump_price": "1,",
- "ltp_jump_price": 1,
- "bo_order_id": "1",
- "bo_order_status": "PENDING",
- "bo_modify_flag": 7
}
}
], - "metadata": {
- "total_records": 500
}
}This section provided to information of API calls to fetch open position and holding detail of user as uploaded by member in System.
Positions contain the user open position across exchange segments. The Equity positions which are passed overnight are transferred to the holdings portfolio the following day. The positions API provides two sets of positions i.e. Daily and Expiry where position tagged as ‘Expiry’ is the carryforwarded positions and position tagged as ‘Daily’ is today's created positions.
| type required | integer Default: "daily" Enum: "daily" "expiry" Type of position to fetch daily or expiry |
{- "status": "success",
- "code": "s-101",
- "message": "Success message",
- "data": {
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "product_type": "INTRADAY",
- "symbol": "ACC",
- "series": "EQ",
- "instrument": "EQUITIES",
- "expiry_date": "",
- "strike_price": null,
- "option_type": "",
- "buy_quantity": 10,
- "avg_buy_price": 1500,
- "buy_value": 15000,
- "sell_quantity": 10,
- "avg_sell_price": 1600,
- "sell_value": 16000,
- "net_quantity": 0,
- "net_price": 0,
- "net_value": 0,
- "ltp": 1560,
- "close_price": 1500,
- "multiplier": 1
}
}Position Conversion API enable users to convert their open positions from source product to target product i.e. Intraday to Delivery or vice versa.
| exchange required | string Exchange segment. |
| scrip_token required | integer Exchange token number of the scrip or instrument. |
| transaction_type required | string Order is BUY or SELL. |
| quantity required | integer Number of quantity to convert. |
| old_product_type required | string Old product type. |
| new_product_type required | string New product type. |
| bo_order_id | string Bracket order id, Bracket order position conversion is allowed individual bracket order wise only. bo_order_id need to pass here. This number is available in order book. |
{- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "transaction_type": "BUY",
- "quantity": 50,
- "old_product_type": "INTRADAY",
- "new_product_type": "DELIVERY",
- "bo_order_id": ""
}{- "status": "success",
- "code": "s-101",
- "message": "Success Message"
}The Holding API provide the detail of user's holding as uploaded by broker. Stock bought under Delivery Product earlier which payout is pending with exchange is show under holding i.e. User bought 10 shares of reliance on Monday then on Tuesday it will be shown under Holding.
{- "status": "success",
- "code": "s-101",
- "message": "Success message",
- "data": {
- "isin": "INE516F01016",
- "security_info": [
- {
- "exchange": "NSE_EQ",
- "scrip_token": 22,
- "symbol": "ACC"
}, - {
- "exchange": "BSE_EQ",
- "scrip_token": 500410,
- "symbol": "ACC"
}
], - "total_free": 1,
- "dp_free": 0,
- "pool_free": 1,
- "t1_quantity": 1,
- "average_price": 94.75,
- "last_price": 93.75,
- "pnl": -100,
- "current_value": -100,
- "inv_value": -100,
- "product": "DELIVERY",
- "collateral_quantity": 0,
- "collateral_value": 0
}
}The Price Feed API allows to get price feed from broadcast server.
Basic Flow to Implement the APIs:
STEP 1: Make a Login API call using login credential to obtain the broadcast socket server endpoint and broadcast access token.
STEP 2: Use broadcast access token in login request to broadcast server.
Click here to know how to connect or download API documentation.
System provides real-time streaming data to receive order & trade responses. This feature is exposed via socket.io. You need to use the standard socket.io library (for more information, kindly refer https://socket.io/).
This streaming feature is only meant for receiving real-time “Order & Trade responses”. All other features (order placement, order modification, portfolio details, etc.) need to be implemented using their respective APIs covered in the previous sections.
To use this feature, a client needs to establish a socket connection with the streaming server and subscribe to the events. Establishing the connectivity requires a couple of fields that are received in the Login API response (refer the User -> Login section to know how to login):
a. “others”:”messageSocket” – Streaming server’s endpoint that is used in the Connect section below.
b. “access_token” – A unique token that is issued to you for the purpose of authentication and is used in the Login section below.
Given below are the detailed steps, with a sample NodeJS code, describing the various events and how to subscribe to these events:
1. Connect: This step comprises of establishing the socket connection with the streaming server.
const io = require("socket.io-client"); // NPM package for socket.io
let ioClient = io.connect(url, {transports:['websocket']}); // url will be received in the Login API response -> “others”:“messageSocket”
2. Login: Here, you need to get authenticated before subscribing to events from the streaming server.
ioClient.on("connect", () => {
let msgLogin = {“jToken”:"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0b2tlbiIsImlhdCI6MTU5MzQ5.j80QyIeFOCJzNQk "}; // jToken will be received in Login API response -> “access_token”
ioClient.emit('loginAPI', msgLogin); // the socket will get disconnected if the authentication check is unsuccessful
})
3. Order/ Trade response: You need to subscribe to the MSG:DATA event to receive order & trade responses from the streaming server.
ioClient.on("MSG:DATA", (response) => {
console.log(' Received response : ' + JSON.stringify(response)) ;
})
We have provided the order & trade response structures as well as sample responses after the Disconnect section below. It will help you understand the JSON response structure and the fields that are returned.
4. Disconnect: You need to disconnect the socket to close the connection with the streaming server. Moreover, you also need to subscribe to the “disconnect” event in case the server disconnects the connection.
ioClient.on("disconnect", (err) => {
console.log("Disconnected: Error: "+ err );
})
Note: To differentiate order and trade response, kindly refer "MessageType" in the response. For order response, the value will be "ORD_NRML" and for trade response, it will be "TRD_MSG".
Order response structure:
| Parameter (Key) | Data Type | Description |
| AMOOrderID | String | Order id for AMO/ EqGTD orders otherwise blank |
| Buy_Sell | String | 1 -> Buy 2 -> Sell |
| CP_ID | String | |
| CliOrderNumber | Integer | Gateway/Client order number [System Generated] |
| DQ | Integer | Disclose quantity. Specifies the quantity that has to be disclosed to the market e.g 2500 |
| DQRemaining | Integer | Disclose quantity remaining |
| Days | String | Number of days |
| Exchange | String | Exchange for which order is to be placed |
| ExpiryDate | String | Expiry Date. Ddmmmyyyy e.g 24JUN2004. Applicable for Future and option segment only |
| GTDOrderStatus | Integer | GTDOrderStatus |
| InitiatedBy | String | Initiated from application |
| InitiatedByUserId | String | Initiated from user id |
| InstrumentName | String | Instrument name provided in security information. Valid values are given bellow Equity = blank Future Index = FUTIDX Interest Rate Future = FUTINT Future Stock = FUTSTK Option Index = OPTIDX Option Stock = OPTSTK MCX/NCDEX Futures = FUTCOM MCXSpot = COM NCDEXSpot = COMDTY NSE Currency Future = FUTCUR, FUTIRD, FUTIRT, OPTCUR NSE Currency Spot = INDEX, UNDCUR, UNDIRD, UNDIRT |
| LastModifiedTime | Date Time | Time when order was confirmed |
| LegIndicator | String | Blank value |
| ManagerID | String | Manager Id |
| MarketType | Integer | Normal = 1 Auction = 2 PreOpen = 3 |
| MessageSequenceNumber | String | Running Message Sequence Number. For order’s latest status always consider max sequence number. |
| MessageType | String | ORD_NRML |
| Misc | String | Values will be: SPO-LMT, SPO-MKT, PO-MKT, PO-LMT |
| ModifiedBy | String | Modified by application |
| ModifiedByUserId | String | Modified by user id |
| Option_Type | String | Option Type. Applicable for options only. |
| OrderEntryTime | Date Time | Date and Time will be in 24 Hour Format e.g.: 15Jun2019 15.25.15 |
| OrderNumber | String | For order entry request must be 0. In case of Modification/Cancellation request, this needs to be filled before sending. |
| OrderOriginalQty | Integer | Total Quantity of an Order |
| OrderPrice | Integer | Specifies the price in paise at which the order is placed. |
| OrderStatus | Integer | Order Status |
| OrderType | Integer | Order Type |
| OrderValidity | String | Validity |
| PartCode | String | Participant ID |
| PendingQty | Integer | Pending quantity |
| ProCli | String | 2 -> PRO 1 -> Client |
| Product | String | ProductType of the order |
| Reason | String | Rejection Reason |
| ScripCode | String | Scrip Code |
| Series | String | Exchange provided Security Series |
| SpreadFlag | Integer | Normal order = 0 Spread order = 1 |
| SpreadPrice | Integer | Spread Price |
| StrikePrice | Integer | Exchange provided Strike price (in multiples of 100). Applicable only for options. |
| Symbol | String | Exchange provided Security symbol |
| TradedQTY | String | Traded Quantity |
| TriggerPrice | Integer | Trigger Price at which Stop loss Order should be active in market. This field is applicable only for a Stop loss order. |
| UCC | String | Alias UCC Code |
| UniqueCode | String | Alphanumeric value with special characters |
| UserID | String | Exchange User ID |
| UserRemarks | String | User Remarks |
| Parameter (Key) | Data Type | Description |
| Buy_Sell | String | 1 -> Buy 2 -> Sell |
| CP_ID | String | |
| CliOrderNumber | Integer | Gateway/Client order number [System Generated] |
| DQ | String | Disclose quantity. Specifies the quantity that has to be disclosed to the market e.g 2500 |
| DQRemaining | String | Disclose quantity remaining |
| Days | Integer | Number of days |
| Exchange | Integer | Exchange |
| ExpiryDate | String | Expiry Date. Ddmmmyyyy e.g 24JUN2004. Applicable for Future and option segment only |
| InitiatedBy | String | Initiated from application |
| InitiatedByUserId | String | Initiated from user id |
| InstrumentName | String | Instrument name provided in security information. Valid values are given bellow Equity = blank Future Index = FUTIDX Interest Rate Future = FUTINT Future Stock = FUTSTK Option Index = OPTIDX Option Stock = OPTSTK MCX/NCDEX Futures = FUTCOM MCXSpot = COM NCDEXSpot = COMDTY NSE Currency Future = FUTCUR, FUTIRD, FUTIRT, OPTCUR NSE Currency Spot = INDEX, UNDCUR, UNDIRD, UNDIRT |
| LegIndicator | String | Blank value |
| ManagerID | Integer | Manager Id |
| MessageSequenceNumber | Integer | Running Message Sequence Number |
| MessageType | String | TRD_MSG |
| Misc | String | Values will be: SPO-LMT, SPO-MKT, PO-MKT, PO-LMT |
| ModifiedBy | String | Modified by application |
| ModifiedByUserId | String | Modified by user id |
| Option_Type | String | Option Type. Applicable for options only. |
| OrderLastModifiedTime | Date Time | Time when order was confirmed. Date and Time will be in 24 Hour Format e.g.: 15Jun2019 15.25.15 |
| OrderNumber | String | For order entry request must be 0. In case of Modification/Cancellation request, this needs to be filled before sending. |
| OrderOriginalQty | Integer | Total Quantity of an Order |
| OrderPrice | Integer | Order Price (Fresh order/ Modified order) in paisa |
| OrderTime | Date Time | Date and Time will be 24 Hour format like: 15Jun2019 15.25.15 |
| OrderType | Integer | Order Type |
| PartCode | String | Participant ID |
| PendingQty | String | Pending quantity |
| ProCli | String | 2 -> PRO 1 -> Client |
| Product | String | ProductType of the order |
| QuantityTradedToday | Integer | Total no. of quantity traded inclusive of the current trade quantity |
| ScripCode | Integer | Scrip Code |
| Series | String | Exchange provided Security Series |
| SpreadFlag | Integer | Normal order = 0 Spread order = 1 |
| SpreadPrice | Integer | Spread Price |
| StrikePrice | Integer | Exchange provided Strike price (in multiples of 100). Applicable only for options. |
| Symbol | String | Exchange provided Security symbol |
| TradeNumber | String | Trade no. |
| TradeQty | String | Traded Quantity |
| TradeTime | Date Time | Date and Time will be 24 Hour format like: 15Jun2019 15.25.15 |
| TradedPrice | String | Trade price in paisa. e.g. 45065 (in multiples of 100) |
| UCC | String | Alias UCC Code |
| UniqueCode | String | Alphanumeric value with special characters |
| UserID | String | Exchange User ID |
| UserRemarks | String | User Remarks |