Updated on 2025-10-24 GMT+08:00

Creating a Custom Job

Function

This API is used to create a custom job.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    coc:document:createDocument

    Write

    document *

    -

    -

    -

URI

POST /v1/documents

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition:

Job name.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

content

Yes

String

Definition:

Job content, which is a DSL statement. The maximum length is 64 KB.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

enterprise_project_id

Yes

String

Definition:

Enterprise project ID.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

risk_level

Yes

String

Definition:

Risk level.

  • LOW

  • MEDIUM

  • HIGH

  • LOW

  • MEDIUM

  • HIGH

Constraints:

N/A.

Value range:

Default value:

N/A.

description

No

String

Definition:

Job description.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

tags

No

Array of tags objects

Definition:

Tag list.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

Table 2 tags

Parameter

Mandatory

Type

Description

key

No

String

Definition:

Tag key.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

value

No

String

Definition:

Tag value.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

data

String

Definition:

Job ID returned by the system when a job is created.

Value range:

N/A.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

For details, see Error Codes.

error_msg

String

Definition:

Error description.

Value range:

For details, see Error Codes.

Example Requests

Create a custom job.

POST https://{Endpoint}/v1/documents

{
  "name" : "test_document",
  "description" : "",
  "enterprise_project_id" : "0",
  "risk_level" : "LOW",
  "content" : "meta:\n  name: test_document\n  schemaVersion: 3\n  description: \"\"\ninputs: {}\nsteps:\n  - name: pause\n    description: pause\n    task: hwc:runbook:suspend@1.0.0\n    inputs: {}\n    outputs: []"
}

Example Responses

Status code: 200

Request succeeded.

{
  "data" : "DM20250701180239xxxxx"
}

Status Codes

Status Code

Description

200

Request succeeded.

400

The contained error information is returned.

For more status codes, see Status Codes.

Error Codes

See Error Codes.