Register on platform.tuya.com, create a Cloud Project, and note the Access ID and Access Secret; add your Tuya-connected devices to the project and select the Smart Home or Industry Basic Service API products
Obtain an access token by POST to https://<endpoint>/v1.0/token?grant_type=1; the endpoint varies by region (e.g., openapi.tuyaus.com for US, openapi.tuyaeu.com for EU); sign the request with HMAC-SHA256 using the Access Secret over a string composed of Access ID, timestamp, nonce, and the request body hash
List devices associated with the user by GET /v1.0/iot-01/associated-users/devices after linking devices to the project via the Tuya app or Smart Life app; note each deviceId for subsequent commands
Retrieve device function specifications with GET /v1.0/iot-03/devices/<deviceId>/specification to get the supported Codes (e.g., switch_led, colour_data, temp_value) and their value schemas
Send a device command with POST /v1.0/iot-03/devices/<deviceId>/commands with body {"commands":[{"code":"switch_led","value":true}]}; include a fresh access token and re-sign each request with the current timestamp
Poll device status with GET /v1.0/iot-03/devices/<deviceId>/status for a snapshot, or use Tuya's Pulsar message queue service to subscribe to device event streams for real-time updates
Known gotchas
Every request must be freshly signed with the current Unix timestamp in milliseconds; requests with timestamps that differ from the server time by more than 60 seconds are rejected with a signature validation error
The Tuya API endpoint is region-specific; using the wrong regional endpoint (e.g., US endpoint for an EU-registered device) returns an authentication error that looks identical to a bad Access Secret
Access tokens expire after a configurable period (default 7200 seconds); implement automatic token refresh using the refresh_token returned with the initial token response rather than re-authenticating from scratch each time
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp