Register
Broker integrationUpstox API

Use the Upstox API for Algo Trading with QuantPower

Using the Upstox API for algo trading with QuantPower, your own strategy rules run on your Upstox account through Upstox's official API. You create your own API app, register QuantPower's two static IPs with Upstox and sign in each trading day on Upstox's own page, and your funds and securities stay with Upstox.

What you need
  1. 01An Upstox trading account, with F&O enabled if you trade options or futures.
  2. 02Your own Upstox API app, created in My Apps on Upstox's developer site, with its API key and secret. It must be the one active app on your account.
  3. 03The two static IPs shown on QuantPower's Brokers screen, registered as the primary and secondary IP of that app.
  4. 04Your Upstox login with two-factor authentication, once every trading day.

Since 1 April 2026, brokers accept API orders only from static IP addresses registered with them, and Upstox allows one active API app per user. This page explains what you need, how the connection works, each step of connecting, the daily sign-in, the Upstox rules for API users, what QuantPower can and cannot do on your account, three worked examples, what to do when something goes wrong, and how to keep one Upstox app working for every tool you use.

A short history of API trading at Upstox

Upstox began as RKSV, a discount broker, and grew into one of India's larger brokers by active clients as low-cost online trading spread through the 2010s. Like several discount brokers, it opened a developer API so that clients' own programs could read their accounts, stream prices and place orders. Individual traders used it from Python scripts and spreadsheets, and algo platforms connected their users through it.1

SEBI's circular of 4 February 2025 on safer participation of retail investors in algorithmic trading reshaped that world. It made the broker responsible for every algo order, required static IP addresses registered with the broker for API order placement, set a threshold of 10 orders a second above which an algo must be registered with the exchange, and asked exchanges to empanel algo providers.2 After two postponements the framework came into force for every broker from 1 April 2026.3

Upstox set out how it applies the rules in notices to API users: one active app per user, order traffic only from the registered IPs, IP changes once a calendar week, and market protection on market orders.45 QuantPower gives every client two static IPs, which fill Upstox's primary and secondary slots.

How QuantPower connects to Upstox

PartHow it works
Sign-inRedirect sign-in: you tap Sign in in QuantPower, log in on Upstox's page with your two-factor code and come back. Your Upstox password, PIN and codes never touch QuantPower
Your app keysYour Upstox API key and secret, entered once, sent over https, stored encrypted and never shown again
Order routeEvery order goes through QuantPower's one order path, with its risk checks, then to Upstox
Static IPs2 static IPs free with every QuantPower account, a primary and a backup. If the forwarding proxy is down, orders are held, never sent from another address
PricesLive prices come from your Upstox connection; with no broker connected, QuantPower shows no live prices
SessionAn Upstox session ends early the next morning, so you sign in once each trading day
MoneyYour funds, shares and positions stay with Upstox. QuantPower holds no money

Upstox takes a primary and a secondary IP.5 Any broker-specific step is shown in QuantPower's broker connection screen.

How to connect Upstox to QuantPower

  1. Create an API app. Log in to Upstox's developer site, open My Apps and create an app. Enter the redirect URL that QuantPower shows on its Upstox connect screen. Note the API key and secret. If you already have an app used by another tool, read the section on one app below first.
  2. Open Brokers in QuantPower. Choose Upstox. Enter your Upstox client ID, the API key and the API secret.
  3. Confirm with a tap. QuantPower asks for your tap, then sends the keys once over https. They are stored encrypted and never shown again.
  4. Register the static IPs. The Upstox row in QuantPower shows your two static IPs. In My Apps, enter the first as the primary IP and the second as the secondary IP, and save. Upstox allows one change a calendar week, and a change ends your current session, so you sign in again afterwards.5
  5. Sign in. Tap Sign in on the Upstox row. Upstox's login page opens. Log in with your two-factor code, approve access, and you return to QuantPower.
  6. Check the account. Your funds, holdings, positions and orders should appear as Upstox holds them.
  7. Test before going live. Run your first strategy in forward test with test money, then switch it on live with a small size.

If you are new to broker APIs, our guide to the trading API explains how order and data APIs work. QuantPower's checklist for every broker is in broker connection requirements.

One Upstox app for every tool

Upstox allows one active API app per user. When you create a new app, the older ones are removed.4 This matters if you already use another platform or your own code with Upstox:

  • If QuantPower is your only tool, create the app for QuantPower and you are done.
  • If you already have an app for your own script, you can use the same app's key and secret in QuantPower instead of creating a new one. Both tools then share the app, its static IP list and its daily session.
  • If another platform already uses your app, creating a new app for QuantPower will cut that platform off. Decide which tool uses the app before you create it.

Two tools on one account should never trade the same signal, or your positions will double.

Upstox API terms you will see

TermWhat it is
API keyThe public identifier of your Upstox app, entered once in QuantPower
API secretThe private key of your app; QuantPower stores it encrypted and never shows it again
Redirect URLThe address Upstox sends you back to after you log in, shown on QuantPower's connect screen
Authorization codeA one-time code Upstox returns after your login, exchanged for the day's session
Access tokenThe day's session; it ends early the next morning, so you sign in once each trading day
Primary and secondary IPThe two static IPs registered for your app in My Apps

Upstox API rules since April 2026

RuleWhat it means on Upstox
Your own API appOne active app per user; a new app removes the older ones
Registered static IPsOne primary and one optional secondary IP; order traffic from other addresses may be rejected
Changing the IPsOnce a calendar week, and the change ends the current session
Daily sign-inEvery API session needs a login with two-factor authentication and ends before the next trading day
Order rateAlgos that send more than 10 orders a second must be registered with the exchange through the broker
Market ordersMarket and SL-M orders get market protection by default, which limits how far from the last price they can fill

Upstox, like every broker, checks each order for price, quantity, margin and order rate before it reaches the exchange. A rejection at this stage is reported back to QuantPower with Upstox's reason, and the algo card or the order list shows it in plain words, so you can see whether the cause was margin, price bands, a closed segment or the IP check.

Every trading day

  • Before 9:15 am: tap Sign in on the Upstox row and log in on Upstox's page. The row shows "signed in" and when the session ends.
  • Algos that enter later today switch on without the sign-in, and their card says "Sign in to your broker before the entry". If the entry comes while Upstox is signed out, the entry is refused with the reason.
  • Algos that would enter now cannot be switched on live while Upstox is signed out.
  • Before each entry: check free margin. Option buyers pay the full premium upfront, and sellers need SPAN and exposure margin.
  • On expiry day: short index options expiring that day carry an extra 2% extreme loss margin under SEBI's rules of October 2024.6
  • After the close: the session ends early the next morning, and the next trading day starts with a fresh sign-in.

Nothing signs in for you: QuantPower never stores your Upstox password and never logs in on your behalf.

What QuantPower can and cannot do on your Upstox account

QuantPower canQuantPower cannot
Show your funds, holdings, positions and orders as Upstox holds themWithdraw money from your Upstox account
Place, modify and cancel orders that you or your algos sendChange your bank account, address or nominee
Run algos that enter and exit by your rules once you switch them onSee the password, PIN or code you type on Upstox's page
Square off positions when your MTM stop loss or Smart Exit is hitTrade after your session has ended
Refuse new orders once your daily loss limit is reachedSend orders from any address other than your two static IPs
Stop trading in a segment until its next session with the kill switchPlace an order from an AI app without your confirmation

These controls cover your whole QuantPower account. If you connect Upstox and another broker, the daily loss figure adds up both, and each position's exit goes to the broker that holds it.

Market data from Upstox

QuantPower's prices come from your connected broker. With Upstox, live ticks arrive over Upstox's market data feed; QuantPower turns them into 1-minute bars and reads history from Upstox's candle service when a chart or a backtest needs it. The registered static IPs are needed for orders; check Upstox's current developer pages for which other requests they cover and whether its market data carries a fee.

Order rules at Upstox

  • Stop losses in options. The NSE does not accept SL-M orders in index options, so Upstox rejects them.7 Build option strategies with limit and stop-loss limit orders, with a buffer between the trigger and the limit price.
  • Market protection. Market and SL-M orders get a protection range by default, so they cannot fill far from the last price. In a fast market, a protected market order may stay partly unfilled.
  • Multi-leg entries. A short straddle sends two orders at entry and an iron condor four. QuantPower sends the buy legs first and the sell legs only after the buys fill, so a refused hedge never leaves a sold option uncovered.
  • Order rate. QuantPower sends one order at a time per leg, well below 10 a second, and never retries a placed order on its own.
  • Freeze quantity. An order above the exchange's freeze limit is split automatically, and iceberg orders let you split a large order into 2 to 50 legs sent one at a time.

Your Upstox account inside QuantPower

  • Positions show today's positions with M2M, and you can convert a product or exit a position. Exit all asks for your tap and your second factor.
  • Holdings show your portfolio with profit and loss, and a holding can be pledged for margin.
  • Funds show margin, collateral, cash and what can be withdrawn, as Upstox reports them.
  • Orders show today's orders from every source, with a Strategy column that shows which algo placed each one.
  • On the chart, your Upstox orders, positions and GTT triggers appear as lines. Drag an order line to a new price or press "+" at a price to start a new order; each action opens the order sheet for your tap.

A worked example: a Bank Nifty iron condor on Upstox

Take a weekly iron condor on Bank Nifty: sell a call and a put two strikes out of the money, buy a call and a put four strikes out of the money, enter at 9:30 am, exit at 3:10 pm, with an overall stop-loss of ₹3,000 for the algo.

  1. Load the Iron Condor template in the algo builder. It becomes your own algo.
  2. Set the sold legs to "OTM 2" and the bought legs to "OTM 4", weekly expiry, one lot each. A Bank Nifty lot is 30 units.8
  3. Set the entry time, the exit time and an M2M stop-loss of ₹3,000.
  4. Run it in Forward test on live Upstox prices for a few weeks.
  5. Switch it on live, choosing Upstox as the broker.

At entry the algo sends the two bought legs first, then the two sold legs once the buys fill. At the exit time it buys back the sold legs first, then sells the bought ones.

What it costs: 200 tokens per 28 days for the live algo (₹200 plus GST), with orders unlimited. Eight orders a day go to Upstox, four in and four out; at ₹20 an order that would be ₹160 a day in brokerage, plus STT of 0.15% of the premium on every option sale since 1 April 2026,9 exchange charges, stamp duty and GST. Check your Upstox plan for its actual brokerage.

A worked example: a stock signal on Upstox

Take a rule on Infosys: when the RSI(14) on 15-minute candles crosses above 30 from below, buy 40 shares intraday, with a 1% stop-loss and a 1.5% target.

  1. Create a signal with the condition, checked on closed 15-minute candles.
  2. Choose One-touch, and you get a notice with the order ready to place with one touch; or arm it as Auto, and it places the order itself with every risk check.
  3. The signal can also start or stop an algo instead of placing a single order.

A signal that places its own order costs no tokens.

A worked example: a chart alert to Upstox

If your alerts come from your own scanner or script, create a webhook in QuantPower, link it to one of your algos, and have your tool call the webhook's URL. When the alert fires during market hours, the linked algo switches on for today and enters; an exit alert stops it and squares off, with the orders going to Upstox from your static IPs. With an alert on an Arth.live chart, the chart, the alert and the order sit in one place. See API vs webhook for when each route suits.

Running several strategies on one Upstox account

Upstox sees one app and one session, however many strategies you run through it. A few points keep several strategies orderly:

  • QuantPower's limits are 50 saved algos, 20 running at a time and 6 legs in a running algo.
  • Each live algo picks a broker when you switch it on. A restart, or a start by a webhook or a signal, stays at the same broker.
  • Positions add up at Upstox. Two algos on the same index make one combined position at the broker. Check the combined margin before switching both on.
  • The account controls look at the total. The daily loss limit, the optional cap on orders a day and Smart Exit apply to the whole account, across every algo and every broker.
  • Costs scale by algo, not by order. Each live algo is 200 tokens per 28 days however many orders it sends; Upstox's brokerage and the statutory charges apply to each executed order.

What the SEBI rules mean for an Upstox user

The framework draws a line between two kinds of automation.2

  • Your own program, sending fewer than 10 orders a second from a registered static IP, does not need exchange registration. It still needs the static IP, the daily sign-in and your own care over what it does.
  • A strategy offered to retail traders by a platform reaches them through a broker under the exchange's rules, registered and with its orders identified, so that the exchange and the broker can tell algo orders from manual ones.

For a trader, the practical checklist is the same either way: the registered IPs, a daily sign-in, a clear written rule for each strategy, and limits on the account. QuantPower shows every rule of every algo and keeps an activity log of each entry, exit and refusal.

A checklist before your first live algo on Upstox

  1. F&O is active on your Upstox account, and the margin for the strategy is free.
  2. Your Upstox app is the only active app, or the one shared with your other tool.
  3. QuantPower's two static IPs are saved as the primary and secondary IP in My Apps.
  4. You signed in today after any change to the IPs, and the Upstox row shows "signed in".
  5. The algo ran in Forward test for some weeks, and its activity log matches what you expected.
  6. The daily loss limit and Smart Exit are set for the account.
  7. The first live run is one lot.

Moving from your own Upstox script

Traders who already run Python against the Upstox API can move a strategy across rule by rule:

In your scriptIn QuantPower
An OAuth login routine and a stored access tokenThe daily Sign in on the Upstox row
A machine with a fixed public addressThe two static IPs that come with your account
Code that finds the strike two steps out of the moneyA rule leg set to "OTM 2", picked fresh at each entry
Polling loops for stops and targetsLeg and algo exits, trailing stops and an M2M lock
Print statements and log filesThe algo's activity log, with "Copy log" for a day
Your own emergency stopThe account kill switch, daily loss limit and Smart Exit

You can also keep both: the script for research, QuantPower for the strategies you run every day.

Building Upstox strategies with Quanty and your own AI app

Quanty, the assistant in the QuantPower app, can turn a description such as "sell an iron condor on Bank Nifty two strikes out, exit at 3 pm" into an algo for you to check, backtest it, and flag a missing stop-loss or an unhedged sold option. It saves the algo switched off; only you switch it on. If you use your own AI app through Connect AI, it can read your Upstox positions as QuantPower sees them and prepare an order, which is placed only when you confirm it with a tap and your second factor. Neither gives tips or recommends a strategy.

Costs to plan for

Three kinds of cost apply when you run algos on Upstox through QuantPower:

  • QuantPower tokens (1 token = ₹1, GST extra): a live algo costs 200 tokens per 28 days with orders unlimited, a Forward test algo 100, a backtest 2 after the first 10 free each week, and a signal that places its own order nothing. Charts, the option chain, the screener and the strategy builder are free, and so are the two static IPs.
  • Upstox's charges: brokerage on each executed order under your Upstox plan, and any fee Upstox sets for its APIs or data. Check Upstox's current pricing pages; broker charges change.
  • Statutory charges: STT, exchange transaction charges, SEBI fees, stamp duty and GST, the same at every broker. For option strategies with several legs, these and the brokerage usually cost more than the software.

Upstox and other brokers on one QuantPower account

You can connect Upstox and other brokers to the same QuantPower account. The order sheet then shows a broker picker, and nothing is ever sent to a guessed broker. Each live algo runs at the broker you chose for it. Your positions screen shows each broker's positions, and the daily loss limit, the kill switch and Smart Exit cover all of them together, so a loss at one broker counts towards the same account limit as a loss at the other.

When something goes wrong

What you seeLikely causeWhat to do
"Sign-in needed" on the Upstox rowYesterday's session has ended, or the IPs were just changedTap Sign in and log in on Upstox's page
Orders rejected for IPThe static IPs are not registered, or were entered wrongly, in My AppsCompare the IPs in the Upstox row with My Apps; remember one change a week
Another tool stopped workingA new app replaced the old oneUse one app for both tools, or choose which tool keeps it
SL-M order rejected in optionsSL-M is not allowed in index optionsUse a stop-loss limit order
Insufficient marginThe order needs more margin than is freeAdd funds, reduce the size, or pledge holdings
Segment not enabledF&O is not active on your Upstox accountActivate the segment with Upstox
Two-factor code refusedThe phone's clock is offSet the phone to automatic time

If an algo stops, its card and activity log say why in one plain line.

Security

  • Your password and codes are typed only on Upstox's page.
  • Your API secret is sent once over https, stored encrypted and never shown again.
  • Sensitive actions in QuantPower, such as exit all, the kill switch or confirming an order prepared by an AI app, ask for your second factor.
  • Your orders leave only from your two static IPs.
  • Your money never passes through QuantPower.

QuantPower is trading software. It is not a stockbroker or a SEBI-registered investment adviser or research analyst, and it gives no tips, calls or buy and sell advice. The strategies it runs are your own rules, fully visible to you. Ready-made templates, such as straddles and iron condors, load into the strategy builder, and once loaded they are your own strategy.

Where API trading at Upstox is going

The 2026 framework has made broker APIs safer and more formal: registered IPs, one app per user, daily sign-ins and exchange registration above 10 orders a second. For a retail trader the effect is that running a strategy alone now means managing an IP, a session and a broker app; platforms that handle those parts in one place take that work off the trader. What stays with you is the strategy itself and the decision to switch it on.

Frequently asked questions

Does QuantPower see my Upstox password?

No. You type your login details and two-factor code on Upstox's own page and return to QuantPower. QuantPower keeps your API key and secret encrypted and uses the day's session that Upstox issues after your login.

Which static IPs do I register with Upstox?

The two shown on the Upstox row of QuantPower's Brokers screen, as the primary and secondary IP of your app in My Apps. Any broker-specific step is shown in QuantPower's broker connection screen.

Can I have more than one Upstox API app?

No. Upstox allows one active API app per user. Creating a new app removes the older ones, so plan which tool uses it.

Why was my stop-loss order rejected on Upstox?

SL-M orders are not allowed in index options on the NSE. Use a stop-loss limit order with a buffer between the trigger and the limit price.

What happens to my session when I change the static IPs?

Upstox ends the current session when the IPs change. Sign in again from the Upstox row. You can change the IPs once a calendar week.

Can I use QuantPower and my own Upstox script together?

Yes, with the same app, as long as the two never trade the same signal.

References

  1. Upstox, developer API documentation (upstox.com)
  2. SEBI, circular on safer participation of retail investors in algorithmic trading, 4 February 2025 (sebi.gov.in)
  3. SEBI, glide-path circular, 30 September 2025, and NSE implementation standards for retail algo trading, 5 May 2025, and operational modalities, 22 July 2025 (nseindia.com)
  4. Upstox community: new SEBI and exchange mandates for API trading from 1 April 2026 (community.upstox.com)
  5. Upstox developer announcements: static IP APIs, primary and secondary IP, one change a calendar week (upstox.com)
  6. SEBI, circular on measures to strengthen the equity index derivatives framework, 1 October 2024 (sebi.gov.in)
  7. NSE, circular on the discontinuation of stop-loss market orders in index options, 2021 (nseindia.com)
  8. NSE, revision of market lot sizes of index derivatives, effective from the contracts after December 2025 (nseindia.com)
  9. Union Budget 2026-27: STT on the sale of options raised from 0.10% to 0.15% of the premium from 1 April 2026 (incometaxindia.gov.in)
Broker names are trademarks of their owners. Charges and broker rules change, so check Upstox's current pages before you trade. This page is for information and is not investment advice. Trading involves substantial risk.