---
type: api
title: Create a workflow
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-workflows-workflow
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-workflows-workflow
products:
  - Kibana
---

# Create a workflow

Availability: 9.4+

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/workflows/workflow`
- `POST` `/s/{space_id}/api/workflows/workflow`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-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.<br/><br/>[Required authorization] Route required privileges: workflowsManagement:create.

## Request Body

`application/json`

- `id` (string · min: 3 · max: 255 · pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$) — optional
- `yaml` (string · max: 1048576) — required

## Response

Indicates a successful response

## Code Examples

#### Console

```console
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"
}
```

#### curl

```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"
  }'
```

## Response Examples

#### Create workflow response

Example response returning the created workflow

```json
{
  "createdAt": "2025-11-20T10:30:00.000Z",
  "createdBy": "elastic",
  "definition": {
    "description": "This is a workflow example",
    "enabled": true,
    "inputs": [
      {
        "default": "hello world",
        "name": "message",
        "type": "string"
      }
    ],
    "name": "Example definition",
    "steps": [
      {
        "name": "hello_world_step",
        "type": "console",
        "with": {
          "message": "{{ inputs.message }}"
        }
      }
    ],
    "triggers": [
      {
        "type": "manual"
      }
    ]
  },
  "description": "This is a workflow example",
  "enabled": true,
  "id": "workflow-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "lastUpdatedAt": "2025-11-20T10:30:00.000Z",
  "lastUpdatedBy": "elastic",
  "name": "Example definition",
  "valid": true,
  "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: \u0022hello world\u0022\nsteps:\n  - name: hello_world_step\n    type: console\n    with:\n      message: \u0022{{ inputs.message }}\u0022\n"
}
```

