API Access Issue – “Account Not Found” While Using HS300 with Kasa Cloud API

I am using several HS300 Kasa Smart Power Strips, and I am able to successfully control them through the Kasa mobile app and log in to the TP-Link cloud portal at https://www.tplinkcloud.com.
However, I am attempting to programmatically access the devices using the Kasa Cloud API (via https://wap.tplinkcloud.com
) with my email and password. The login request consistently returns an "account not found" error, even though the credentials are valid and working through the app and website.
- Copy Link
- Subscribe
- Bookmark
- Report Inappropriate Content
Kasa device can only be controlled through the mobile Kasa app, there is no web interface or PC software for device management.
- Copy Link
- Report Inappropriate Content
@Wayne-TP Since Home Assistant (https://www.home-assistant.io/integrations/tplink/) which you support relies on it, you could recommend python-kasa (https://github.com/python-kasa/python-kasa) as software for device management. Another option is to use Home Assistant itself but it seems too big if user only wants to control a few devices.
- Copy Link
- Report Inappropriate Content
@Wayne-TP We know that this is unofficial, but it has been working for years by sending the appropriate commands to the api accessible through wap.tplinkcloud.com. This API usage is documented in different places in Internet (forum not allowing me to attach links to examples).
But it has stopped working since a few days ago, as if now the api does not accept the tp-link cloud accounts anymore to provide tokens nor interact with devices.
If this unofficial access to API has been finally phased out and will not work anymore, please at least let us know so we don't lose more time debugging it.
Since the two factor authentication was implemented, I suspect there have been changes on how the kasa application interacts with the cloud, but the old way with only user and password was still working. If anyone knows about a workaround to keep this working it would be greatly welcome.
- Copy Link
- Report Inappropriate Content
@jmonfar Current technology has perhaps really been phased out as KLAP protocol mentioned at https://community.tp-link.com/en/home/forum/topic/657510 is being introduced. Wonder if implementation done by python-kasa (https://github.com/python-kasa/python-kasa/blob/master/kasa/transports/klaptransport.py) is the reason that it continues working...
- Copy Link
- Report Inappropriate Content
@PRIY Just by sheer luck have found the issue: on the payload to get the token we also provide the AppType parameter, which according most unofficial API doc should be sent as 'Kasa_Android'.
As I was sure the cloudUserName and cloudPassword parameters were correct, I have wondered if the issue could be with the other parameters, appType or terminalUUID. As it looked very unlikely the terminalUUID could have relation with the error message, have thought on trying playing with the appType.
At the first try, have changed "Kasa_Android" with "Kasa", and surprise!!! It works again.
So it seems that the appType "Kasa_Android" is not supported anymore, being replaced by the more generic "Kasa".
My bet is that "Kasa" has been working for a long time, with the Android app using it since a long time ago, but we have not noticed until "Kasa_Android" has been finally phased out. This was the value used by the Android app when all those documenting the API by reverse engineering did their unvaluable work. But since then TP-Link must have changed the app to use the OS agnostic "Kasa", still accepting "Kasa_Android" to keep old app versions working... up to last week, when someone decided that there was no need to keep retrocompatibility anymore.
- Copy Link
- Report Inappropriate Content
@jmonfar Thank You!!! Been banging my head for hours testing with Postman and attempting to figure out why cloud API to https://wap.tplinkcloud.com authentication was failing.
{
"error_code": -20600,
"msg": "Account not found"
}
Changing "appType":"Kasa_Android", to "appType":"Kasa",
corrected the problem:
{
"error_code": 0,
"result": {
"accountId": "65640553",
"regTime": "2021-03-20 02:14:42",
"countryCode": "US",
"email": "myemail@gmail.com",
"token": "943752e8-AT6R83345OMatj6ZOJ20m"
}
}
(actual output values have been changed to protect my innocence.....)
- Copy Link
- Report Inappropriate Content
@SolidOrange93
THANK YOU!
YES, this is the correct fix
- Copy Link
- Report Inappropriate Content
- Copy Link
- Report Inappropriate Content

Information
Helpful: 0
Views: 786
Replies: 8
Voters 0
No one has voted for it yet.