Invalid api_key while opening Kite Connect login URL – Python kiteconnect 5.2.2

raazshri
Environment

Kite Connect API: v3
Python: 3.12.10
Python client: kiteconnect 5.2.2
OS: Windows
App type: Kite Connect + Historical Chart data
App status: Active
Subscription valid until: 19 Oct 2026

Steps to reproduce

Created an active Kite Connect app.
Configured the redirect URL as:
http://127.0.0.1:8000/api/kite/callback
Stored the API key in .env.
Verified that the API key in .env matches the API key displayed in the developer console.
Initialized the Python client:
from kiteconnect import KiteConnect

kite = KiteConnect(api_key=api_key)
print(kite.login_url())
The login URL is generated successfully.
Opening the generated URL in the browser returns:
{
"status": "error",
"message": "Invalid `api_key`.",
"data": null,
"error_type": "InputException"
}

I have also paused and reactivated the app, but the same error persists.

The API key has been checked for leading/trailing whitespace and matches the key shown in the developer console.

Could you please check whether there is an issue with the API key/app configuration on the Kite Connect side?
Sign In or Register to comment.