Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Welcome to Tencent Cloud Software Development Kit (SDK) 3.0, a companion tool for the TencentCloud API 3.0 platform. Currently supported products include CVM, VPC, and CBS. All Tencent Cloud services and products will be connected to it in the future. The new SDK version is unified and features the same SDK usage, API call methods, error codes, and returned packet formats for different languages. Tencent Cloud SDK for Java helps Java developers debug and use TencentCloud APIs with ease. This document describes Tencent Cloud SDK for Java and how to quickly use it with code examples provided.

Dependent Environment

  1. Dependent environment: JDK 7 or higher.
  2. Activate your product in the Tencent Cloud Console.
  3. Get the SecretID, SecretKey, and endpoint. The general format of endpoint is \* For example, the endpoint of CVM is For more information, please see the documentation of the specified product.


Before installing Tencent Cloud SDK for Java and using TencentCloud API, apply for security credentials in the Tencent Cloud Console. Security credential consists of SecretID and SecretKey. SecretID is for identifying the API requester. SecretKey is a key used for signature string encryption and authentication by the server. Please keep your SecretKey private and do not disclose it to others.

Installing via Maven (recommended)

Installing through Maven is the recommended way to use the SDK for Java. Maven is a dependency manager for Java that supports the dependencies your project requires and installs them into your project. For more information, please visit Maven's official website.

  1. Go to Maven's official website to download the corresponding Maven installation package for your system and install it.
  2. Add Maven dependencies to your project by adding the following dependencies in Maven's pom.xml. Please note that the version number here is just an example, and you can find the latest version in the Maven repository. Currently, the latest version is :
    <!-- go to and get the latest version. -->
    <!-- Please query the latest version at -->
  1. For importing methods, please see the example.

Installing via source package

  1. Go to the Github code hosting page to download the source code package.
  2. Decompress the source package to an appropriate location in your project.
  3. You need to put the jar package under the vendor directory in a path that can be found by Java.
  4. For importing methods, please see the example.


Take the API for querying availability zones as an example:

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
// Import the client of the corresponding product module
import com.tencentcloudapi.cvm.v20170312.CvmClient;
// Import the request response class corresponding to the request API
import com.tencentcloudapi.cvm.v20170312.models.DescribeInstancesRequest;
import com.tencentcloudapi.cvm.v20170312.models.DescribeInstancesResponse;

public class DescribeInstances
    public static void main(String [] args) {
            // Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
            Credential cred = new Credential("secretId", "secretKey");
            // Instantiate the client object of the requested product (with CVM as an example)
            ClientProfile clientProfile = new ClientProfile();
            CvmClient client = new CvmClient(cred, "ap-guangzhou", clientProfile);
            // Instantiate a request object
            DescribeInstancesRequest req = new DescribeInstancesRequest();
            // Call the API you want to access through the client object. You need to pass in the request object
            DescribeInstancesResponse resp = client.DescribeInstances(req);
            // A string return packet in JSON format is output
        } catch (TencentCloudSDKException e) {


More examples

You can find more detailed examples in the examples directory of the GitHub repository.

Relevant Configuration


Specify proxy access. Currently, only HTTP proxy is supported:

HttpProfile httpProfile = new HttpProfile();
httpProfile.setProxyHost("real proxy IP");
httpProfile.setProxyPort(real proxy port);

Or, set the system proxy before initiating a request in the code:

System.setProperty("https.proxyHost", "Real proxy IP");
System.setProperty("https.proxyPort", "Real proxy port");

Or, set it in the startup parameters when running the program.


No description, website, or topics provided.







No packages published

Contributors 4