> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/security/zos/command/createcommand.md).

# CreateCommand

## 1. API Description

This API (CreateCommand) is used to create a command.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type                                                                          | Description                                                                           |
| --------------- | -------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| name            | Yes      | String                                                                        | <p>Command name.</p><p>The length should be no more than 64 characters.</p>           |
| content         | Yes      | String                                                                        | <p>Script content.</p><p>The length should be no more than 16K(16384) characters.</p> |
| type            | Yes      | [CommandType](/api-reference/security/zos/datastructure.md#commandtype)       | Script language type.                                                                 |
| description     | No       | String                                                                        | <p>Command note.</p><p>The length should be no more than 255 characters.</p>          |
| resourceGroupId | No       | String                                                                        | Resource group ID.                                                                    |
| tags            | No       | [TagAssociation](/api-reference/security/zos/datastructure.md#tagassociation) | Bound tags when creating resources.                                                   |

## 3. Output Parameters

| Parameter Name | Type   | Description                                                                                                           |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |
| commandId      | String | Created command ID.                                                                                                   |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Create a command in `Shell` language.**

```json
POST /api/v2/zos HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateCommand
<Common Request Params>

Request：
{
  "name": "Test Command",
  "content": "echo 1",
  "type": "SHELL",
  "tags": {
    "tags": [
      {
        "key": "test",
        "value": "test"
      }
    ]
  }
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "commandId": "<commandId>"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](/api-reference/api-introduction/toolkit/api-sdk.md)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code | Description |
| ---------------- | ---------- | ----------- |
