Angel One SmartAPI
Log in with PIN and TOTP, read funds and holdings, pull quotes and candles, and place orders and GTT rules on Angel One.
Finance & bankingGuided#trading#stock-broking#india#market-data#orders#totp
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
SmartAPI is Angel One's free trading API. It lets you log in with your client code, PIN and TOTP, read your profile, funds, holdings and positions, look up instruments, pull live quotes, historical candles, option Greeks and put/call ratios, calculate margins and charges, place, modify and cancel orders and GTT rules, and stream prices and order updates over WebSockets. This guided collection walks through those calls in order.
> Orders here are real. SmartAPI has no sandbox. Anything in folders 3 and 4 that places, modifies or triggers an order acts on your real account. Orders sent after market hours become AMOs and wait for the next session, so test with a LIMIT price far from the market and quantity 1, outside market hours, and cancel straight away.
Get credentials
- You need an Angel One trading account. Enable TOTP for it on the Enable TOTP page and keep the base32 secret (or scan the QR into an authenticator app).
- Sign up on the SmartAPI portal and create an app under My APIs (Trading APIs). Copy the API key into
apiKey. - Fill
clientCode(your Angel One client ID) andpin(your trading PIN). - For TOTP either paste the base32 secret into
totpSecret(the login request then computes the code for you) or type the current 6-digit code intototpjust before logging in. - Fill
clientPublicIp,clientLocalIpandmacAddress. If your API key is a static-IP key, order and GTT write calls are accepted only from the registered public IP.
Authentication
Send Log in first. It returns jwtToken, refreshToken and feedToken, saved automatically. Every other call sends Authorization: Bearer <jwtToken> (set on the collection) plus these headers, already on every request: X-PrivateKey (API key), X-UserType: USER, X-SourceID: WEB, X-ClientLocalIP, X-ClientPublicIP, X-MACAddress, Content-Type and Accept: application/json. Renew an expired JWT with Renew tokens and log out at the end of the day.
Base URLs
- API:
https://apiconnect.angelone.in(production; there is no separate test host) - Scrip master (public):
https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json - Market data WebSocket:
wss://smartapisocket.angelone.in/smart-stream; order updates:wss://tns.angelone.in/smart-order-update
Run order
Folder 1 (log in, profile, funds) → folder 2 (find the symbolToken, quotes, candles) → folder 3 (margin and charges, then place, check, modify and cancel) → folder 4 (GTT create, read, modify, cancel) → folder 5 (portfolio) → folder 6 (log out).
Limits
Limits are per client code and per endpoint: login and most book/portfolio reads allow about 1 request per second, quotes and margin about 10, orders about 9 per second with per-minute and per-hour caps, candles about 2 per second. Exceeding them returns 403 Access denied because of exceeding access rate. Quotes take up to 50 tokens per call. Current table: Rate limits. SmartAPI itself, including historical data, is free.
Common errors
Responses carry status, message, errorcode and data; check status and errorcode even on HTTP 200.
| Code / status | Meaning | What to do |
|---|---|---|
| AB1007 | Login ID or PIN invalid | Check clientCode and pin |
| TOTP message on login | Code expired or wrong secret | Recompute or retype the code |
| AG8001 / AB8050 | Token invalid or expired | Renew tokens or log in again |
| 403 rate limit | Too many requests | Slow down to the documented rate |
Order rejected (in order book text) | Margin, price band or surveillance | Read the text; add funds, change price or send scripconsent |
Links
Endpoints 27
1. Start here: login and account
- POSTLog in with client code, PIN and TOTP
/rest/auth/angelbroking/user/v1/loginByPasswordCreates a session. Body: clientcode (your Angel One client ID), password (your trading PIN, not the web password), totp (6-digit code) and optional state,… - POSTRenew tokens with the refresh token
/rest/auth/angelbroking/jwt/v1/generateTokensIssues a fresh jwtToken and feedToken from the refreshToken saved at login, without asking for the PIN and TOTP again. Use it when calls start failing with an… - GETGet the user profile
/rest/secure/angelbroking/user/v1/getProfileReturns the client code, name, email, mobile, the enabled exchanges (NSE, BSE, NFO, MCX...) and products (DELIVERY, INTRADAY, MARGIN...), last login time and… - GETGet funds and margins (RMS limits)
/rest/secure/angelbroking/user/v1/getRMSReturns the risk limits: net (what you can trade with), availablecash, intraday pay-in, collateral, realised and unrealised M2M and the utilised SPAN,…
2. Market data
- GETDownload the scrip master (public)
https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.jsonDownloads the full instrument list as one large JSON array; no login or headers needed. Each entry has token (the symboltoken), symbol (trading symbol, e.g.… - POSTSearch a scrip
/rest/secure/angelbroking/order/v1/searchScripLooks up trading symbols and tokens for one search term on one exchange, for example every SBIN instrument on NSE. Only one scrip per request and about 1… - POSTGet a full market quote
/rest/secure/angelbroking/market/v1/quote/Live quote for up to 50 tokens per call across exchanges. mode is LTP, OHLC or FULL; FULL adds last trade quantity and times, net/percent change, average… - POSTGet last traded prices for several instruments
/rest/secure/angelbroking/market/v1/quote/Same quote endpoint in LTP mode: just the last price per token, the cheapest way to watch a list. Mix exchanges in one call (here SBIN and the Nifty 50 index… - POSTGet historical candles
/rest/secure/angelbroking/historical/v1/getCandleDataOHLCV candles for one instrument. interval: ONE_MINUTE, THREE_MINUTE, FIVE_MINUTE, TEN_MINUTE, FIFTEEN_MINUTE, THIRTY_MINUTE, ONE_HOUR or ONE_DAY. fromdate… - POSTGet option Greeks
/rest/secure/angelbroking/marketData/v1/optionGreekReturns delta, gamma, theta, vega and implied volatility for each strike of an underlying for one expiry. name is the underlying (a stock like TCS or an… - GETGet put/call ratio
/rest/secure/angelbroking/marketData/v1/putCallRatioReturns the put/call ratio per trading symbol for NSE F&O underlyings, a quick sentiment indicator. No body needed. Like the gainers/losers and OI build-up…
3. Orders (real trades)
- POSTCalculate margin for a basket (no trade)
/rest/secure/angelbroking/margin/v1/batchReturns the margin needed for up to a basket of positions, accounting for hedges between legs. Each position has exchange, qty, price, productType, orderType… - POSTEstimate brokerage and charges
/rest/secure/angelbroking/brokerage/v1/estimateChargesCalculates brokerage, taxes and exchange charges for one or more hypothetical orders before you place them. Each order has product_type, transaction_type,… - POSTPlace an order
/rest/secure/angelbroking/order/v1/placeOrderPlaces an order and returns orderid (saved into orderId) and uniqueorderid (saved into uniqueOrderId, used for the order status call). This places a real… - POSTModify an order
/rest/secure/angelbroking/order/v1/modifyOrderChanges an open order: send variety, orderid (from orderId), ordertype, producttype, duration, price, quantity and the instrument (tradingsymbol, symboltoken,… - POSTCancel an order
/rest/secure/angelbroking/order/v1/cancelOrderCancels an open or pending order by variety and orderid. Run it right after the test placement so the order never fills. Completed orders cannot be cancelled;… - GETGet the order book
/rest/secure/angelbroking/order/v1/getOrderBookLists today's orders with variety, order and product type, price, quantity, filled and unfilled shares, average price, status/orderstatus (open, complete,… - GETGet one order's status
/rest/secure/angelbroking/order/v1/details/{{uniqueOrderId}}Returns the current state of a single order using the uniqueorderid from place, modify or cancel (saved in uniqueOrderId), in the path. Faster and cheaper… - GETGet the trade book
/rest/secure/angelbroking/order/v1/getTradeBookLists today's executions: fill price, fill size, trade value, fill ID and time per order. Empty until something fills. Use it to reconcile partial fills.
4. GTT rules
- POSTCreate a GTT rule
/rest/secure/angelbroking/gtt/v1/createRuleCreates a rule that places an order when the price reaches triggerprice. Fields: tradingsymbol, symboltoken, exchange, transactiontype, producttype, price… - POSTGet GTT rule details
/rest/secure/angelbroking/gtt/v1/ruleDetailsReturns one rule by id: status (NEW, ACTIVE, SENTTOEXCHANGE, CANCELLED...), created, updated and expiry dates, instrument, prices and quantity. Check it after… - POSTList GTT rules
/rest/secure/angelbroking/gtt/v1/ruleListPages through your rules filtered by a status array (NEW, CANCELLED, ACTIVE, SENTTOEXCHANGE, FORALL) with page (from 1) and count. The status must be a list… - POSTModify a GTT rule
/rest/secure/angelbroking/gtt/v1/modifyRuleChanges the price, quantity, trigger price or disclosed quantity of an active rule identified by id, symboltoken and exchange. Returns the rule ID. Fails if… - POSTCancel a GTT rule
/rest/secure/angelbroking/gtt/v1/cancelRuleCancels an active rule so it can no longer trigger, identified by id, symboltoken and exchange. Run it to clean up after testing.
5. Portfolio
- GETGet all holdings with totals
/rest/secure/angelbroking/portfolio/v1/getAllHoldingReturns each holding (symbol, ISIN, quantity, T1 quantity, average price, LTP, close, P&L and P&L percent) plus a totalholding summary with total value,… - GETGet positions
/rest/secure/angelbroking/order/v1/getPositionLists open and today's positions with buy/sell quantities and amounts, carried-forward figures, average prices, net quantity and net value. Exit a position by…
6. End the session
- POSTLog out
/rest/secure/angelbroking/user/v1/logoutEnds the session for clientcode and invalidates the JWT. Log in again (PIN plus a fresh TOTP) before the next call. Returns status: true with empty data.
API details
- Base URL
https://apiconnect.angelone.in- Authentication
- A bearer token in the Authorization header
An API key in the X-PrivateKey header - Operations
- 27 operations on 27 pathsPOST 18GET 9
- Main resources
- 1. Start here: login and account 42. Market data 73. Orders (real trades) 84. GTT rules 55. Portfolio 26. End the session 1
- Description format
- Swastik Codes guided collection, API version
checked against the docs on 2026-11-18 - Links
- Documentation
How to test the Angel One SmartAPI in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the Angel One SmartAPI collection, without the publisher's secrets.
- Add your credentialsThis API uses A bearer token in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “Log in with client code, PIN and TOTP” (POST /rest/auth/angelbroking/user/v1/loginByPassword), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the Angel One SmartAPI?
Log in with PIN and TOTP, read funds and holdings, pull quotes and candles, and place orders and GTT rules on Angel One. It is listed under Finance & banking and has 27 endpoints.
Who publishes the Angel One SmartAPI?
It is listed from Angel One's public API description (an OpenAPI document), not published by Angel One on Swastik Codes. Anyone who controls smartapi.angelbroking.com can claim the profile by adding a DNS TXT record.
What is the base URL of the Angel One SmartAPI?
Requests go to https://apiconnect.angelone.in. Endpoint paths are added to this base URL.
How do I authenticate with the Angel One SmartAPI?
It accepts 2 methods: A bearer token in the Authorization header; an API key in the X-PrivateKey header.
How many endpoints does the Angel One SmartAPI have?
27 operations on 27 paths (18 POST, 9 GET). The largest groups are 1. Start here: login and account, 2. Market data, 3. Orders (real trades), 4. GTT rules.
Is forking the Angel One SmartAPI free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.