Guide
BrokerMarket dataStocksOptionsFutures API key

Angel One SmartAPI API guide

SmartAPI is free and can log in without a browser, which makes Angel One popular for fully automated Indian strategies.

Last verified · Also known as SmartAPI, Angel Broking API, Angel One API

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"]))
A 6-digit TOTP from the base32 secret, standard library only.

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. 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. 2

    Export the Python project

    Every project exports strategy.py, market_data.py, brokers.py and live.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format.

  3. 3

    Plug in Angel One SmartAPI

    Implement the four adapter methods (account, positions, submit_market_order and 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

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.

Build a strategy