Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/anurag-roy/kiteconnect-ts/llms.txt

Use this file to discover all available pages before exploring further.

kiteconnect-ts is an unofficial TypeScript library for the Zerodha Kite Connect trading APIs. It provides a one-to-one replacement for the official kiteconnectjs library — your existing code works as-is, with the added benefit of TypeScript type safety, autocomplete, and inline documentation across every API method and response shape.

Key features

Full type safety

Every method parameter and API response is typed. TypeScript catches mistakes before you run your code.

Drop-in replacement

All classes and methods are one-to-one with kiteconnectjs. Migrate existing code with minimal changes.

HTTP + WebSocket

Two dedicated classes cover both the REST API and the real-time WebSocket tick stream.

Rich type exports

Interfaces for every response shape — SessionData, Order, Quote, Tick, and more.

The two main classes

kiteconnect-ts exports two classes that map directly to Zerodha’s two primary APIs. KiteConnect is the HTTP client for everything related to account management, orders, portfolio, market data, mutual funds, and GTT triggers. You initialize it once per api_key and use it for all REST API calls. KiteTicker is the WebSocket client for streaming real-time market tick data. It connects to Zerodha’s WebSocket endpoint and emits typed events as ticks, order updates, and connection state changes arrive.
import { KiteConnect, KiteTicker } from 'kiteconnect-ts';

// HTTP client
const kc = new KiteConnect({ api_key: 'YOUR_API_KEY' });

// WebSocket client
const ticker = new KiteTicker({
  api_key: 'YOUR_API_KEY',
  access_token: 'YOUR_ACCESS_TOKEN',
});

Requirements and limitations

kiteconnect-ts requires Node.js v14 or later. Browser environments are not supported — Zerodha enforces CORS restrictions on all Kite Connect HTTP endpoints, so you cannot call them directly from a browser. If you use a full-stack framework with SSR (Next.js, Nuxt, etc.), you can use kiteconnect-ts on the server side.
The WebSocket tick stream (KiteTicker) is technically accessible from browsers using the native WebSocket API, but parsing the binary protocol yourself is required. See Browser Support for details.

Drop-in compatibility

All class members, method names, and parameter shapes in kiteconnect-ts are identical to those in the official kiteconnectjs library. If you have existing code written against kiteconnectjs, you can switch the import and gain type safety without changing any other code.
// Before (kiteconnectjs)
const KiteConnect = require('kiteconnect').KiteConnect;

// After (kiteconnect-ts) — everything else stays the same
import { KiteConnect } from 'kiteconnect-ts';
In addition to method-level types, kiteconnect-ts exports standalone TypeScript interfaces such as SessionData, Order, UserProfile, and Tick that you can use to annotate variables where the return type cannot be inferred automatically.

Build docs developers (and LLMs) love