Integration Guide

Last Updated on : 2022-04-07 10:01:44download

This topic describes the request structure, authentication method, request signatures, and other technical knowledge involved in the use of Tuya commercial lighting APIs to speed up your API calls.

In fact, you can call the commercial lighting APIs in the same way as you call other open APIs of Tuya. You only need to contact your account manager and subscribe to the commercial lighting SaaS services.


Things to note

  • Subscribe to API services: Make sure that you have subscribed to the required API services before you make API requests.
  • Subscribe to SaaS services: Make sure that you have contacted your account manager and subscribed to the required commercial lighting SaaS services before you make API requests.
  • Certain APIs require the HTTP client to support the GET method that carries the body parameter. Therefore, you must select a suitable HTTP request framework.

Download resources

Download Postman script

Download Java SDK

SDK update log
Edition Update time Update content
1.2.1 April 7, 2022 ProductProperty adds a field dpId.
1.2.0 November 27, 2021 Updated some domain definitions.
1.1.2 November 24, 2021 Fixed the issue of the wrong DeviceApi#getDetail access modifier.
1.1.1 November 18, 2021 Fixed the issue of wrong AlarmListItem attribute type.
1.1 November 5, 2021 Updated the signature algorithm.
1.0 October 10, 2021 Added existing APIs.

Guide of SDK for Java

The SDK based on Apache HttpClient

The SDK is suitable for Java developers who use Apache HttpClient and do not want to introduce additional dependencies. To implement the SDK, Apache HttpClient is used as the HTTP request client, and FastJson is used to handle serialization and deserialization. The latest updated OpenAPI will be provided as soon as possible.

(Recommended) If you use Apache Maven to manage your Java projects, just add the dependencies to the pom.xml file of your project.



If you do not download the .jar package from the Maven repository, you need to create a lib folder in the project root directory, put the downloaded lighting-open-api-java-sdk-{version}.jar in the lib folder, and then add the following dependencies to pom.xml. Otherwise, a NoClassDefFoundError exception will be reported.


The procedure is as follows.

public class Main {
    public static void main(String[]args){
        TuyaOpenApiConfiguration tuyaOpenApiConfiguration = new TuyaOpenApiConfiguration();
        ProjectApi projectApi = new ProjectApi();
        TokenApi tokenApi = new TokenApi();
        BaseResponse<TokenResult> accessToken = tokenApi.getAccessToken(1);
        BaseResponse<PageResult<ProjectListItem>> response =, 10, null);

All the APIs are shown as follows.

APIs: TokenApi, AccountApi, ProjectApi, ConstructionTaskApi, DeviceApi, AlarmApi, GroupApi, SceneApi, LinkageApi, TemplateApi, and EnergyStaticApi.