tapo-c210/secret-apis/README.md

28 lines
1.7 KiB
Markdown
Raw Normal View History

2023-08-27 22:40:32 +02:00
# Secret APIs
2023-09-18 08:44:48 +02:00
Tapo cameras provide undocumented APIs we can use to control them (simulating the use of their official app).
2023-09-18 08:45:52 +02:00
You can download my [Insomnia](https://insomnia.rest/) API collection [at this link](https://github.com/xfarrow/tapo-camera/blob/main/secret-apis/TapoCameraAPIs.yaml). The collection is not complete yet.
2023-08-27 22:40:32 +02:00
2023-09-18 08:44:48 +02:00
I am writing this collection also by giving a look at the code of the awesome project [pytapo](https://github.com/JurajNyiri/pytapo).
2023-08-27 22:40:32 +02:00
2023-09-17 22:56:30 +02:00
## Getting a Stok
2023-09-18 16:33:59 +02:00
Each API call is in the form `https://{camera_ip}/stok={stok}/ds`, hence you need your camera's IP and a token, called stok. You can obtain the stok by calling `GetStok`. Keep in mind that this token expires every `x` minutes (I did not test the actual expiration time yet).
2023-08-27 22:40:32 +02:00
## Error codes
2023-09-17 22:56:30 +02:00
```
2023-09-18 08:44:48 +02:00
-40401: Invalid stok value
-40210: Function not supported
-64303: Action cannot be done while camera is in patrol mode.
-64324: Privacy mode is ON, not able to execute
-64302: Preset ID not found
-64321: Preset ID was deleted so no longer exists
-40106: Parameter to get/do does not exist
-40105: Method does not exist
-40101: Parameter to set does not exist
-40209: Invalid login credentials
-64304: Maximum Pan/Tilt range reached
-71103: User ID is not authorized
2023-08-27 22:40:32 +02:00
```
2023-09-18 11:53:04 +02:00
## More
The APIs provide more pieces of information than the official app. For example the camera somehow geotagged itself (I never gave the permission to the app to use location services, probably the camera is using public IP's location to determine its position). This is not clearly shown to the end user, and carries privacy and security implications. This further proves the necessity to create libre solutions for these cameras.