Upstox API Integration
Upstox API v2 engineering for owned infrastructure.
I build Upstox API integrations with OAuth2 login, rate-aware order gateways, and streaming suitable for multi-client desks.
Platform capabilities
- Multi-broker integration
- TradingView automation
- Client management
- Cloud infrastructure
Integrates with Upstox
Broker overview

Upstox API integration connects your software to Upstox API v2 using OAuth2 authorization codes exchanged for access tokens on your backend. Orders, portfolios, and market data routes differ from other Indian brokers—adapters must honor Upstox throttles, sandbox versus production hosts, and token expiry in daily operations.
Last reviewed: 2026-11-24. Limits and endpoints change—verify against the broker's official developer documentation before go-live.
Sandbox vs production
Upstox OAuth2 and API keys
Upstox developers register an app to obtain client id/secret. Users authorize via OAuth2 redirect; your server exchanges the code at the token endpoint and stores refresh tokens securely.
Sandbox base URLs differ from production—CI pipelines should run contract tests against sandbox while staging uses production keys only on controlled accounts.
Redirect URI whitelisting is strict; coordinate exact HTTPS paths before mobile or desktop clients ship.
Multi-client platforms isolate OAuth state per login attempt to prevent CSRF and cross-tenant token mixups.
Persist `state` and `nonce` pairs in Redis with TTL so horizontal login pods cannot accept callbacks meant for another tenant’s browser tab.
Mobile deep links back into your app must match the exact redirect URI registered at Upstox—coordinate iOS Universal Links and Android App Links before go-live.
When traders revoke app access from the Upstox portal, your OMS should detect 401 on refresh and block new orders until they re-authorize—silent failure is unacceptable for compliance.
Planning numbers
Upstox rate limits
Plan for conservative **5–10 REST calls per second** per active token unless Upstox grants elevated limits in writing for your app id.
Order placement and margin endpoints are the hottest paths—queue writes and coalesce status polls after submit.
Market quote endpoints punish scrape-style behavior; subscribe via WebSocket when displaying watchlists above ~50 symbols.
Use ETag or If-Modified-Since patterns only where documented—do not invent caching that leaves positions stale.
Portfolio endpoints that return nested `holdings` and `positions` arrays should be parsed once per UI refresh—not refetched per table column sort in server components.
During results season, quote APIs slow first—plan degraded mode copy in the UI rather than blank screens when Upstox latency spikes.
Subscriptions
Upstox market data socket
Upstox exposes WebSocket feeds after session auth. Instrument keys follow Upstox symbology—mirror their master file nightly.
Cap concurrent symbols per session; shard watchlists across service accounts only if permitted by Upstox ToS.
Implement idle ping handling; cloud NAT timeouts kill long-lived sockets without application-level keepalives.
Reconcile last traded price from REST if socket silence exceeds configured thresholds.
Shard large watchlists: subscriptions beyond a few hundred symbols may require prioritizing liquid names and polling the tail via REST.
Binary tick decoding bugs show up only under load—run soak tests during a live UAT week, not solely against canned fixtures.
OMS mapping
Segments supported
Equity, derivatives, and currency segments depend on user entitlements. Product types include intraday and delivery variants with Upstox-specific enums.
Options strategies may require multi-leg validation against margin APIs before any leg fires.
MTF and pledge holdings affect sellable quantity—surface holding breakdown in UI before submit.
GTT and SIP features may be out of scope for v1—document exclusions in the statement of work.
`instrument_key` strings embed exchange and ISIN—never let traders type them; always pick from searchable symbol master to avoid silent routing errors.
Carry-forward positions need product type changes at rollovers—schedule internal jobs that warn operators before F&O series switches, not after margin reject floods.
Watch for these
Upstox quirks in production
OAuth refresh failures spike after password resets—trigger client re-login flows with audit logs.
API version bumps deprecate fields without loud errors—pin OpenAPI snapshots in your repo and diff monthly.
Partial outages during high-volume IPO windows affect order ack latency—display broker status banners.
Upstox maintenance notifications arrive on developer portals—subscribe RSS and pause algos proactively.
Sandbox order IDs that work in CI may not mirror production enums—tag environment in logs so support does not compare apples to oranges.
Rate limit headers, when present, should feed adaptive pacing in the adapter instead of static sleep constants copied from another broker.
Redacted illustration
Example payload shape
POST /v2/order/place
{
"quantity": 1,
"product": "I",
"validity": "DAY",
"price": 0,
"tag": "oms-***REDACTED***",
"instrument_token": "NSE_EQ|INE848E01016",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": false
}Upstox-only scope
Timeline and cost
OAuth2 login, orders, portfolio, instruments, and socket feeds typically need **7–10 weeks**.
A first adapter should be planned around authentication, order lifecycle, positions, instruments, streaming, and the OMS framework already in place.
OAuth UX polish (mobile web, error pages, re-login) can add **2–4 weeks** when your product is client-facing rather than operator-only.
Include budget for legal review of Upstox developer ToS before you white-label login to end clients.
Practical steps
How we deliver Upstox integration
Discovery confirms sandbox coverage gaps and which order types you need day one versus phase two.
Delivery includes typed clients generated from Upstox OpenAPI, plus runbooks for OAuth rotation.
Staging environments use production keys only on segregated accounts with low notional caps—never test market orders against client live books.
I wire Datadog or OpenTelemetry spans across OAuth callback, token store, order submit, and socket reconnect so you can see where latency concentrates.
Documentation covers Upstox-specific error JSON shapes mapped to your internal `BrokerRejectReason` enum—support teams stop pasting raw vendor blobs into tickets.
Go-live checklists include OAuth redirect tests on iOS Safari, Android Chrome, and desktop Firefox—the three browsers that dominate Indian retail login traffic.
Regression suites replay recorded OAuth callbacks so CI catches redirect URI typos before traders see login loops in production.
Related Modules & Services
8 modules to explore alongside your platform build.
- 01Capabilities
India broker API integrations
Explore this capability and how it can be engineered for your business.
India broker API integrations - 02Capabilities
Broker API Integration
Explore this capability and how it can be engineered for your business.
Broker API Integration - 03Integrations
Multi Broker Algo Trading Platform
Unified multi-broker connectivity and routing for your operations.
Multi Broker Algo Trading Platform - 04Capabilities
Choosing Broker APIs
Explore this capability and how it can be engineered for your business.
Choosing Broker APIs - 05Capabilities
Broker API Guide
Explore this capability and how it can be engineered for your business.
Broker API Guide - 06Capabilities
Broker API Integration
Explore this capability and how it can be engineered for your business.
Broker API Integration - 07Capabilities
Zerodha API Integration
Explore this capability and how it can be engineered for your business.
Zerodha API Integration - 08Capabilities
Order Management Systems
Explore this capability and how it can be engineered for your business.
Order Management Systems
Frequently Asked Questions
5 questions covered before you launch.
Yes for individual trader tokens. Your platform orchestrates redirects and secure storage on the server side.
Yes—multi-broker gateways normalize intents while keeping broker-specific adapters isolated.
Your business holds broker accounts and regulatory obligations; I deliver the technical integration layer.
Token lifetimes follow Upstox documentation and can change—adapters read `expires_in` from token responses instead of hard-coding hours.
Refresh failures during overnight batches should alert operators before the 9:15 queue drains unauthenticated.
Sandboxes rarely mirror production throttles exactly—load tests still belong on controlled production accounts with tiny size.
I instrument both environments so you can compare p95 latency before promoting builds.

Ready to scope KC Algo?
KC Algo is a branded software and implementation path for operators who need multi-broker, multi-client trading software—with clear ownership boundaries and no implied brokerage authorization. Operating workflows and deployment responsibilities are shaped around the desk. A technical discussion can clarify platform fit, integrations, and deployment responsibilities for Indian and Forex desks.
Services
- Algo Trading Platforms
- Multi-Broker Integration
- TradingView Automation
- Risk Management Systems
- OMS & RMS Development
- Client Management Portals
Ready to review a platform demo?
Book a walkthrough when you already know your market context, broker connectivity needs, and compliance ownership.
Let's review KC Algo for your desk — software partnership with clear compliance boundaries.
Broker names and logos appear on this page for identification only. Kennedy Chokkalingam integrates with broker APIs as custom engineering work and is not affiliated with, sponsored by, or endorsed by any broker listed here. All trademarks belong to their owners.