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

Creating a Workflow Instance

Function

This API is used to create a workflow instance.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/workspaces/{workspace_id}/soc/workflows/{workflow_id}/instances

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID

Constraints

N/A

Range

N/A

Default Value

N/A

workspace_id

Yes

String

Definition

Workspace ID.

Range

N/A

workflow_id

Yes

String

Workflow ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. You can obtain it by calling the IAM API for obtaining a user token. The user token is the value of X-Subject-Token in the response header. Obtaining a User Token

Constraints

N/A

Range

N/A

Default Value

N/A

content-type

Yes

String

Definition

Content type.

  • application/json;charset=UTF-8: common API request type

Constraints

N/A

Range

  • application/json;charset=UTF-8

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

command_type

Yes

String

Definition

Commands used to operate a workflow instance.

  • ActionInstanceRunCommand: runs a workflow instance.

Constraints

N/A

Range

  • ActionInstanceRunCommand

Default Value

N/A

action_type

Yes

String

Definition

Action type.

  • workflow: workflow

Constraints

N/A

Range

  • workflow

Default Value

N/A

action_id

No

String

Definition

Workflow ID.

Constraints

N/A

action_instance_id

No

String

Definition

Workflow instance ID.

Constraints

N/A

playbook_context

No

PlaybookcontextRef object

Execution context.

Table 4 PlaybookcontextRef

Parameter

Mandatory

Type

Description

data_object

Yes

DataObjectRefInfo object

Workflow execution context.

Table 5 DataObjectRefInfo

Parameter

Mandatory

Type

Description

content

No

Map<String,Object>

Workflow instance context.

dataclass

No

DataClassRef object

Data class information.

Table 6 DataClassRef

Parameter

Mandatory

Type

Description

id

No

String

Definition

Data class ID.

Range

N/A

name

Yes

String

Definition

Data class name.

Range

N/A

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

command_type

String

Definition

Commands used to operate a workflow instance.

  • ActionInstanceRunCommand: runs a workflow instance.

Constraints

N/A

Range

  • ActionInstanceRunCommand

Default Value

N/A

action_type

String

Definition

Action type.

  • workflow: workflow

Constraints

N/A

Range

  • workflow

Default Value

N/A

action_id

String

Definition

Workflow ID.

Constraints

N/A

action_instance_id

String

Definition

Workflow instance ID.

Constraints

N/A

playbook_context

PlaybookcontextRef object

Execution context.

Table 8 PlaybookcontextRef

Parameter

Type

Description

data_object

DataObjectRefInfo object

Workflow execution context.

Table 9 DataObjectRefInfo

Parameter

Type

Description

content

Map<String,Object>

Workflow instance context.

dataclass

DataClassRef object

Data class information.

Table 10 DataClassRef

Parameter

Type

Description

id

String

Definition

Data class ID.

Range

N/A

name

String

Definition

Data class name.

Range

N/A

Example Requests

The workflow instance for running alert data classes

{
  "command_type" : "ActionInstanceRunCommand",
  "action_type" : "workflow",
  "action_id" : "446255ce-XXXXXXXXXX-0b4931",
  "action_instance_id" : "1111xxxxxxxxxxxxxx111",
  "playbook_context" : {
    "data_object" : {
      "dataclass" : {
        "name" : "Alert"
      },
      "content" : {
        "name" : { },
        "key" : { }
      }
    }
  }
}

Example Responses

Status code: 200

Response to the operation of a workflow instance.

{
  "command_type" : "ActionInstanceRunCommand",
  "action_type" : "workflow",
  "action_id" : "446255ce-XXXXXXXXXX-0b4931",
  "action_instance_id" : "1111xxxxxxxxxxxxxx111",
  "playbook_context" : {
    "data_object" : {
      "dataclass" : {
        "name" : "Alert"
      },
      "content" : {
        "name" : { },
        "key" : { }
      }
    }
  }
}

Status Codes

Status Code

Description

200

Response to the operation of a workflow instance.

Error Codes

See Error Codes.