Zerodha

Zerodha Kite Connect v3

Log in, read funds and holdings, pull quotes and candles, and place, modify and cancel orders and GTTs on Zerodha.

Finance & bankingGuided#trading#stock-broking#india#nse#market-data#orders

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

Kite Connect is Zerodha's trading API: a set of REST-style HTTP endpoints for placing and managing orders (regular, after-market, iceberg, cover and GTT), reading funds, holdings and positions, downloading the instrument master, pulling quotes and historical candles, and streaming ticks over a WebSocket. This guided collection walks through login, market data, orders, GTTs and the portfolio in the order you would build them.

> Orders here are real. Kite Connect has no sandbox or paper-trading mode. Every order request in folders 3 and 4 can buy or sell real securities with real money. Test with an AMO placed outside market hours and cancel it, use a LIMIT price far from the market, and keep quantity at 1.

Get credentials

  1. You need an active Zerodha trading account with TOTP two-factor login enabled.
  2. Sign up on the Kite Connect developer portal and create an app. Choose the free Personal plan (orders, GTTs, portfolio, margins; no market data) or the paid Connect plan (adds live quotes, WebSocket and historical candles). Plans and prices: Zerodha support.
  3. Set the app's redirect URL (any HTTPS URL you control; for testing, a page where you can read the query string is enough).
  4. Copy the API key and API secret into apiKey and apiSecret. Never ship the secret in a browser or mobile app: the token exchange must happen on a server.

Authentication

  1. Open https://kite.zerodha.com/connect/login?v=3&api_key=YOUR_KEY in a browser and log in.
  2. Kite redirects to your redirect URL with request_token. Paste it into requestToken.
  3. Send Generate a session. Its pre-request script computes checksum = SHA-256 of api_key + request_token + api_secret; the response's access_token is saved into accessToken.
  4. Every other call sends X-Kite-Version: 3 and Authorization: token api_key:access_token (set once on the collection).

The access token expires at 6 AM IST the next day (a regulatory rule) or when the user logs out; then repeat the login.

Base URLs

  • API: https://api.kite.trade (same for every user; there is no separate test host)
  • Login: https://kite.zerodha.com/connect/login
  • WebSocket ticks: wss://ws.kite.trade

POST and PUT bodies are form-encoded (application/x-www-form-urlencoded), except the margin calculator, which takes JSON. Responses are JSON with status and data, except the instrument CSV.

Run order

Folder 1 (login, profile, margins) → folder 2 (instruments, quotes, candles; set instrumentToken from the CSV) → folder 3 (margin check, place an AMO, read it, modify, cancel) → folder 4 (GTT create, read, modify, delete) → folder 5 (portfolio) → folder 6 (logout). Order and GTT IDs are saved automatically.

Limits

Quotes about 1 request per second, historical candles about 3 per second, orders and other endpoints about 10 per second; orders are also capped per minute and per day, and an order can be modified at most 25 times. See Exceptions and errors for the current figures.

Common errors

HTTP / error_typeMeaningWhat to do
403 TokenExceptionAccess token expired, logged out, or request token reusedLog in again and regenerate the session
400 InputExceptionMissing or bad parameterCheck field names and values
400 MarginExceptionNot enough fundsRun the margin calculator, add funds or reduce quantity
400 HoldingExceptionSelling more than you holdCheck holdings
428Depository authorisation needed to sell holdingsComplete the CDSL authorisation flow
429Rate limitSlow down and retry
502 NetworkExceptionBroker OMS unreachableRetry later

Links

Endpoints 29

1. Start here: login and session

  • GETOpen the login page (browser step)https://kite.zerodha.com/connect/loginThis is the URL you open in a browser, not something to send from here. Copy the URL (with your apiKey filled in), open it, sign in with your Zerodha client…
  • POSTGenerate a session (exchange request_token)https://api.kite.trade/session/tokenExchanges the one-time request_token for an access_token. The pre-request script computes checksum = SHA-256 hex of apiKey + requestToken + apiSecret, so you…
  • GETGet the user profilehttps://api.kite.trade/user/profileReturns the logged-in user's ID, name, email, broker and the exchanges, products and order types enabled on the account. Use it to check the session works and…
  • GETGet funds and margins (all segments)https://api.kite.trade/user/marginsReturns cash and margin figures for the equity and commodity segments. net is what you can trade with now; available breaks down cash, opening balance,…
  • GETGet margins for one segmenthttps://api.kite.trade/user/margins/equitySame as the previous request but for a single segment. Set the last path part to equity or commodity. The response is the segment object directly (enabled,…

2. Market data: instruments, quotes, candles

  • GETDownload the instrument list (all exchanges)https://api.kite.trade/instrumentsReturns a gzipped CSV (not JSON) of every tradable instrument: instrument_token, exchange_token, tradingsymbol, name, last_price, expiry, strike, tick_size,…
  • GETDownload the instrument list for one exchangehttps://api.kite.trade/instruments/NSEThe same CSV filtered to one exchange: change the last path part to NSE, BSE, NFO, BFO, CDS, BCD or MCX. Smaller and faster than the full dump when you only…
  • GETGet a full market quotehttps://api.kite.trade/quoteFull snapshot for up to 500 instruments: last price, volume, average price, OHLC, net change, circuit limits, open interest for F&O and five levels of bid/ask…
  • GETGet OHLC quoteshttps://api.kite.trade/quote/ohlcReturns the last price and the day's open, high, low and previous close for up to 1000 instruments at once. Lighter than the full quote; good for watchlists.…
  • GETGet last traded prices (LTP)https://api.kite.trade/quote/ltpThe lightest quote call: just instrument_token and last_price for up to 1000 instruments. Use it to pick a sensible LIMIT price before placing an order, or…
  • GETGet historical candleshttps://api.kite.trade/instruments/historical/{{instrumentToken}}/dayReturns OHLCV candles for one instrument, identified by its numeric instrument_token (from the instrument list) in the path, followed by the interval: minute,…

3. Orders (real trades)

  • POSTCalculate margins for an order (no trade)https://api.kite.trade/margins/ordersSafe dry run: posts a JSON array of orders and returns the margin each would block (SPAN, exposure, option premium, VAR, total) and the expected charges,…
  • POSTPlace an after-market order (AMO)https://api.kite.trade/orders/amoPlaces an AMO: the order is stored now and sent to the exchange when the next session opens, so you can cancel it before then. The order_id is saved into…
  • POSTPlace a regular orderhttps://api.kite.trade/orders/regularPlaces a regular order during market hours (09:15 to 15:30 IST for NSE equity). Same fields as the AMO. For MARKET and SL-M orders send market_protection (a…
  • PUTModify a pending orderhttps://api.kite.trade/orders/amo/{{orderId}}Changes an open or pending order: send only what changes among order_type, quantity, price, trigger_price, disclosed_quantity and validity. The variety in the…
  • DELETECancel a pending orderhttps://api.kite.trade/orders/amo/{{orderId}}Cancels an open or pending order. As with modify, the path variety must match the order (amo or regular). Run this after the AMO test so nothing reaches the…
  • GETList today's ordershttps://api.kite.trade/ordersReturns the day's order book: every order placed today, open or done, with status (OPEN, COMPLETE, CANCELLED, REJECTED, TRIGGER PENDING, AMO REQ RECEIVED and…
  • GETGet an order's historyhttps://api.kite.trade/orders/{{orderId}}Returns every state change of one order (identified by orderId) in time order, from PUT ORDER REQ RECEIVED through validation and exchange acknowledgement to…
  • GETList today's tradeshttps://api.kite.trade/tradesReturns all executions (fills) of the day across orders: trade_id, order_id, exchange, tradingsymbol, quantity, average_price and fill timestamps. One order…
  • GETList an order's tradeshttps://api.kite.trade/orders/{{orderId}}/tradesReturns only the fills generated by one order (orderId). Use it to compute the exact fill price and quantity of a partially filled order. An empty list means…

4. GTT (good till triggered)

  • POSTCreate a single-leg GTThttps://api.kite.trade/gtt/triggersCreates a GTT that places one LIMIT order when the last price reaches the trigger. type is single (one trigger value) or two-leg (OCO: two trigger values and…
  • GETList GTTshttps://api.kite.trade/gtt/triggersReturns active GTTs plus those that changed state in the last 7 days, each with id, type, status (active, triggered, disabled, expired, cancelled, rejected,…
  • GETGet a GTThttps://api.kite.trade/gtt/triggers/{{gttId}}Fetches one GTT by gttId with its condition, orders and status. Zerodha recommends fetching the trigger first and editing those values when you modify it, so…
  • PUTModify a GTThttps://api.kite.trade/gtt/triggers/{{gttId}}Replaces an active GTT's type, condition and orders. Send the full set again, not only the changed field; update last_price to the current price too. Returns…
  • DELETEDelete a GTThttps://api.kite.trade/gtt/triggers/{{gttId}}Deletes an active GTT so it can no longer trigger. Run it to clean up after testing. Returns the deleted trigger_id. A GTT that already triggered placed its…

5. Portfolio

  • GETGet holdingshttps://api.kite.trade/portfolio/holdingsLists long-term equity holdings: tradingsymbol, exchange, ISIN, quantity, t1_quantity (bought but not yet delivered), average_price, last_price, close_price,…
  • GETGet positionshttps://api.kite.trade/portfolio/positionsReturns two lists: net (your actual open positions, including carried-forward F&O) and day (today's buy/sell activity, useful for intraday P&L). Each entry…
  • PUTConvert a position's producthttps://api.kite.trade/portfolio/positionsChanges the margin product of an open position, for example MIS (intraday) to CNC or NRML to carry it overnight, or the reverse. Fields: tradingsymbol,…

6. End the session

  • DELETELog out (invalidate the access token)https://api.kite.trade/session/tokenDestroys the API session so the access_token stops working; the user must log in again for a new one. It does not log the user out of the Kite web or mobile…

API details

Base URL
https://api.kite.trade
Authentication
An API key in the Authorization header
Operations
29 operations on 29 pathsGET 18POST 5PUT 3DELETE 3
Main resources
1. Start here: login and session 52. Market data: instruments, quotes, candles 63. Orders (real trades) 94. GTT (good till triggered) 55. Portfolio 36. End the session 1
Description format
Swastik Codes guided collection, API version checked against the docs on 2026-11-18

How to test the Zerodha Kite Connect v3 in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Zerodha Kite Connect v3 collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Open the login page (browser step)” (GET https://kite.zerodha.com/connect/login), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Zerodha Kite Connect v3?

Log in, read funds and holdings, pull quotes and candles, and place, modify and cancel orders and GTTs on Zerodha. It is listed under Finance & banking and has 29 endpoints.

Who publishes the Zerodha Kite Connect v3?

It is listed from Zerodha's public API description (an OpenAPI document), not published by Zerodha on Swastik Codes. Anyone who controls kite.trade can claim the profile by adding a DNS TXT record.

What is the base URL of the Zerodha Kite Connect v3?

Requests go to https://api.kite.trade. Endpoint paths are added to this base URL.

How do I authenticate with the Zerodha Kite Connect v3?

With an API key in the Authorization header.

How many endpoints does the Zerodha Kite Connect v3 have?

29 operations on 29 paths (18 GET, 5 POST, 3 PUT, 3 DELETE). The largest groups are 1. Start here: login and session, 2. Market data: instruments, quotes, candles, 3. Orders (real trades), 4. GTT (good till triggered).

Is forking the Zerodha Kite Connect v3 free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.