Static IP for the Upstox API
Since 1 April 2026, Upstox rejects order requests that don't come from the static IP registered on your developer app. You need one fixed public IP that only you use, added under My Apps, with your order calls sent through it. Upstox accepts IPv4 and IPv6. One catch: the Python SDK drops a proxy username and password written into the proxy URL, so the setup below sends them as a header.
What Upstox checks
From Upstox's developer announcement on the algo trading circular:
- Order endpoints only. Place, modify and cancel order, multi order, GTT orders and exit all positions need the registered IP. Holdings, positions, funds and historical candles don't.
- Two addresses. One primary and one secondary static IP.
- One change a week. You can change them once per calendar week, in My Apps or through Upstox's static IP API.
- Tokens reset on change. A successful IP change invalidates your existing access tokens, so log in again afterwards.
- IPv4 and IPv6. Both notations are accepted.
- One customer per IP. A registered IP can't be registered by any other customer.
IPv4 or IPv6 for Upstox
IPv6 works. Upstox accepts IPv6 addresses, and its API host api.upstox.com has an IPv6 address, so a dedicated IPv6 at ₹50 a month is enough for orders. The market data feed URL is handed to you at runtime and isn't IP checked, so you can keep the feed on your normal connection.
How to register your IP with Upstox
- Get your fixed IP's proxy details: host, port, username and password.
- Check the exact exit address:
curl -x http://USER:PASS@HOST:PORT https://ifconfig.co - In the Upstox developer portal, open your app under My Apps and add the address as your static IP.
- Generate a fresh access token, because the change invalidated the old one.
Send Upstox orders through the fixed IP
The official upstox-python-sdk uses urllib3, not requests, so the HTTPS_PROXY environment variable alone won't route it. You set config.proxy. In our testing (SDK 2.30.0, urllib3 2.6), a username and password inside that URL are not sent to the proxy, so an authenticated proxy answers 407. Put only host and port in the URL and add the login as a proxy header:
import urllib3
import upstox_client
config = upstox_client.Configuration()
config.access_token = "YOUR_ACCESS_TOKEN"
config.proxy = "http://HOST:PORT" # host and port only
client = upstox_client.ApiClient(config)
# send the proxy login as a header, before the first request
client.rest_client.pool_manager.proxy_headers.update(
urllib3.make_headers(proxy_basic_auth="USER:PASS")
)
order_api = upstox_client.OrderApi(client)
Use the same client for every API class (UserApi, OrderApi and so on). A second ApiClient created without the proxy goes direct and its orders get rejected. The full Upstox proxy guide on GitHub covers reading the proxy from an environment variable, a sample order and a verification script.
Common Upstox errors
- 407 or "Tunnel connection failed". The proxy didn't get your login. Check that the
proxy_headersline runs before any API call. - Orders rejected, profile works. Read calls aren't IP checked, so the order path is leaving from another IP. Check that every API object shares the proxied client.
- Token errors right after changing the IP. Expected. Log in again.
- Environment variables set but traffic still goes direct. The SDK doesn't read
HTTPS_PROXY. Useconfig.proxy.
For a step-by-step check of IP errors, see how to fix "IP not whitelisted" errors.
Upstox static IP: FAQs
Does Upstox accept IPv6 for API orders?
Yes. Upstox's announcement says both IPv4 and IPv6 notation are accepted, and its API host is reachable over IPv6. Register the exact address your orders leave from.
Why do I get 407 with the Upstox Python SDK?
The SDK builds a urllib3 proxy manager, and urllib3 doesn't send a username and password written into the proxy URL. Set config.proxy to host and port only, and add the login with urllib3.make_headers(proxy_basic_auth=...) on the client's pool manager before the first request.
How often can I change my Upstox static IP?
Once per calendar week. Each change invalidates your access tokens, so plan to log in again after it.
Which TrueIP plan should I take for Upstox?
A dedicated IPv6 at ₹50 a month plus GST. Take IPv4 at ₹200 a month only if you also need one address for an IPv4-only broker.
Sources
- Upstox developer announcement: algo trading circular
- Upstox API overview
- upstox-python SDK
- urllib3 docs: proxies
Get your dedicated static IP
IPv6 ₹50 a month, IPv4 ₹200 a month, plus GST. Live in minutes, whitelisted once.