Create workflow template¶
Create a custom workflow template in the current workspace. Custom templates are only visible in the current workspace; built-in templates require administrator privileges.
HTTP
POST $CLOUDSIGMA_API_BASE/workflow-templates
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Creating built-in templates also requires administrator rights.
Request¶
Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workflow-templates" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "<TEMPLATE_NAME>",
"description": "<DESCRIPTION>",
"dsl_yaml": "<WORKFLOW_DSL_YAML>",
"runtime_fields": "{\"fields\":[]}",
"is_builtin": false
}'
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Required | Template name. Custom templates cannot have the same name in the current workspace and current language. |
description | string | Template description. | |
dsl_yaml | string | Required | The YAML text of the workflow DSL. |
runtime_fields | string | The JSON text of the runtime field definition; must be a valid JSON string when provided. | |
is_builtin | boolean | Whether to create a built-in template, the default is false. Setting to true requires administrator privileges and cannot use the system-managed built-in template ID. | |
template_key | string | The identifier of the built-in template. The server ignores this field when creating a custom template and returns an empty string; it cannot be repeated in the same language. |
Successful response¶
Returns 200 on success. data is a newly created template. Save data.id, this value will be needed for subsequent query, update or deletion of templates.
The response fields are as follows.
JSON
{
"code": "OK",
"msg": "OK",
"data": {
"id": 12,
"workspace_id": "ws-001",
"created_by": "user-001",
"updated_by": "user-001",
"template_key": "",
"name": "daily-import-template",
"description": "每日导入工作流模板",
"language": "zh-CN",
"dsl_yaml": "workflow: {}",
"runtime_fields": "{\"fields\":[]}",
"is_builtin": false,
"created_at": "2026-08-18T10:00:00Z",
"updated_at": "2026-08-18T10:00:00Z"
}
}
| Field | Type | Description |
|---|---|---|
code | string | OK when successful. |
msg | string | OK when successful. |
data.id | integer | Template ID. |
data.workspace_id | string | The ID of the workspace to which it belongs; the built-in template is an empty string. |
data.created_by | string | Creator ID. |
data.updated_by | string | Last updater ID. |
data.template_key | string | Built-in template identifier; custom template is an empty string. |
data.name | string | Template name. |
data.description | string | Template description. |
data.language | string | Template language, such as zh-CN. |
data.dsl_yaml | string | Saved workflow DSL YAML. |
data.runtime_fields | string | JSON text of the saved runtime field; empty string if not configured. |
data.is_builtin | boolean | Whether it is a built-in template. |
data.created_at | string | Creation time; may be omitted if not provided by the server. |
data.updated_at | string | Last updated time; may be omitted if not provided by the server. |
Error response¶
JSON
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
| Field | Type | Description |
|---|---|---|
code | string | Error code. |
msg | string | Readable error message. |
data | null | `null` in an error response. |
Follow-up operations¶
Use data.id query workflow template details.
Last updated on