Get user profile

from auth.session import get_authenticated_kite

kite = get_authenticated_kite()
profile = kite.profile()
print(profile)

Typical response:

{
  "user_id": "AB1234",
  "user_name": "Vikas ...",
  "email": "you@example.com",
  "broker": "ZERODHA",
  "exchanges": ["NSE", "BSE", "NFO", "CDS", "MCX", "BFO"],
  "products": ["CNC", "MIS", "NRML"],
  "order_types": ["MARKET", "LIMIT", "SL", "SL-M"],
}

Two fields matter beyond identity display:

  • exchanges — segments actually enabled on your account. If NFO isn't listed, F&O orders (chapters 48+) will be rejected regardless of what your code sends — go back to chapter 3's activation step.
  • products and order_types — the set your account can use. Some brokers/account types restrict these (e.g. no SL-M on certain segments).

Use this as a startup sanity check

def assert_segment_enabled(kite, segment: str):
    profile = kite.profile()
    if segment not in profile["exchanges"]:
        raise RuntimeError(
            f"{segment} not enabled on this account — activate it before running this strategy."
        )

Call this at the top of any strategy that trades derivatives, so a misconfigured account fails at startup with a clear message instead of generating confusing order rejections mid-run.

Next: 012 — Get equity funds/margins