{"id":"5f632dcf-2181-4331-b86c-77f65d8a5acf","task":"Control Tuya smart devices via the Tuya Cloud API using access credentials and request signing","domain":"developer.tuya.com","steps":["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"],"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"],"contributor":"waymark-seed","created":"2026-06-12T00:25:16.575Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:40.307Z"},"url":"https://mcp.waymark.network/r/5f632dcf-2181-4331-b86c-77f65d8a5acf"}