Guide
BrokerMarket dataStocksETFsOptionsFutures API key

Upstox API guide

Upstox offers its trading and market-data API free of charge, which makes it a common first choice for Indian algo traders.

Last verified · Also known as Upstox API, Upstox Developer API, Upstox API v2

Quick answer

Upstox’s Developer API is a free REST and WebSocket API for Indian equities, F&O, currency and commodities: orders, portfolio, market quotes, historical candles and a market-data feed. Authentication is OAuth2 with an access token that is valid until 3:30 AM the next day, so you log in daily.

Upstox API at a glance

Pricing
Free API
Availability
Indian residents with an Upstox account
Paper trading
Sandbox app mode for order APIs
Integration type
OAuth login
In AlgoGP
Design and backtest in AlgoGP, connect the exported code
Auth
OAuth2 authorization code; token valid until ~3:30 AM IST
Price
Free
SDK
Python upstox-python-sdk, Node, Java
Data
Quotes, candles, Protobuf market-data feed

Historical candles

Candles are keyed by instrument key (e.g. NSE_EQ|INE002A01018 for Reliance), not by trading symbol. Download the instruments file once a day to map symbols to keys, then call the historical-candle endpoint with an interval and date range.

Build an Upstox strategy with AlgoGP

AlgoGP does not connect to Upstox natively yet. Upstox authenticates with a browser OAuth login and refreshable tokens, so it needs a one-time manual login step that generated code cannot do on its own.

  1. 1

    Design and backtest in AlgoGP

    Describe the strategy to the copilot and backtest it on years of normalized history. The result does not depend on any vendor.

  2. 2

    Export the Python project

    Every project exports strategy.py, market_data.py, brokers.py and live.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format.

  3. 3

    Plug in Upstox

    Implement the four adapter methods (account, positions, submit_market_order and a candle fetcher) with Upstox’s SDK, or keep a built-in platform for paper trading and add Upstox when you go live.

Built-in brokers for the same markets: Alpaca, Tradier, Interactive Brokers, OKX.

Upstox API: frequently asked questions

Is the Upstox API free?

Yes, for Upstox customers.

How long is an Upstox access token valid?

Until about 3:30 AM IST the next day, regardless of when it was generated.

Design and backtest your Upstox strategy first

AlgoGP turns an idea into Python and tests it on years of history before you connect it to Upstox. The exported code keeps the broker behind four small adapter methods.

  • AI copilot writes and revises the rules
  • Backtests with realistic costs
  • Exported Python ready to wire to Upstox

Free plan, no card required.

Upstox alternatives

Independent guide. AlgoGP is not affiliated with Upstox. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.

Build a strategy