Kite API Authentication Issue - Missing API Key Error

anandtiwari25
anandtiwari25 edited February 10 in Kite Publisher
Hello,
I recently subscribed to Zerodha Kite API and created a new app. However, when I try to authenticate my API key and generate a session, I get the following error:

{
"status": "error",
"message": "Missing or empty field `api_key`",
"data": null,
"error_type": "InputException"
}

### My API Details:
- **Zerodha Client ID:** JC1404
- **API App Name:** Bank Nifty Auto Trader
- **API Key:**

### Steps I Have Already Tried:
✅ Checked and correctly passed the API Key in my Python script.
✅ Reinstalled the `kiteconnect` library.
✅ Created a new API app and used the new API Key.
✅ Tested on both **Google Cloud & Laptop**, but still getting the same error.
✅ Verified that the API Key is active and has no extra spaces.

**Can someone help me resolve this issue? Is there anything wrong with my API activation or authentication setup?**
Thanks in advance!
  • Vivek
    Vivek edited February 10
    This can only happen when you haven't initialised Kite connect with api_key. Can you try running only this bit?

    ```
    from kiteconnect import KiteConnect
    kite = KiteConnect(api_key="xxxxx")
    data = kite.generate_session("request_token_here", api_secret="your_secret")
    print(data)
    ```
  • Vivek
    ^ for the same script with your api_key but with placeholder request token and secret I get "kiteconnect.exceptions.TokenException: Token is invalid or has expired." which is the right error response for invalid secret or request token.
  • sujith
    @anandtiwari25,
    Everything is looks fine, except don't use kite.zerodha.com domain as redirect url. That also results in throwing error as Token is invalid or has expired.
Sign In or Register to comment.