⚡ Quick Answer — Bottom Line Up Front

Best overall free API: Angel One SmartAPI (₹0/month, 5-year data, sandbox, automated login). Best for options traders: Dhan DhanHQ (free Greeks via API, basket orders, SPAN margin calculator). Best for data scientists: Upstox API (2-year 1-min history, highest rate limits, clean OpenAPI spec). Most mature ecosystem: Zerodha Kite Connect (largest community, most third-party tools, paid at ₹4,720/month). Best budget F&O API: Fyers API (free, excellent options chain, solid Python SDK).

Options Algo Guide Trading index options via API? Master Open Interest, PCR, and Max Pain first.
Read Option Chain Masterclass →

1. Why API Choice Matters for Algo Traders

Choosing the wrong broker API can silently kill your algo trading strategy. Common failure modes include:

The right API choice depends on your strategy type, capital size, Python skill level, and deployment environment. This guide helps you navigate that decision.

2. Master Comparison Table: All 6 Broker APIs

✅ = Yes / Free   ❌ = No / Not Available   ₹ = Paid   All prices in INR
Feature Angel One Dhan Upstox Zerodha Fyers 5paisa
Monthly API Cost₹0 ✅₹0 ✅₹0 ✅₹4,720 🟠₹0 ✅₹0 ✅
Historical Data (free)5yr daily / 30d 1-min10yr daily / 30d 1-min10yr daily / 2yr 1-min 🏆Paid only5yr daily / 100d 1-min5yr daily / 30d 1-min
WebSocket Instruments1,0001,0001,0003,000 🏆200500
REST Rate Limit (req/sec)25~1525 ✅101010
Automated TOTP Login✅ Yes✅ Yes✅ Yes❌ Browser✅ Yes✅ Yes
Sandbox / Paper Trade✅ Yes✅ Yes❌❌❌❌
Options Greeks API❌✅ Yes 🏆✅ WebSocket❌✅ Yes❌
Basket Orders❌✅ Yes❌❌❌❌
Official Python SDK✅✅✅✅✅✅
Community SizeMediumGrowingLargeLargest 🏆MediumSmall
F&O MarketsNSE, BSENSE, BSE ✅NSE, BSENSE, BSE, BFO 🏆NSENSE
MCX Commodities✅✅✅✅✅❌

3. 🏆 #1 Angel One SmartAPI — Best Overall Free API

🏆 RANK #1 — BEST OVERALL

Angel One SmartAPI

Best for: Beginners, small-capital traders, data scientists, headless deployment
Monthly Cost
₹0 FREE
1-min History
30 days
Daily History
5 years
WS Instruments
1,000
REST Rate Limit
25 req/sec
Auto Login
✅ TOTP
PROS
  • Zero API fees — saves ₹56,640/year vs Zerodha
  • 5-year free daily OHLCV for long-term backtests
  • Official sandbox for paper trading
  • Fully automated TOTP login (headless-friendly)
  • 25 req/sec — highest REST rate limit in the class
  • NSE, BSE, NFO, MCX, CDS all supported
CONS
  • Only 30 days of 1-minute intraday history
  • WebSocket limited to 1,000 instruments (vs Zerodha's 3,000)
  • No options Greeks in REST API (compute client-side)
  • Smaller developer community vs Zerodha

4. 🏈 #2 Dhan DhanHQ API — Best for Options Traders

🏈 RANK #2 — BEST FOR OPTIONS

Dhan DhanHQ API

Best for: Options traders, F&O strategies, multi-leg basket orders, Greeks-based algos
Monthly Cost
₹0 FREE
1-min History
30 days
Daily History
10 years
WS Instruments
1,000
REST Rate Limit
~15 req/sec
Options Greeks
✅ Live
PROS
  • Live Delta, Gamma, Theta, Vega via options chain API
  • Basket order support for multi-leg strategies
  • SPAN + Exposure margin calculator API
  • 10-year daily data — best in the class for long backtests
  • Forever-free paper trading account
  • Binary WebSocket (Protobuf) for low latency
CONS
  • Lower REST rate limit (~15 req/sec)
  • Only 30-day 1-minute intraday history
  • Smaller community vs Zerodha and Upstox
  • API launched 2022 — less mature track record

5. 🏈 #3 Upstox API — Best Historical Data

🏈 RANK #3 — BEST DATA

Upstox API

Best for: Equity algo traders, data scientists, systematic backtesting, quantitative research
Monthly Cost
₹0 FREE
1-min History
2 YEARS 🏆
Daily History
10 years
WS Instruments
1,000
REST Rate Limit
25 req/sec 🏆
OpenAPI Spec
✅ v3.0
PROS
  • 2-year 1-minute OHLCV history — best free data depth
  • 25 req/sec REST limit — highest in class
  • Clean OpenAPI 3.0 spec with auto-generated clients
  • Large developer community with good Stack Overflow presence
  • Options Greeks via WebSocket SnapQuote mode
CONS
  • 250 orders/day limit (standard accounts)
  • No official sandbox for paper trading
  • No multi-leg basket orders
  • WebSocket instrument limit same as others (1,000)

6. #4 Zerodha Kite Connect — Most Mature Ecosystem

#4 — MOST MATURE

Zerodha Kite Connect

Best for: Production-grade systems, teams needing maximum SDK stability and third-party tool integration
Monthly Cost
₹4,720/month
1-min History (paid)
60 days
Daily History
5.5 years
WS Instruments
3,000 🏆
REST Rate Limit
10 req/sec
Community
Largest 🏆
PROS
  • Largest developer community in India (TradingQ&A)
  • 3,000 WebSocket instrument subscriptions
  • Battle-tested 10+ year track record
  • Rich third-party integrations (Streak, Opstra)
  • Binary WebSocket protocol for high throughput
CONS
  • ₹4,720/month API fees (₹56,640/year)
  • No automated login — browser-based OAuth required
  • No official paper trading sandbox
  • Historical data requires separate paid plan

7. #5 Fyers API — Best Budget F&O API

#5 — BUDGET F&O PICK

Fyers API

Best for: NSE-focused F&O traders wanting free APIs with good options chain support
Monthly Cost
₹0 FREE
1-min History
100 days
Daily History
5 years
WS Instruments
200
Options Greeks
✅ Available
Auto Login
✅ TOTP
PROS
  • Free with options Greeks (Delta, Gamma, Theta, Vega)
  • 100 days of 1-minute history — longer than Angel One/Dhan
  • Automated TOTP login supported
  • Good WebSocket data quality
CONS
  • Only 200 WebSocket instrument subscriptions (lowest)
  • NSE-only for F&O (no BSE F&O)
  • Smaller community and SDK update cadence
  • No paper trading sandbox

8. #6 5paisa Open API

#6 — HONORABLE MENTION

5paisa Open API

Best for: 5paisa existing customers exploring automation on a limited budget
Monthly Cost
₹0 FREE
1-min History
30 days
WS Instruments
500
MCX Support
❌ No
PROS
  • Free API access
  • Reasonable WebSocket capacity (500 instruments)
  • Automated login supported
CONS
  • No MCX commodity support
  • Smallest developer community
  • Fewer SDK features vs top-tier alternatives
  • Less frequent API updates

9. Recommendation by Use Case

Use CaseRecommended APIReason
Complete beginner to algo tradingAngel One SmartAPIFree, sandbox, automated login, easiest setup
NIFTY/BANKNIFTY options strategiesDhan DhanHQLive Greeks, basket orders, SPAN margin API
Equity intraday strategies (backtesting)Upstox API2-year 1-min data, highest rate limits
Production multi-strategy system (>₹10L AUM)Zerodha Kite Connect3,000 WS instruments, largest ecosystem
Headless server auto-deploymentAngel One SmartAPINative TOTP login without browser dependency
F&O traders on tight budgetFyers APIFree, options Greeks, 100-day 1-min history
Delta-neutral options hedgingDhan DhanHQLive Greeks + SPAN margin calculator
Long-term systematic equity investingUpstox API10-year daily data, clean API design

10. Quick Start: Install All Python SDKs

Terminal / PowerShell
# Install all major Indian broker Python SDKs
pip install kiteconnect          # Zerodha Kite Connect
pip install smartapi-python      # Angel One SmartAPI
pip install dhanhq               # Dhan DhanHQ
pip install upstox-python-sdk    # Upstox API
pip install fyers-apiv3          # Fyers API v3
pip install py5paisa             # 5paisa Open API

# Essential supporting libraries
pip install pyotp pandas numpy   # TOTP login, data processing

Universal Order Placer — Broker-Agnostic Pattern

Python — Universal Broker Interface
"""Broker-agnostic order placement pattern for Indian algo trading."""
from abc import ABC, abstractmethod
from dataclasses import dataclass
from enum import Enum

class Exchange(Enum):
    NSE = "NSE"
    BSE = "BSE"
    NFO = "NFO"
    MCX = "MCX"

class OrderType(Enum):
    MARKET = "MARKET"
    LIMIT  = "LIMIT"
    SL     = "SL"

class ProductType(Enum):
    INTRADAY = "INTRADAY"
    DELIVERY = "DELIVERY"
    FUTURES  = "FUTURES"

@dataclass
class Order:
    symbol:       str
    exchange:     Exchange
    transaction:  str          # "BUY" or "SELL"
    quantity:     int
    order_type:   OrderType
    product:      ProductType
    price:        float = 0.0

class BrokerAPI(ABC):
    @abstractmethod
    def place_order(self, order: Order) -> str:
        """Return order ID on success."""
        ...

    @abstractmethod
    def get_ltp(self, exchange: Exchange, symbol: str) -> float:
        """Return last traded price."""
        ...

# Each broker implements this interface:
class AngelOneBroker(BrokerAPI):
    def __init__(self, api_key, client_code, pin, totp_secret):
        import pyotp
        from SmartApi import SmartConnect
        self.obj = SmartConnect(api_key=api_key)
        totp = pyotp.TOTP(totp_secret).now()
        self.obj.generateSession(client_code, pin, totp)

    def place_order(self, order: Order) -> str:
        response = self.obj.placeOrder({
            "variety": "NORMAL",
            "tradingsymbol": order.symbol,
            "transactiontype": order.transaction,
            "exchange": order.exchange.value,
            "ordertype": order.order_type.value,
            "producttype": order.product.value,
            "duration": "DAY",
            "price": str(order.price),
            "quantity": str(order.quantity),
            "squareoff": "0", "stoploss": "0",
            "symboltoken": "LOOKUP_TOKEN_HERE"  # from instrument list
        })
        return response

    def get_ltp(self, exchange: Exchange, symbol: str) -> float:
        resp = self.obj.ltpData(exchange.value, symbol, "TOKEN")
        return float(resp["data"]["ltp"])

Related Algo Trading Guides & Comparisons

Frequently Asked Questions

Which is the best free algo trading API in India for 2026?

Angel One SmartAPI is the best overall free algo trading API in India for 2026. It offers zero subscription fees, 5-year historical daily data, an official sandbox, fully automated TOTP login, and a 25 req/sec REST rate limit. Dhan DhanHQ is the best choice specifically for options traders needing live Greeks.

Which Indian broker API is best for Python beginners?

Angel One SmartAPI is best for beginners: zero fees, official sandbox for paper trading, fully automated login with pyotp (no browser needed), and a clean SDK with ready-to-run Python examples in the official documentation.

Do I need SEBI approval to run algo trading strategies in India?

No. Individual retail traders running algorithms on their own personal accounts via registered broker APIs do not need SEBI approval. SEBI's regulations primarily target brokers offering algorithmic execution to clients and third-party strategy providers selling algos to the public.

Which Indian broker API provides the most historical data?

Upstox API provides the deepest free 1-minute intraday history at 2 years (730 days), far exceeding Angel One (30 days), Dhan (30 days), and Fyers (100 days). For daily data, Dhan offers 10+ years. Zerodha's historical data requires a paid subscription.

How can I automate daily broker API login without a browser?

Angel One SmartAPI, Dhan DhanHQ, Upstox, and Fyers all support automated TOTP-based login. Install pyotp via pip, get your broker's TOTP base32 secret from the 2FA setup page, and use pyotp.TOTP(secret).now() to generate the current OTP programmatically — no browser required. Zerodha is the only major broker that still requires a browser-based OAuth redirect.

Can I use multiple broker APIs in the same trading system?

Yes. Many sophisticated retail traders maintain accounts with 2–3 brokers and route different strategies through each — for example, using Angel One for data collection (free historical API), Dhan for options execution (basket orders), and Zerodha as a backup. The broker-agnostic interface pattern shown in this article facilitates this architecture.