Base path: /api/zerodha Source: src/routes/zerodha.route.ts

Auth & session

OAuth flow

  1. Client opens GET /api/zerodha/login.
  2. If no valid token, server redirects to Kite login page.
  3. Kite redirects to GET /api/zerodha/callback?request_token=....
  4. Server calls generateAccessToken, persists token to Zerodha collection, runs handlePostZerodhaLogin, and returns an HTML success page.

Orders

Place order body (validated)

Account

Market data

/login, /callback, /webhook, and /start-market-data are unauthenticated. Protect these endpoints at the network or reverse-proxy level in production.