tencent cloud

DescribeCommands
Last updated:2026-03-05 16:27:14
DescribeCommands
Last updated: 2026-03-05 16:27:14

1. API Description

Domain name for API request: tat.intl.tencentcloudapi.com.

This API is used to query command details.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeCommands.
Version Yes String Common Params. The value used for this API: 2020-10-28.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
CommandIds.N No Array of String List of command IDs. Up to 100 IDs are allowed for each request. CommandIds and Filters cannot be specified at the same time.
Filters.N No Array of Filter Filter criteria

- command-id - String - required: no - (filter condition) filter by the command id.
- command-name - String - required: no - (filter condition) filter by the command name.
-command-type - String - required: no - (filtering conditions) filters by command type. valid values: SHELL, POWERSHELL, BAT.
-scene-id - String - required: no - (filter condition) filter by scenario id. obtain scenario id through the DescribeScenes (query scenario) api.
-created-by - String - required: no - (filter condition) filter by command creator, value is TAT or USER. TAT represents public command, USER represents USER created command.
- tag-key - String - required: no - (filter condition) filter by the tag key.
- tag-value - String - required: no - (filter condition) filter by the tag value.
- tag:tag-key - String - required: no - (filter condition) filter by the tag-key - value pair. replace tag-key with a specific tag key. for usage, see example 4.

The maximum number of Filters per request is 10, and that of Filter.Values is 5. the CommandIds and Filters parameters cannot be specified at the same time.
Limit No Integer Number of returned results. It defaults to 20. The maximum is 100. For more information on Limit, see the relevant section in the API Overview.
Offset No Integer Offset. The default value is 0. For more information on Offset, see the relevant section in API Introduction.

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Total number of matching commands.
CommandSet Array of Command List of command details.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Query a Command Using CommandId

Input Example

POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeCommands
<Common request parameters>

{
    "CommandIds": [
        "cmd-dvstpcyy"
    ],
    "Offset": 0,
    "Limit": 20
}

Output Example

{
    "Response": {
        "RequestId": "eb973a12-71e3-4c0c-b1d8-4b863e5f5daf",
        "TotalCount": 1,
        "CommandSet": [
            {
                "CommandId": "cmd-dvstpcyy",
                "CommandName": "run-command",
                "Description": "whoami",
                "FormattedDescription": "",
                "CreatedBy": "USER",
                "Content": "d2hvYW1p",
                "CommandType": "SHELL",
                "WorkingDirectory": "/root/",
                "Timeout": 60,
                "EnableParameter": false,
                "DefaultParameters": "{\"varA\": \"222\"}",
                "DefaultParameterConfs": [],
                "Scenes": [],
                "Username": "root",
                "Tags": [
                    {
                        "Value": "test-key",
                        "Key": "test-value"
                    }
                ],
                "CreatedTime": "2020-11-02T02:48:11+00:00",
                "UpdatedTime": "2020-11-02T02:48:11+00:00",
                "OutputCOSBucketUrl": "https://BucketName-123454321.cos.ap-beijing.myqcloud.com",
                "OutputCOSKeyPrefix": "logs"
            }
        ]
    }
}

Example2 Using created-by Filter to Query

Input Example

POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeCommands
<Common request parameters>

{
    "Offset": 0,
    "Limit": 1,
    "Filters": [
        {
            "Name": "created-by",
            "Values": [
                "USER"
            ]
        }
    ]
}

Output Example

{
    "Response": {
        "RequestId": "6b215093-e1f6-4803-b84a-a230849e88d1",
        "TotalCount": 2,
        "CommandSet": [
            {
                "CommandId": "cmd-hb2q34lk",
                "CommandName": "second-command",
                "Description": "ps",
                "FormattedDescription": "",
                "DefaultParameterConfs": [],
                "Scenes": [],
                "CreatedBy": "USER",
                "Content": "cHM=",
                "CommandType": "SHELL",
                "WorkingDirectory": "/root/",
                "Timeout": 60,
                "EnableParameter": true,
                "DefaultParameters": "{\"varA\": \"222\"}",
                "Username": "root",
                "Tags": [
                    {
                        "Value": "test-key",
                        "Key": "test-value"
                    }
                ],
                "CreatedTime": "2020-10-30T07:19:52+00:00",
                "UpdatedTime": "2020-10-30T07:19:52+00:00",
                "OutputCOSBucketUrl": "https://BucketName-123454321.cos.ap-beijing.myqcloud.com",
                "OutputCOSKeyPrefix": "logs"
            }
        ]
    }
}

Example3 Use command-name Filter to Query

Input Example

POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeCommands
<Common request parameters>

{
    "Offset": 0,
    "Limit": 20,
    "Filters": [
        {
            "Name": "command-name",
            "Values": [
                "second-command",
                "first-command"
            ]
        }
    ]
}

Output Example

{
    "Response": {
        "RequestId": "6b215093-e1f6-4803-b84a-a230849e88d1",
        "TotalCount": 2,
        "CommandSet": [
            {
                "CommandId": "cmd-hb2q34lk",
                "CommandName": "second-command",
                "Description": "ps",
                "FormattedDescription": "",
                "DefaultParameterConfs": [],
                "Scenes": [],
                "CreatedBy": "USER",
                "Content": "cHM=",
                "CommandType": "SHELL",
                "WorkingDirectory": "/root/",
                "Timeout": 60,
                "EnableParameter": false,
                "DefaultParameters": "{\"varA\": \"222\"}",
                "Username": "root",
                "Tags": [
                    {
                        "Value": "test-key",
                        "Key": "test-value"
                    }
                ],
                "CreatedTime": "2020-10-30T07:19:52+00:00",
                "UpdatedTime": "2020-10-30T07:19:52+00:00",
                "OutputCOSBucketUrl": "https://BucketName-123454321.cos.ap-beijing.myqcloud.com",
                "OutputCOSKeyPrefix": "aa/bb/cc"
            },
            {
                "CommandId": "cmd-63usjhmq",
                "CommandName": "first-command",
                "Description": "hello world!",
                "FormattedDescription": "",
                "DefaultParameterConfs": [],
                "Scenes": [],
                "CreatedBy": "USER",
                "Content": "cHM=",
                "CommandType": "SHELL",
                "WorkingDirectory": "/root",
                "Timeout": 600,
                "EnableParameter": false,
                "DefaultParameters": "{\"varA\": \"222\"}",
                "Username": "root",
                "Tags": [
                    {
                        "Value": "test-key",
                        "Key": "test-value"
                    }
                ],
                "CreatedTime": "2020-10-26T11:26:07+00:00",
                "UpdatedTime": "2020-11-09T08:12:45+00:00",
                "OutputCOSBucketUrl": "https://BucketName-123454321.cos.ap-beijing.myqcloud.com",
                "OutputCOSKeyPrefix": "logs"
            }
        ]
    }
}

Example4 Using tag:tag-key Filter Query Command

Input Example

POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeCommands
<Common request parameters>

{
    "Filters": [
        {
            "Values": [
                "test-value"
            ],
            "Name": "tag:test-key"
        }
    ]
}

Output Example

{
    "Response": {
        "RequestId": "33d3d954-f73a-4a7f-869b-8792bc7a6f13",
        "TotalCount": 1,
        "CommandSet": [
            {
                "CommandId": "cmd-38ps9q4p",
                "CommandName": "tag-test-1",
                "Description": "",
                "FormattedDescription": "",
                "DefaultParameterConfs": [],
                "Scenes": [],
                "CreatedBy": "USER",
                "Content": "cHMK",
                "CommandType": "SHELL",
                "WorkingDirectory": "/root",
                "Timeout": 60,
                "EnableParameter": false,
                "DefaultParameters": "{\"varA\": \"222\"}",
                "Username": "root",
                "Tags": [
                    {
                        "Key": "test-key",
                        "Value": "test-value"
                    }
                ],
                "CreatedTime": "2021-05-12T02:49:04Z",
                "UpdatedTime": "2021-05-12T02:49:04Z",
                "OutputCOSBucketUrl": "https://BucketName-123454321.cos.ap-beijing.myqcloud.com",
                "OutputCOSKeyPrefix": "images"
            }
        ]
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameter.ConflictParameter Conflicting parameters.
InvalidParameterValue Invalid parameter value.
InvalidParameterValue.InvalidCommandId Invalid CommandId.
InvalidParameterValue.InvalidFilter Invalid filter.
UnauthorizedOperation.CamAuthFailed CAM authentication failed.
UnauthorizedOperation.InvalidToken Invalid token.
UnauthorizedOperation.MFAExpired The Multi-factor authentication (MFA) code expired.
UnauthorizedOperation.MFANotFound Multi-factor authentication (MFA) does not exist.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback