{"openapi":"3.1.0","info":{"title":"Upstox (BYOK) API","version":"0.1.0","description":"Upstox (BYOK) lets an AI assistant read your own Upstox data through the Upstox API with a key you supply (Upstox Analytics Token (read-only, valid one year)). Read-only: 12 tools (search_instruments, get_ltp_quotes, get_ohlc_quotes, get_historical_candles, get_intraday_candles, get_market_status, get_market_holidays, get_market_timings, get_option_chain, get_option_contracts, get_put_call_ratio,...\n\nEvery operation is read-only or compute-only. The same tools are available over MCP (streamable HTTP) at https://byok-upstox.connectorbay.com/mcp.","contact":{"name":"Unify Dynamics LLC","email":"agent@connectorbay.com","url":"https://connectorbay.com/byok-upstox/docs"},"termsOfService":"https://connectorbay.com/byok-upstox/terms"},"servers":[{"url":"https://byok-upstox.connectorbay.com"}],"externalDocs":{"url":"https://connectorbay.com/byok-upstox/docs"},"security":[{"upstreamKey":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Optional. A Pro API key raises rate limits; no credentials are required."},"upstreamKey":{"type":"apiKey","in":"header","name":"X-Upstream-Key","description":"Your own key for the service this connector wraps (bring your own key). Used for that one call only; never stored, logged or cached."}},"schemas":{"Error":{"type":"object","properties":{"ok":{"const":false},"error":{"type":"object"}}}}},"paths":{"/v1/tools/search_instruments":{"post":{"operationId":"search_instruments","summary":"Search Upstox instruments (equities, futures, options, indices) by free text and filters to get their instrument keys, I","description":"Search Upstox instruments (equities, futures, options, indices) by free text and filters to get their instrument keys, ISIN, trading symbol and lot size. Up to 30 records per page. Use for \"Find the instrument key for Reliance Industries on NSE\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"query":{"description":"Free-text search, up to 50 characters, for example 'RELIANCE', 'RELIANCE CE 1500' or an ISIN.","maxLength":50,"title":"Query","type":"string"},"exchanges":{"anyOf":[{"maxLength":30,"type":"string"},{"type":"null"}],"default":null,"description":"Comma-separated exchanges: ALL, NSE, BSE, MCX (default ALL).","title":"Exchanges"},"segments":{"anyOf":[{"maxLength":60,"type":"string"},{"type":"null"}],"default":null,"description":"Comma-separated segments: ALL, EQ, FO, CURR, COMM, INDEX, OPT, FUT (default ALL).","title":"Segments"},"instrument_types":{"anyOf":[{"maxLength":60,"type":"string"},{"type":"null"}],"default":null,"description":"Comma-separated instrument types such as CE, PE, EQ.","title":"Instrument Types"},"expiry":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}],"default":null,"description":"Comma-separated expiry keywords or YYYY-MM-DD dates for derivatives.","title":"Expiry"},"page_number":{"anyOf":[{"maximum":1000,"minimum":1,"type":"integer"},{"type":"null"}],"default":1,"description":"Page number starting at 1.","title":"Page Number"},"records":{"anyOf":[{"maximum":30,"minimum":1,"type":"integer"},{"type":"null"}],"default":10,"description":"Records per page (1 to 30, default 10).","title":"Records"}},"required":["query"],"title":"search_instrumentsArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_ltp_quotes":{"post":{"operationId":"get_ltp_quotes","summary":"Get the last traded price, last traded quantity, day volume and previous close for up to 500 instruments. Answer is keye","description":"Get the last traded price, last traded quantity, day volume and previous close for up to 500 instruments. Answer is keyed by exchange segment and symbol. Use for \"What is the last traded price of Reliance and Infosys on NSE\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key(s), comma separated, in the form EXCHANGE_SEGMENT|ID, for example 'NSE_EQ|INE848E01016' (find keys with search_instruments).","maxLength":1500,"title":"Instrument Key","type":"string"}},"required":["instrument_key"],"title":"get_ltp_quotesArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_ohlc_quotes":{"post":{"operationId":"get_ohlc_quotes","summary":"Get previous-session and live OHLC (open, high, low, close, volume) plus last price for up to 500 instruments, for 1-day","description":"Get previous-session and live OHLC (open, high, low, close, volume) plus last price for up to 500 instruments, for 1-day, 1-minute or 30-minute bars. Use for \"Show the OHLC for Infosys today\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key(s), comma separated, in the form EXCHANGE_SEGMENT|ID, for example 'NSE_EQ|INE848E01016' (find keys with search_instruments).","maxLength":1500,"title":"Instrument Key","type":"string"},"interval":{"description":"Bar size: 1d (day), I1 (1 minute) or I30 (30 minutes).","enum":["1d","I1","I30"],"title":"Interval","type":"string"}},"required":["instrument_key","interval"],"title":"get_ohlc_quotesArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_historical_candles":{"post":{"operationId":"get_historical_candles","summary":"Get historical OHLCV candles for an instrument by unit (minutes, hours, days, weeks, months) and interval. Each candle i","description":"Get historical OHLCV candles for an instrument by unit (minutes, hours, days, weeks, months) and interval. Each candle is [timestamp, open, high, low, close, volume, open interest]. Use for \"Show daily candles for Reliance in January 2026\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key in the form EXCHANGE_SEGMENT|ID, for example 'NSE_EQ|INE848E01016'.","maxLength":60,"title":"Instrument Key","type":"string"},"unit":{"description":"Candle unit: minutes, hours, days, weeks or months.","enum":["minutes","hours","days","weeks","months"],"title":"Unit","type":"string"},"interval":{"description":"Candle size in the unit: 1 to 300 for minutes, 1 to 5 for hours, 1 for days, weeks and months.","maxLength":3,"title":"Interval","type":"string"},"to_date":{"description":"Latest day (inclusive), YYYY-MM-DD.","maxLength":10,"title":"To Date","type":"string"},"from_date":{"description":"Earliest day, YYYY-MM-DD.","maxLength":10,"title":"From Date","type":"string"}},"required":["instrument_key","unit","interval","to_date","from_date"],"title":"get_historical_candlesArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_intraday_candles":{"post":{"operationId":"get_intraday_candles","summary":"Get today's candles for an instrument by unit (minutes, hours, days) and interval. Each candle is [timestamp, open, high","description":"Get today's candles for an instrument by unit (minutes, hours, days) and interval. Each candle is [timestamp, open, high, low, close, volume, open interest]. Use for \"Show today's 5-minute candles for Infosys\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key in the form EXCHANGE_SEGMENT|ID, for example 'NSE_EQ|INE848E01016'.","maxLength":60,"title":"Instrument Key","type":"string"},"unit":{"description":"Candle unit: minutes, hours or days.","enum":["minutes","hours","days"],"title":"Unit","type":"string"},"interval":{"description":"Candle size in the unit: 1 to 300 for minutes, 1 to 5 for hours, 1 for days.","maxLength":3,"title":"Interval","type":"string"}},"required":["instrument_key","unit","interval"],"title":"get_intraday_candlesArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_market_status":{"post":{"operationId":"get_market_status","summary":"Check whether an Indian exchange (NSE, BSE, MCX and segments) is currently open. Use for \"Is the NSE open right now\".","description":"Check whether an Indian exchange (NSE, BSE, MCX and segments) is currently open. Use for \"Is the NSE open right now\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"exchange":{"description":"Exchange or segment, for example NSE, BSE, MCX, NSE_EQ or NSE_FO.","maxLength":20,"title":"Exchange","type":"string"}},"required":["exchange"],"title":"get_market_statusArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_market_holidays":{"post":{"operationId":"get_market_holidays","summary":"List market holidays of the current year (date, description, type, closed and special-timing exchanges), or those of one","description":"List market holidays of the current year (date, description, type, closed and special-timing exchanges), or those of one date. Use for \"Which days is the market closed this month\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{},"title":"get_market_holidaysArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_market_timings":{"post":{"operationId":"get_market_timings","summary":"Get the trading session start and end times of each exchange for a given date. Use for \"What are the market timings on 2","description":"Get the trading session start and end times of each exchange for a given date. Use for \"What are the market timings on 2026-10-20\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"date":{"description":"Date, YYYY-MM-DD.","maxLength":10,"title":"Date","type":"string"}},"required":["date"],"title":"get_market_timingsArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_option_chain":{"post":{"operationId":"get_option_chain","summary":"Get the put/call option chain of an underlying for one expiry: per strike the call and put instrument keys, market data ","description":"Get the put/call option chain of an underlying for one expiry: per strike the call and put instrument keys, market data and greeks, plus the put-call ratio and spot price. Use for \"Show the Nifty 50 option chain for next week's expiry\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key of the underlying, for example 'NSE_INDEX|Nifty 50'.","maxLength":60,"title":"Instrument Key","type":"string"},"expiry_date":{"description":"Expiry as YYYY-MM-DD or a keyword such as current_week, next_week, current_month, next_month.","maxLength":20,"title":"Expiry Date","type":"string"}},"required":["instrument_key","expiry_date"],"title":"get_option_chainArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_option_contracts":{"post":{"operationId":"get_option_contracts","summary":"List active option contracts of an underlying (name, trading symbol, expiry, strike, lot size, CE or PE), optionally for","description":"List active option contracts of an underlying (name, trading symbol, expiry, strike, lot size, CE or PE), optionally for one expiry. Use for \"List the option contracts for Reliance\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key of the underlying, for example 'NSE_INDEX|Nifty 50'.","maxLength":60,"title":"Instrument Key","type":"string"},"expiry_date":{"anyOf":[{"maxLength":20,"type":"string"},{"type":"null"}],"default":null,"description":"Expiry as YYYY-MM-DD or a keyword such as current_week, next_week, current_month, next_month.","title":"Expiry Date"}},"required":["instrument_key"],"title":"get_option_contractsArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_put_call_ratio":{"post":{"operationId":"get_put_call_ratio","summary":"Get the put-call ratio of an underlying for an expiry on a date, with intraday PCR and spot price points at a chosen buc","description":"Get the put-call ratio of an underlying for an expiry on a date, with intraday PCR and spot price points at a chosen bucket interval. Use for \"What was the Nifty put-call ratio on 2026-10-15 for the current month expiry\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key of the underlying, for example 'NSE_INDEX|Nifty 50'.","maxLength":60,"title":"Instrument Key","type":"string"},"expiry":{"description":"Expiry as YYYY-MM-DD or a keyword such as current_week, next_week, current_month, next_month.","maxLength":20,"title":"Expiry","type":"string"},"date":{"description":"Date, YYYY-MM-DD.","maxLength":10,"title":"Date","type":"string"},"bucket_interval":{"description":"Intraday bucket size in minutes (for example 5, 15 or 30).","maximum":375,"minimum":1,"title":"Bucket Interval","type":"integer"}},"required":["instrument_key","expiry","date","bucket_interval"],"title":"get_put_call_ratioArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_option_greeks":{"post":{"operationId":"get_option_greeks","summary":"Get implied volatility, delta, gamma, theta, vega, open interest and last price for one or more option instruments. Use ","description":"Get implied volatility, delta, gamma, theta, vega, open interest and last price for one or more option instruments. Use for \"What are the greeks of this Nifty option\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"instrument_key":{"description":"Instrument key(s), comma separated, in the form EXCHANGE_SEGMENT|ID, for example 'NSE_EQ|INE848E01016' (find keys with search_instruments).","maxLength":1500,"title":"Instrument Key","type":"string"}},"required":["instrument_key"],"title":"get_option_greeksArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}}}}