Complete developer reference for NSE India's internal JSON endpoints — tested, documented, and ready to integrate into your paper trading platform.
https://www.nseindia.com to seed a session cookie, then reuse that session for all subsequent API calls. The cookie expires every ~5 minutes. Your backend must handle re-seeding automatically.
import requests, time, threading class NSESession: BASE = "https://www.nseindia.com" HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.9", "Referer": "https://www.nseindia.com/", "sec-fetch-site": "same-origin", "sec-fetch-mode": "cors", "sec-fetch-dest": "empty", } def __init__(self): self.session = requests.Session() self.session.headers.update(self.HEADERS) self._seed() # auto re-seed every 4 minutes self._schedule_reseed() def _seed(self): self.session.get(self.BASE, timeout=15) time.sleep(1) def _schedule_reseed(self): t = threading.Timer(240, self._reseed_loop) t.daemon = True t.start() def _reseed_loop(self): self._seed() self._schedule_reseed() def get(self, path): url = self.BASE + path r = self.session.get(url, timeout=10) r.raise_for_status() return r.json() # Usage nse = NSESession() market = nse.get("/api/market-status") chain = nse.get("/api/option-chain-indices?symbol=NIFTY")
const axios = require('axios'); const BASE = 'https://www.nseindia.com'; const HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.9', 'Referer': 'https://www.nseindia.com/', 'sec-fetch-site': 'same-origin', 'sec-fetch-mode': 'cors', }; let cookies = ''; async function seedCookie() { const res = await axios.get(BASE, { headers: HEADERS }); cookies = (res.headers['set-cookie'] || []) .map(c => c.split(';')[0]).join('; '); } async function nseGet(path) { const res = await axios.get(BASE + path, { headers: { ...HEADERS, 'Cookie': cookies } }); return res.data; } // Re-seed every 4 minutes setInterval(seedCookie, 4 * 60 * 1000); // Init and use (async () => { await seedCookie(); const status = await nseGet('/api/market-status'); const chain = await nseGet('/api/option-chain-indices?symbol=NIFTY'); console.log(status, chain); })();
# Step 1: seed cookie (run once, save the cookies.txt) curl -c cookies.txt -b cookies.txt \ -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)" \ -H "Accept: */*" \ -H "Referer: https://www.nseindia.com/" \ https://www.nseindia.com # Step 2: call any endpoint (reuse cookies.txt) curl -c cookies.txt -b cookies.txt \ -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)" \ -H "Accept: */*" \ -H "Referer: https://www.nseindia.com/" \ "https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY"
| # | Status | Method | Description | Full URL | Key Response Fields | Notes |
|---|---|---|---|---|---|---|
| 1 | WORKS | GET | Market open/close status for all segments | https://www.nseindia.com/api/market-status | marketStatetradeDatemarketmarketStatus | Returns status for CM, FO, CDS, COM segments |
| 2 | WORKS | GET | NSE trading holidays list | https://www.nseindia.com/api/holiday-master?type=trading | CMFOdatedescription | Returns holiday list by segment. Use for disabling trading on holidays. |
| 3 | WORKS | GET | Market-wide turnover summary | https://www.nseindia.com/api/market-turnover | datadateturnOver | Total buy/sell turnover across all segments |
| # | Status | Method | Description | Full URL | Key Response Fields | Notes |
|---|---|---|---|---|---|---|
| 4 | WORKS | GET | All NSE indices — LTP, change, % change | https://www.nseindia.com/api/allIndices | data[]indexSymbollastpercentChangehighlow | Best single call to get all index LTPs. Use for dashboard. |
| 5 | WORKS | GET | NIFTY 50 — all 50 stocks with quotes | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%2050 | data[]symbollastPricepChangeopenhighlow | Replace index param for other indices (see rows 6–17) |
| 6 | WORKS | GET | NIFTY BANK stocks | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20BANK | data[]symbollastPricepChange | 12 bank stocks. Critical for BANKNIFTY F&O traders. |
| 7 | WORKS | GET | NIFTY NEXT 50 | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20NEXT%2050 | data[]lastPricepChange | — |
| 8 | WORKS | GET | NIFTY IT index stocks | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20IT | data[]lastPrice | — |
| 9 | WORKS | GET | NIFTY MIDCAP 50 | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20MIDCAP%2050 | data[] | — |
| 10 | WORKS | GET | NIFTY MIDCAP 100 | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20MIDCAP%20100 | data[] | — |
| 11 | WORKS | GET | NIFTY SMALLCAP 100 | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20SMALLCAP%20100 | data[] | — |
| 12 | WORKS | GET | NIFTY AUTO | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20AUTO | data[] | — |
| 13 | WORKS | GET | NIFTY PHARMA | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20PHARMA | data[] | — |
| 14 | WORKS | GET | NIFTY FMCG | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20FMCG | data[] | — |
| 15 | WORKS | GET | NIFTY METAL | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20METAL | data[] | — |
| 16 | WORKS | GET | NIFTY REALTY | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20REALTY | data[] | — |
| 17 | WORKS | GET | All F&O eligible securities list | https://www.nseindia.com/api/equity-stockIndices?index=SECURITIES%20IN%20F%26O | data[]symbollastPrice | Use this to populate your F&O stock dropdown list |
| # | Status | Method | Description | Full URL (replace SYMBOL) | Key Response Fields | Notes |
|---|---|---|---|---|---|---|
| 18 | WORKS | GET | Full equity quote for any stock | https://www.nseindia.com/api/quote-equity?symbol=RELIANCE | priceInfo.lastPricepriceInfo.changepriceInfo.pChangepriceInfo.openpriceInfo.intraDayHighLowmetadata.companyName | Replace RELIANCE with any NSE symbol. Returns full OHLCV + company info. |
| 19 | WORKS | GET | Trade info — volume, delivery %, 52W high/low | https://www.nseindia.com/api/quote-equity?symbol=RELIANCE§ion=trade_info | tradeInfo.totalTradedVolumetradeInfo.deliveryToTradedQuantityweekHighLow | Add §ion=trade_info to get delivery volume data |
| 20 | WORKS | GET | Equity meta — company details, sector, listing date | https://www.nseindia.com/api/equity-meta-info?symbol=RELIANCE | symbolcompanyNameindustryisFNOSeclistingDate | Use to show company profile cards in UI |
| 21 | WORKS | GET | Symbol search / autocomplete | https://www.nseindia.com/api/search/autocomplete?q=TATA | symbols[]symbolsymbol_inforesult[] | Use for stock search box. Replace TATA with any partial name/symbol. |
| # | Status | Method | Description | Full URL | Key Response Fields | Notes |
|---|---|---|---|---|---|---|
| 22 | WORKS ⭐ | GET | NIFTY Full Option Chain — all strikes, CE/PE LTP, OI, IV | https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY | records.underlyingValuerecords.expiryDates[]records.data[].CE.lastPricerecords.data[].PE.openInterestrecords.data[].strikePricefiltered.data[] | THE most important endpoint. Returns all expiries, all strikes, OI, IV. ~2–4 MB response. |
| 23 | WORKS ⭐ | GET | BANKNIFTY Full Option Chain | https://www.nseindia.com/api/option-chain-indices?symbol=BANKNIFTY | records.underlyingValuerecords.data[].CErecords.data[].PErecords.data[].strikePrice | Same structure as NIFTY chain. Strike gap is 100. |
| 24 | WORKS | GET | FINNIFTY option chain | https://www.nseindia.com/api/option-chain-indices?symbol=FINNIFTY | records.data[]underlyingValue | — |
| 25 | WORKS | GET | MIDCPNIFTY option chain | https://www.nseindia.com/api/option-chain-indices?symbol=MIDCPNIFTY | records.data[] | — |
| 26 | WORKS | GET | Stock option chain — RELIANCE | https://www.nseindia.com/api/option-chain-equities?symbol=RELIANCE | records.data[]CE.lastPricePE.lastPricestrikePrice | Replace RELIANCE with any F&O stock symbol |
| 27 | WORKS | GET | NIFTY futures & options derivative quote | https://www.nseindia.com/api/quote-derivative?symbol=NIFTY | stocks[].metadatalastPriceopenInterestimpliedVolatilityexpiryDate | Returns futures + option contracts. Good for F&O watchlist. |
| 28 | WORKS | GET | BANKNIFTY derivative quote | https://www.nseindia.com/api/quote-derivative?symbol=BANKNIFTY | stocks[].metadatalastPrice | — |
| 29 | CONDITIONAL | GET | Live NIFTY futures (market hours only) | https://www.nseindia.com/api/liveEquity-derivatives?index=nse50_fut | data[]lastPriceopenInterestexpiryDate | Returns empty during market close. Works 9:15–3:30 IST weekdays. |
| 30 | CONDITIONAL | GET | Live BANKNIFTY futures (market hours only) | https://www.nseindia.com/api/liveEquity-derivatives?index=banknifty_fut | data[]lastPrice | Same caveat as above. Use quote-derivative instead for 24/7 access. |
// GET /api/option-chain-indices?symbol=NIFTY { "records": { "expiryDates": ["10-Apr-2025", "17-Apr-2025", ...], "data": [ { "strikePrice": 22000, "expiryDate": "10-Apr-2025", "CE": { "strikePrice": 22000, "lastPrice": 145.5, // LTP "openInterest": 125000, // OI in lots "changeinOpenInterest": 2500, "impliedVolatility": 12.5, // IV % "volume": 48000, "change": -12.5, "pChange": -7.9, "bidQty": 150, "bidprice": 145, "askQty": 75, "askPrice": 146 }, "PE": { "strikePrice": 22000, "lastPrice": 78.2, "openInterest": 95000, "impliedVolatility": 13.1, "volume": 32000 } } ], "underlyingValue": 22187.65 // Current NIFTY spot price }, "filtered": { "data": [...], // Only near ATM strikes "CE": { "totOI": 12500000, "totVol": 4800000 }, "PE": { "totOI": 11200000, "totVol": 4100000 } } }
| # | Status | Method | Description | Full URL | Key Response Fields | Notes |
|---|---|---|---|---|---|---|
| 31 | WORKS | GET | Top gainers — equity | https://www.nseindia.com/api/live-analysis-variations?index=gainers&trade_type=securities | NIFTY[].symbollastPricenetPricetradedQuantity | Returns top gainers grouped by index. Great for homepage widget. |
| 32 | WORKS | GET | Top losers — equity | https://www.nseindia.com/api/live-analysis-variations?index=losers&trade_type=securities | NIFTY[].symbollastPricenetPrice | — |
| 33 | WORKS | GET | Top gainers — F&O | https://www.nseindia.com/api/live-analysis-variations?index=gainers&trade_type=fno | data[]symbollastPrice | — |
| 34 | WORKS | GET | Top losers — F&O | https://www.nseindia.com/api/live-analysis-variations?index=losers&trade_type=fno | data[] | — |
| 35 | WORKS | GET | Near 52-week high stocks | https://www.nseindia.com/api/live-analysis-variations?index=nearWeekHigh&trade_type=securities | data[].symbollastPriceweekHigh52 | Useful for breakout scanner widget |
| 36 | WORKS | GET | Near 52-week low stocks | https://www.nseindia.com/api/live-analysis-variations?index=nearWeekLow&trade_type=securities | data[].symbolweekLow52 | — |
| 37 | WORKS | GET | Most active by volume (top 10) | https://www.nseindia.com/api/live-analysis-most-active-securities?index=volume&limit=10 | data[].symbollastPricetradedQuantity | Change limit to 20 or 50 for more stocks |
| 38 | WORKS | GET | Most active by value (top 10) | https://www.nseindia.com/api/live-analysis-most-active-securities?index=value&limit=10 | data[].symbollastPriceturnover | — |
| # | Status | Method | Description | Full URL | Key Response Fields | Notes |
|---|---|---|---|---|---|---|
| 39 | WORKS | GET | Historical OHLCV — equity (RELIANCE, Jan–Mar 2025) | https://www.nseindia.com/api/historical/cm/equity?symbol=RELIANCE&series=[%22EQ%22]&from=01-01-2025&to=31-03-2025 | data[].CH_TIMESTAMPCH_OPENING_PRICECH_CLOSING_PRICECH_HIGH_PRICECH_LOW_PRICECH_TOT_TRADED_QTY | Date format: DD-MM-YYYY. Max range: ~3 months per call. Replace symbol and dates. |
| 40 | WORKS | GET | Historical OHLCV — TCS | https://www.nseindia.com/api/historical/cm/equity?symbol=TCS&series=[%22EQ%22]&from=01-01-2025&to=31-03-2025 | data[] | — |
| 41 | CONDITIONAL | GET | Historical F&O data — NIFTY CE option | https://www.nseindia.com/api/historical/fo/derivatives?instrumentType=OPTIDX&symbol=NIFTY&expiryDate=27-Mar-2025&optionType=CE&strikePrice=22000&from=01-03-2025&to=27-03-2025 | data[].FH_CLOSING_PRICEFH_OPEN_INTFH_TIMESTAMP | Works but requires valid expiry date. Returns 404 for expired/invalid contracts. |
| # | Status | Method | Description | Full URL | Key Response Fields | Notes |
|---|---|---|---|---|---|---|
| 42 | WORKS | GET | Corporate actions (dividends, splits, bonuses) | https://www.nseindia.com/api/corporates-corporateActions?index=equities&from_date=01-01-2025&to_date=31-03-2025 | symbolsubjectexDaterecordDatefaceVal | Useful for showing dividend calendar in your app |
| 43 | WORKS | GET | Company announcements — RELIANCE | https://www.nseindia.com/api/corporates-announcements?index=equities&symbol=RELIANCE | data[].subjectdescattchmntFileexchdisstime | Replace RELIANCE with any symbol for news feed |
| 44 | WORKS | GET | Board meetings — TCS | https://www.nseindia.com/api/corporates-boardMeetings?index=equities&symbol=TCS | data[].bm_descbm_datesymbol | Show upcoming board meeting dates in stock profile |
| 45 | WORKS | GET | Block deals | https://www.nseindia.com/api/block-deal | data[].symbolbuySellquantitytradePriceclientName | Returns today's block deals. Empty on market-closed days. |
| # | Status | Attempted URL | HTTP Code | Reason | Alternative |
|---|---|---|---|---|---|
| 46 | FAILS | https://www.nseindia.com/api/live-analysis-variations?index=oi&trade_type=fno | 404 | OI analysis endpoint path changed. NSE restructured this in 2024. | Use /api/option-chain-indices and sum OI from records. |
| 47 | FAILS | https://www.nseindia.com/api/live-analysis-most-active-securities?index=oi&limit=10 | 404 | Same — OI index param removed. NSE changed endpoint structure. | Parse OI from option chain response instead. |
| 48 | FAILS | https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20PSU%20BANK | 401 | PSU BANK index requires enhanced session. Returns 401 intermittently. | Use allIndices and filter for PSU BANK entry. |
| 49 | UNRELIABLE | https://www.nseindia.com/api/snapshot-capital-market-wholesaleDebt | 200/503 | Flaky — works sometimes, 503 on others. Not recommended for production. | Use /api/block-deal for large deal data instead. |
// nse-proxy.js — Run on your server/VPS (NOT cloud providers) const express = require('express'); const axios = require('axios'); const app = express(); const BASE = 'https://www.nseindia.com'; const HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', 'Accept': '*/*', 'Referer': 'https://www.nseindia.com/', }; let cookies = ''; let lastSeed = 0; async function ensureCookie() { if (Date.now() - lastSeed > 240000) { // re-seed every 4 min const res = await axios.get(BASE, { headers: HEADERS }); cookies = (res.headers['set-cookie'] || []) .map(c => c.split(';')[0]).join('; '); lastSeed = Date.now(); } } async function nseGet(path) { await ensureCookie(); const res = await axios.get(BASE + path, { headers: { ...HEADERS, 'Cookie': cookies }, timeout: 10000, }); return res.data; } // Proxy routes — your React/Next.js frontend calls these app.get('/api/nse/market-status', async (req, res) => res.json(await nseGet('/api/market-status'))); app.get('/api/nse/indices', async (req, res) => res.json(await nseGet('/api/allIndices'))); app.get('/api/nse/option-chain', async (req, res) => { const { symbol = 'NIFTY' } = req.query; res.json(await nseGet(`/api/option-chain-indices?symbol=${symbol}`)); }); app.get('/api/nse/quote', async (req, res) => { const { symbol } = req.query; res.json(await nseGet(`/api/quote-equity?symbol=${symbol}`)); }); app.get('/api/nse/gainers', async (req, res) => res.json(await nseGet('/api/live-analysis-variations?index=gainers&trade_type=securities'))); app.get('/api/nse/losers', async (req, res) => res.json(await nseGet('/api/live-analysis-variations?index=losers&trade_type=securities'))); app.get('/api/nse/historical', async (req, res) => { const { symbol, from, to } = req.query; res.json(await nseGet(`/api/historical/cm/equity?symbol=${symbol}&series=[%22EQ%22]&from=${from}&to=${to}`)); }); app.listen(4000, () => console.log('NSE Proxy running on :4000'));
// Recommended polling intervals for your backend { "market-status": "every 60 seconds", "allIndices": "every 5 seconds", // for live index ticker "option-chain-indices": "every 10–15 seconds", // large payload, be careful "quote-equity": "every 5 seconds", // per-stock quote "gainers/losers": "every 30 seconds", // homepage widgets "historical": "once per day (cache)",// no need to refresh often "corporate-actions": "once per day (cache)" } // NSE rate limit: max 3 requests/second from same IP // If polling 3+ endpoints every 5s → add 400ms delay between calls // Cache results in Redis or in-memory to serve frontend without hammering NSE