POST /api/workflows

Spaces method and path for this operation:

post /s/{space_id}/api/workflows

Refer to Spaces for more information.

Create multiple workflows in a single request. Optionally overwrite existing workflows.

[Required authorization] Route required privileges: workflowsManagement:create AND workflowsManagement:update.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

Query parameters

  • overwrite boolean

    Whether to overwrite existing workflows.

    Default value is false.

application/json

Body

  • workflows array[object] Required

    Not more than 500 elements.

    Hide workflows attributes Show workflows attributes object
    • id string

      Maximum length is 255. Format should match the following pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,254}$.

    • yaml string Required

      Maximum length is 1048576.

Responses

  • 200 application/json

    Indicates a successful response

POST /api/workflows
curl \
  -X POST "${KIBANA_URL}/api/workflows?overwrite=false" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
    "workflows": [
      { "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" },
      { "id": "workflow-b2c3d4e5-f6a7-8901-bcde-f12345678901", "yaml": "name: Second workflow\nenabled: false\ndescription: Another workflow\ntriggers:\n  - type: manual\nsteps:\n  - name: log_step\n    type: console\n    with:\n      message: \"Hello from second workflow\"\n" }
    ]
  }'
POST kbn://api/workflows?overwrite=false
{
  "workflows": [
    { "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" },
    { "id": "workflow-b2c3d4e5-f6a7-8901-bcde-f12345678901", "yaml": "name: Second workflow\nenabled: false\ndescription: Another workflow\ntriggers:\n  - type: manual\nsteps:\n  - name: log_step\n    type: console\n    with:\n      message: \"Hello from second workflow\"\n" }
  ]
}
Request example
Example request for creating multiple workflows at once
{
  "workflows": [
    {
      "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"
    },
    {
      "id": "workflow-b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "yaml": "name: Second workflow\nenabled: false\ndescription: Another workflow\ntriggers:\n  - type: manual\nsteps:\n  - name: log_step\n    type: console\n    with:\n      message: \"Hello from second workflow\"\n"
    }
  ]
}
Response examples (200)
Example response after creating multiple workflows
{
  "total": 2,
  "created": [
    {
      "id": "workflow-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "Example definition"
    },
    {
      "id": "workflow-b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "name": "Second workflow"
    }
  ],
  "failures": []
}