Get Security Info
This document outlines the Get Security Info API within the Firstock trading platform.
Overview
The Get Security Info API helps you confirm the internal and display identifiers for a given tradingSymbol on a specific exchange. This is particularly useful if you need more precise data about an instrument—beyond just last traded price, especially when working with multiple segments (e.g., EQT, FNO).
Key benefits:
- Accurate Instrument Details: Obtain fields like instrumentName and segment.
- Verification Step: Confirm that a tradingSymbol is valid and get its underlying system name (symbolName) or numeric token.
- Useful for F&O: Distinguish between futures, options, underlying indices or stocks, etc.
Endpoint & Method
POST
/securityInfo
URL:
https://api.firstock.in/V1/securityInfo
Headers
Name | Value |
---|---|
Content-Type |
application/json |
Body
Below is the general JSON body for the Get Security Info API request. All fields marked as Mandatory must be included.
Field | Type | Mandatory | Description | Example |
---|---|---|---|---|
userId |
string |
Yes |
Unique identifier for your Firstock account |
AB1234 |
jKey |
string |
Yes |
Active session token obtained |
ce1c4471eb95... |
exchange |
string |
Yes |
Name of the exchange |
"NSE" |
tradingSymbol |
string |
Yes |
Symbol or instrument identifier |
"IDEA-EQ" |
Request
{
"userId": "AB1234",
"jKey": "51dabe2245368d04bcb90490eb7c9a3ae4d35c034cebacf1aa7d5f78246c8018",
"exchange": "NSE",
"tradingSymbol": "NIFTY"
}
Example cURL Request
curl --location 'https://api.firstock.in/V1/securityInfo' \
--header 'Content-Type: application/json' \
--data '{
"userId": "AB1234",
"jKey": "51dabe2245368d04bcb90490eb7c9a3ae4d35c034cebacf1aa7d5f78246c8018",
"exchange": "NSE",
"tradingSymbol": "NIFTY"
}'
Response Structure
Success Response
A valid request will typically return a 200 OK status and a JSON object containing:
- status: Usually "success".
- message: A short note (e.g., "Fetched security info successfully").
- data: An object detailing the security’s info.
Key Fields within data :
- instrumentName: The instrument category (e.g., "EQ", "OPTIDX", "FUTSTK", etc.).
- segment: The market segment (e.g., "EQT", "FNO", etc.).
- symbolName: The system-recognized name for the instrument.
- tradingSymbol: The display-oriented name (may differ from the input if the system has a specific format).
- token: Numeric identifier used within Firstock’s system.
- priceFactor, pricePrecision, tickSize: Information about how prices are calculated or displayed.
Failure Response
If any required field is missing, invalid, or the session token (jKey
) is expired, you may receive a 400 or 401 status code with an error object:
- status: "failed".
- code: Error code (e.g., "400", "401").
- Invalid or missing jKey.
- Empty or incorrect tradingSymbol or exchange.
- Security not found (the symbol may not exist or be spelled incorrectly).
Response
{
"status": "success",
"message": "Fetched security info successfully",
"data": {
"exchange": "NSE",
"instrumentName": "UNDIND",
"lotSize": "1",
"mult": "1",
"priceFactor": "(1 / 1 ) * (1 / 1)",
"pricePrecision": "2",
"segment": "EQT",
"symbolName": "NIFTY",
"tickSize": "0.00",
"token": "26000",
"tradingSymbol": "Nifty 50"
}
}
{
"status": "failed",
"code": "400",
"name": "BAD_REQUEST",
"error": {
"field": "exchange",
"message": "required field is empty or missing: exchange"
}
}
Usage & Best Practices
- Verification Before Trading
- Use this API to confirm the correct segment, instrumentName, or lotSize before placing F&O orders.
- Session Management
- Maintain a valid jKey. If INVALID_JKEY or similar errors arise, re-login or refresh tokens as needed.
- Error Handling
- If status is "failed", review the error.field and error.message to correct any missing or invalid parameters.
- Reference Data
- Consider storing or caching common results if you repeatedly request the same symbol (e.g., “NIFTY”) to reduce API overhead.
- Integration with Other APIs
- Combine with Order Margin, Place Order, or Get Quotes for a seamless workflow once you have the correct details for a symbol.
Conclusion
The Get Security Info API is a crucial tool for validating an instrument’s internal details—such as segment, instrumentName, lotSize, and token—before you proceed with more advanced operations. Make sure to maintain a valid session (jKey), handle errors gracefully, and use this data to ensure you’re interacting with the correct instrument.The Get Quote LTP API offers a streamlined approach to fetching the latest traded price for a single (or multiple) symbols, perfect for quick checks or lightweight applications. Make sure to maintain valid authentication (jKey) and verify your symbol formats. For more advanced data (like best bid/ask levels), consider the full Get Quotes API. If you encounter repeated errors or need more details, refer to Firstock’s official documentation or contact support.