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

# Test a workflow

Availability: Generally available since 9.4

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

## Paths

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

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Execute a workflow in test mode without requiring it to be saved or enabled. Provide either a workflow ID to test a saved workflow, a YAML definition to test an unsaved draft, or both to test a modified version of an existing workflow.

## Required authorization

- Privileges: `workflowsManagement:execute`

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Request body

`application/json`

- `inputs` (map string to object) — required
  Key-value inputs for the test execution.
- `workflowId` (string) — optional
  ID of an existing workflow to test.
- `workflowYaml` (string) — optional
  YAML definition to test.

## Response

Indicates a successful response

`application/json`

## Code examples

#### Console

```console
POST kbn://api/workflows/test
{
  "workflowId": "workflow-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "inputs": { "message": "test message" }
}
```

#### curl

```curl
curl \
  -X POST "${KIBANA_URL}/api/workflows/test" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
    "workflowId": "workflow-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "inputs": { "message": "test message" }
  }'
```

## Response examples

#### Test workflow response

Example response returning the test execution ID

```json
{
  "workflowExecutionId": "test-exec-a1b2c3d4-e5f6"
}
```

