Spaces method and path for this operation:
post /s/{space_id}/api/workflows/workflow
Refer to Spaces for more information.
Create a new workflow from a YAML definition. The YAML is validated and parsed before the workflow is saved. An optional custom ID can be provided.
[Required authorization] Route required privileges: workflowsManagement:create.
POST
/api/workflows/workflow
curl
curl \
-X POST "${KIBANA_URL}/api/workflows/workflow" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{
"yaml": "name: Example definition\nenabled: true\ndescription: This is a workflow example\ntriggers:\n - type: manual\ninputs:\n - name: message\n type: string\n default: \"hello world\"\nsteps:\n - name: hello_world_step\n type: console\n with:\n message: \"{{ inputs.message }}\"\n"
}'
POST kbn://api/workflows/workflow
{
"yaml": "name: Example definition\nenabled: true\ndescription: This is a workflow example\ntriggers:\n - type: manual\ninputs:\n - name: message\n type: string\n default: \"hello world\"\nsteps:\n - name: hello_world_step\n type: console\n with:\n message: \"{{ inputs.message }}\"\n"
}
Request examples
Create workflow request example
Example request for creating a workflow from a YAML definition
{
"yaml": "name: Example definition\nenabled: true\ndescription: This is a workflow example\ntriggers:\n - type: manual\ninputs:\n - name: message\n type: string\n default: \"hello world\"\nsteps:\n - name: hello_world_step\n type: console\n with:\n message: \"{{ inputs.message }}\"\n"
}
Example request for creating a workflow with a custom ID
{
"id": "workflow-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"yaml": "name: Example definition\nenabled: true\ndescription: This is a workflow example\ntriggers:\n - type: manual\ninputs:\n - name: message\n type: string\n default: \"hello world\"\nsteps:\n - name: hello_world_step\n type: console\n with:\n message: \"{{ inputs.message }}\"\n"
}
Response examples (200)
Example response returning the created workflow
{
"id": "workflow-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Example definition",
"yaml": "name: Example definition\nenabled: true\ndescription: This is a workflow example\ntriggers:\n - type: manual\ninputs:\n - name: message\n type: string\n default: \"hello world\"\nsteps:\n - name: hello_world_step\n type: console\n with:\n message: \"{{ inputs.message }}\"\n",
"valid": true,
"enabled": true,
"createdAt": "2025-11-20T10:30:00.000Z",
"createdBy": "elastic",
"definition": {
"name": "Example definition",
"steps": [
{
"name": "hello_world_step",
"type": "console",
"with": {
"message": "{{ inputs.message }}"
}
}
],
"inputs": [
{
"name": "message",
"type": "string",
"default": "hello world"
}
],
"enabled": true,
"triggers": [
{
"type": "manual"
}
],
"description": "This is a workflow example"
},
"description": "This is a workflow example",
"lastUpdatedAt": "2025-11-20T10:30:00.000Z",
"lastUpdatedBy": "elastic"
}