Historical instruments of Options

Team,

I downloaded the instruments file from the Upstox and tried to extract out NIFTY options but can’t find historical instruments of options.

securities.JSON is the one having all instruments downloaded from Instruments | Upstox Developer API

The other 2 files I programmatically extracted NIFTY and BANKNIFTY option securities by filtering out using segment=“NSE_FO” and asset_symbol and ordered in ascending order of expiry date but you see they are of futures only.

Please help find any other way to fetch FNO historical data. (NIFTY specifically)

1 Like

@Ayush_48646255 Currently, expired instruments are not supported. However, the team is actively working on a dedicated API for this, and we will update this thread once it becomes available. Thanks

@Ayush_48646255 Good news — this feature is now available! You can refer to the documentation here

1 Like

@Anand_Sajankar

Thanks for your response buddy!; just another query–

I’m unable to exactly figure out which Nifty underlying index security (Its not clearly nifty50) should be considered for Nifty Weekly Options Expiry (call and put)

Find attached NIFTY securities I filtered out. Using its Instrument Key + Expiry + Strike + Call/Put we can find out historical security instrument and then using that we can request historical data.

Currently, I filtered this from the securities.json file-- using “segment”: “NSE_INDEX” programmatically [Link]

Your inputs will be highly appreciated!

@Ayush_48646255 Could you please provide more details along with an example instrument key? Also, it seems the securities JSON file is not attached—could you share its contents?

@Anand_Sajankar Sure buddy, I’ll elaborate again

JSON File reference (unable to upload here)- Instruments | Upstox Developer API
(mentioned under JSON files segment)

Requirement:- Nifty Weekly Options Expiry index security

Issue:-

Every security in that file has instrument key field which is the identifier used to gets its derived securities, price and to trade.

To get option chain of Nifty50 we are trying to locate Nifty50 index security from the file but can’t clearly figureout as there is no exact Nifty50 anywhere.

Looking forward to your prompt response!

@Ayush_48646255 The correct instrument key for Nifty 50 is NSE_INDEX|Nifty 50. You can find this key in the instrument JSON file.

For retrieving option chain data, you can use the Option chain API

Hope it helps, Thanks!

1 Like

Hi @Anand_Sajankar!

I tried to retrieve Nifty50 Index expired option chain but it gives unauthorized 401 response

(Exact:-- Response status code does not indicate success: 401 (Unauthorized).) Although the same API token works to get candles of Nifty50.

We tried following along with bearer token which works to get Nifty50 candles.

  1. https://api.upstox.com/v2/option/chain?instrument_key=NSE_FO|50970&2025-05-08
  2. https://api.upstox.com/v2/expired-instruments/option/contract?instrument_key=NSE_FO|50970&2025-05-08

Could you please check and let me know. Your assistance here would be highly appreciated!

i think we need to get upstox plus to get historical expired contracts :thinking:

1 Like

@SRINIVASAN_4196394 @Ayush_48646255 You’ll need to have an active Upstox Plus plan to access historical expired contracts.

This requirement is also mentioned in the announcement: :link: Expired Instruments API Launch | Upstox Developer API

And detailed further in the Plus Pack info: :link: Help Center

2 Likes

@Pradeep_Jaiswar

Thanks Pradeep for your response!

I’ve activated Plus; additionally, it had the query:- Would the same API tokens generated before will work for Plus account or we need to regenerate?

As it is showing the error “Still giving me 401 Unauthorized” for this token-- https://api.upstox.com/v2/option/chain?instrument_key=NSE_FO|50970&2025-05-08

whereas the following works with the same API token
https://api.upstox.com/v3/historical-candle/NSE_FO|50970/minutes/15/2025-05-09/2025-04-28

@Ayush_48646255 Try generating a new access token — that should resolve the issue.
If you’re still encountering the same error, please share your code so I can take a closer look.

Dear Upstox Support Team,

I hope this message finds you well.

I am currently using the Upstox API to fetch historical candle data for various expired option instruments. However, I’ve noticed that for several instruments, the API is returning either an empty dataset or no data at all, despite using valid parameters and date ranges.

Here is one example for your reference:

  • Instrument Key: NSE_FO|92348|24-04-2025
  • Exchange Token: 92348
  • Trading Symbol: BAJAJ-AUTO 8000 PE 24 APR 25
  • Interval: 1minute,3minute,5minute,15minute,30minute
  • API Endpoint Used:
    https://api.upstox.com/v2/expired-instruments/historical-candle/NSE_FO|92348|24-04-2025/30minute/2025-04-24/2025-03-10

This issue seems to be affecting multiple similar option instruments, not just this one.

Could you please investigate and confirm whether the data for these instruments is available? If not, is there any limitation or delay in making expired instrument data available through the API?

Your assistance is appreciated, and I look forward to your response.

Best regards,
Rahul

@Ayush_48646255 Could you please share the cURL request for the API that’s returning the error? I checked the Drive link you shared, but it only contains .exe and .json files—no code files were found.

Hi @Ayush_48646255
To access the option chain API, please ensure you are utilizing tokens from active applications rather than sandbox applications, as this functionality is unavailable in sandbox mode. Additionally, for security purposes, refrain from posting access tokens in public community forums.

Thanks!

1 Like

Your active access token expires daily at 3:30 AM, requiring you to create a new one each day. Please do not post access tokens in the community forum, even when seeking support for debugging

Thanks!

1 Like

@rahul Thank you for bringing this to our attention. We’ve identified the issue, and the team is currently working on backfilling the missing data. I’ll update this thread once the process is complete.

1 Like

@Anand_Sajankar
Thank you for the response

I want to point similar issue for NIFTY 50 .
options data is missing for this expiry date ‘2024-12-26’,

1 Like

@Ketan @Anand_Sajankar

Team,

On creating a new token, I’m facing the following error (removed the actual token-privacy concerns)

curl ‘https://api.upstox.com/v2/option/chain?instrument_key=NSE_FO|50970’ -H ‘Accept: application/json’ -H ‘Authorization: Bearer [Token here]’

Gives BadRequest

the code I am raising with this URL-
https://api.upstox.com/v3/historical-candle/NSE_FO|50970/minutes/15/2025-05-09/2025-04-28

Your assistance here would be highly appreciated!

Regards

@Ayush_48646255 It looks like the expiry_date parameter is missing in your Option Chain API request. Also please ensure you’re also passing the correct instrument_key for the underlying symbol.

You can refer to the API documentation here, and check out a sample request here for reference.

Thanks