I want to get the OHLC Candles data for an option on nifty 50,
You can refer to the example code here: OHLC Quotes | Upstox Developer API
And, check this for expired instruments: Expired Instruments API Launch | Upstox Developer API
Let us know if you need more help, thanks.