Search
Symbol Search API
The Symbol Search API allows you to search for trading symbols across different exchanges. This API is useful for finding specific instruments, including stocks, futures, and options contracts.
Endpoint
Local Host : POST http://127.0.0.1:5000/api/v1/search
Ngrok Domain : POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/search
Custom Domain: POST https://<your-custom-domain>/api/v1/search
Request Headers
Header | Required | Description |
---|---|---|
Content-Type | Yes | application/json |
Request Body
Parameter | Type | Required | Description |
---|---|---|---|
apikey | string | Yes | Your OpenAlgo API key |
query | string | Yes | Search query (symbol name, partial name, or option chain) |
exchange | string | No | Exchange filter (NSE, BSE, NFO, MCX, etc.) |
Response
Success Response (200 OK)
{
"status": "success",
"message": "Found X matching symbols",
"data": [
{
"symbol": "string",
"brsymbol": "string",
"name": "string",
"exchange": "string",
"brexchange": "string",
"token": "string",
"expiry": "string",
"strike": number,
"lotsize": number,
"instrumenttype": "string",
"tick_size": number
}
]
}
Response Fields
Field | Type | Description |
---|---|---|
status | string | Status of the request (success/error) |
message | string | Descriptive message about the result |
data | array | Array of matching symbols |
symbol | string | Trading symbol |
brsymbol | string | Broker-specific symbol format |
name | string | Company/instrument name |
exchange | string | Exchange code |
brexchange | string | Broker-specific exchange code |
token | string | Unique instrument token |
expiry | string | Expiry date (for derivatives) |
strike | number | Strike price (for options) |
lotsize | number | Lot size for the instrument |
instrumenttype | string | Type of instrument (EQ, OPTIDX, etc.) |
tick_size | number | Minimum price movement |
Error Response
{
"status": "error",
"message": "Error description"
}
Error Codes
Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
403 | Forbidden - Invalid API key |
500 | Internal Server Error |
Examples
Example 1: Search for Options Contracts
Request:
curl -X POST http://127.0.0.1:5000/api/v1/search \
-H "Content-Type: application/json" \
-d '{
"apikey": "your_api_key_here",
"query": "NIFTY 25000 JUL CE",
"exchange": "NFO"
}'
Response:
{
"data": [
{
"brexchange": "NFO",
"brsymbol": "NIFTY17JUL2525000CE",
"exchange": "NFO",
"expiry": "17-JUL-25",
"instrumenttype": "OPTIDX",
"lotsize": 75,
"name": "NIFTY",
"strike": 25000,
"symbol": "NIFTY17JUL2525000CE",
"tick_size": 0.05,
"token": "47275"
},
{
"brexchange": "NFO",
"brsymbol": "FINNIFTY31JUL2525000CE",
"exchange": "NFO",
"expiry": "31-JUL-25",
"instrumenttype": "OPTIDX",
"lotsize": 65,
"name": "FINNIFTY",
"strike": 25000,
"symbol": "FINNIFTY31JUL2525000CE",
"tick_size": 0.05,
"token": "54763"
},
{
"brexchange": "NFO",
"brsymbol": "NIFTY31JUL2525000CE",
"exchange": "NFO",
"expiry": "31-JUL-25",
"instrumenttype": "OPTIDX",
"lotsize": 75,
"name": "NIFTY",
"strike": 25000,
"symbol": "NIFTY31JUL2525000CE",
"tick_size": 0.05,
"token": "55799"
},
{
"brexchange": "NFO",
"brsymbol": "NIFTY03JUL2525000CE",
"exchange": "NFO",
"expiry": "03-JUL-25",
"instrumenttype": "OPTIDX",
"lotsize": 75,
"name": "NIFTY",
"strike": 25000,
"symbol": "NIFTY03JUL2525000CE",
"tick_size": 0.05,
"token": "56699"
},
{
"brexchange": "NFO",
"brsymbol": "NIFTY10JUL2525000CE",
"exchange": "NFO",
"expiry": "10-JUL-25",
"instrumenttype": "OPTIDX",
"lotsize": 75,
"name": "NIFTY",
"strike": 25000,
"symbol": "NIFTY10JUL2525000CE",
"tick_size": 0.05,
"token": "40015"
},
{
"brexchange": "NFO",
"brsymbol": "NIFTY24JUL2525000CE",
"exchange": "NFO",
"expiry": "24-JUL-25",
"instrumenttype": "OPTIDX",
"lotsize": 75,
"name": "NIFTY",
"strike": 25000,
"symbol": "NIFTY24JUL2525000CE",
"tick_size": 0.05,
"token": "49487"
}
],
"message": "Found 6 matching symbols",
"status": "success"
}
Example 2: Search for Equity Symbols
Request:
curl -X POST http://127.0.0.1:5000/api/v1/search \
-H "Content-Type: application/json" \
-d '{
"apikey": "your_api_key_here",
"query": "TATA",
"exchange": "NSE"
}'
Response:
{
"data": [
{
"brexchange": "NSE",
"brsymbol": "TATAINVEST-EQ",
"exchange": "NSE",
"expiry": "",
"instrumenttype": "",
"lotsize": 1,
"name": "TATAINVEST",
"strike": -0.01,
"symbol": "TATAINVEST",
"tick_size": 0.5,
"token": "1621"
},
{
"brexchange": "NSE",
"brsymbol": "TATAELXSI-EQ",
"exchange": "NSE",
"expiry": "",
"instrumenttype": "",
"lotsize": 1,
"name": "TATAELXSI",
"strike": -0.01,
"symbol": "TATAELXSI",
"tick_size": 0.5,
"token": "3411"
},
{
"brexchange": "NSE",
"brsymbol": "TATATECH-EQ",
"exchange": "NSE",
"expiry": "",
"instrumenttype": "",
"lotsize": 1,
"name": "TATATECH",
"strike": -0.01,
"symbol": "TATATECH",
"tick_size": 0.05,
"token": "20293"
},
{
"brexchange": "NSE",
"brsymbol": "TATASTEEL-EQ",
"exchange": "NSE",
"expiry": "",
"instrumenttype": "",
"lotsize": 1,
"name": "TATASTEEL",
"strike": -0.01,
"symbol": "TATASTEEL",
"tick_size": 0.01,
"token": "3499"
},
{
"brexchange": "NSE",
"brsymbol": "TATAMOTORS-EQ",
"exchange": "NSE",
"expiry": "",
"instrumenttype": "",
"lotsize": 1,
"name": "TATAMOTORS",
"strike": -0.01,
"symbol": "TATAMOTORS",
"tick_size": 0.05,
"token": "3456"
}
],
"message": "Found 10 matching symbols",
"status": "success"
}
Example 3: Search Without Exchange Filter
Request:
curl -X POST http://127.0.0.1:5000/api/v1/search \
-H "Content-Type: application/json" \
-d '{
"apikey": "your_api_key_here",
"query": "RELIANCE"
}'
This will return all symbols matching "RELIANCE" across all exchanges.
Notes
- The search is case-insensitive
- Partial matches are supported
- For options, you can search using various formats:
- Symbol with strike and type: "NIFTY 25000 CE"
- Symbol with expiry: "NIFTY JUL"
- Complete option chain: "NIFTY 25000 JUL CE"
- The exchange parameter is optional but recommended for faster and more accurate results
- Empty or missing query parameter will return an error
- The API uses the same search logic as the web interface at
/search/token
Common Use Cases
- Finding Option Contracts: Search for specific strike prices and expiries
- Symbol Lookup: Find the exact trading symbol for a company
- Token Retrieval: Get the instrument token required for other API calls
- Lot Size Information: Retrieve lot sizes for F&O instruments
- Exchange Validation: Verify if a symbol is available on a specific exchange