Quick answer
Angel One’s SmartAPI is a free REST and WebSocket API for NSE, BSE, MCX and NCDEX. A program logs in with its API key, client code, PIN and a current TOTP code, receives a JWT and feed token, and then places orders, reads positions and streams quotes. Because the TOTP can be generated from a stored secret, SmartAPI can run unattended.
Angel One SmartAPI API at a glance
- Pricing
- Free API
- Availability
- Indian residents with an Angel One account
- Paper trading
- No sandbox
- Integration type
- REST + API key
- In AlgoGP
- Design and backtest in AlgoGP, connect the exported code
- Login
- API key + client code + PIN + TOTP
- Tokens
- JWT for REST, feed token for WebSocket
- Price
- Free
- SDK
- Python
smartapi-python
TOTP without a phone
import base64, hashlib, hmac, os, struct, time
def totp(secret: str) -> str:
key = base64.b32decode(secret.upper() + "=" * (-len(secret) % 8))
digest = hmac.new(key, struct.pack(">Q", int(time.time()) // 30), hashlib.sha1).digest()
offset = digest[-1] & 15
return f"{(struct.unpack('>I', digest[offset:offset + 4])[0] & 0x7FFFFFFF) % 1_000_000:06d}"
print(totp(os.environ["ANGEL_TOTP_SECRET"]))Build an Angel One SmartAPI strategy with AlgoGP
AlgoGP does not connect to Angel One SmartAPI natively yet. Angel One SmartAPI uses plain HTTPS with an API key, so it is a good candidate for a native adapter; it is not built in yet.
- 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
Export the Python project
Every project exports
strategy.py,market_data.py,brokers.pyandlive.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format. - 3
Plug in Angel One SmartAPI
Implement the four adapter methods (
account,positions,submit_market_orderand a candle fetcher) with Angel One SmartAPI’s SDK, or keep a built-in platform for paper trading and add Angel One SmartAPI when you go live.
Built-in brokers for the same markets: Alpaca, Tradier, Interactive Brokers, OKX.
Angel One SmartAPI API: frequently asked questions
Is SmartAPI free?
Yes, including historical data and the WebSocket feed.
Where do I get the TOTP secret?
Enable external TOTP in Angel One; the QR code’s base32 secret is what you store.
Design and backtest your Angel One SmartAPI strategy first
AlgoGP turns an idea into Python and tests it on years of history before you connect it to Angel One SmartAPI. 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 Angel One SmartAPI
Free plan, no card required.
Angel One SmartAPI alternatives
- Zerodha Kite Connect API GuideIndia’s largest broker: Kite Connect REST and WebSocket APIs for NSE, BSE and MCX, with an access token minted by a daily login.
- Upstox API GuideUpstox Developer API: free REST and WebSocket trading and market data for Indian equities and F&O, with daily OAuth tokens.
- Dhan (DhanHQ) API GuideDhanHQ API v2: free order APIs for Indian equities, F&O and commodities with a client id and access token; market data paid.
- FYERS API GuideFYERS API v3: free trading, quotes and history for Indian markets, with an app id, secret and a daily OAuth access token.
Independent guide. AlgoGP is not affiliated with Angel One SmartAPI. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.