---
title: "Generate a test scenario from an insight failure mode"
method: POST
path: "/observability/v1/metric-failure-mode-insights/{id}/generate-scenario/"
tags: ["observability"]
---

# Generate a test scenario from an insight failure mode

`POST /observability/v1/metric-failure-mode-insights/{id}/generate-scenario/`

## Request

- Base URL: `https://api.cekura.ai`
- URL: `https://api.cekura.ai/observability/v1/metric-failure-mode-insights/{id}/generate-scenario/`
- Auth: one of:
  - API key in header `X-CEKURA-API-KEY`
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Turn one failure mode of a metric failure-mode insight into a test scenario that reproduces the issue against a target agent. Choose the failure mode with `failure_mode_index` and the agent with `agent`. Set `redact_transcripts` to strip personal identifiers from the source call transcripts before they are used to draft the scenario. Pass `folder_path` to file the generated scenario under an existing scenario folder; it lands in the project's `default` folder otherwise. Runs in the background and returns a `progress_id`; poll scenario generation progress to retrieve the generated scenario id.

## Path parameters

- `id` integer, required

## Request body

- MetricFailureModeInsightGenerateScenario: Request body for ``POST /metric-failure-mode-insights/<id>/generate-scenario/``. Turns one failure mode of an insight into a test scenario for the given agent. The agent is resolved on the frontend from the failure mode's example calls (see the ``failure-mode-agents`` action), so when a failure mode spans several agents the UI posts once per agent.
  - `failure_mode_index` integer, required: Zero-based index of the failure mode within the insight's failure_modes list.
  - `agent` integer, required: ID of the agent the generated scenario should target.
  - `redact_transcripts` boolean: If true, strip personal identifiers (names, contact details, financial, credentials, ID/health numbers) from the example call transcripts before they are used to draft the scenario. Semantic context (dates, locations, amounts, intent) is preserved. Defaults to false.
  - `folder_path` string: Path of the scenario folder the generated scenario should land in (e.g. "Sales.Inbound"), as returned by `GET /test_framework/v1/scenarios/folders/`. Omit to use the project's `default` folder.

## Response `200`

- MetricFailureModeInsightGenerateScenario: Request body for ``POST /metric-failure-mode-insights/<id>/generate-scenario/``. Turns one failure mode of an insight into a test scenario for the given agent. The agent is resolved on the frontend from the failure mode's example calls (see the ``failure-mode-agents`` action), so when a failure mode spans several agents the UI posts once per agent.
  - `failure_mode_index` integer, required: Zero-based index of the failure mode within the insight's failure_modes list.
  - `agent` integer, required: ID of the agent the generated scenario should target.
  - `redact_transcripts` boolean: If true, strip personal identifiers (names, contact details, financial, credentials, ID/health numbers) from the example call transcripts before they are used to draft the scenario. Semantic context (dates, locations, amounts, intent) is preserved. Defaults to false.
  - `folder_path` string: Path of the scenario folder the generated scenario should land in (e.g. "Sales.Inbound"), as returned by `GET /test_framework/v1/scenarios/folders/`. Omit to use the project's `default` folder.

## Changes

- **2026-11-03** `a6fb6a739212`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/cekura/apis/cekura-api/changes/observability/v1/metric-failure-mode-insights/:id/generate-scenario/post.md)

---

[API](https://skmtc.dev/cekura/apis/cekura-api.md) - [All operations](https://skmtc.dev/cekura/apis/cekura-api/llms.txt) - [OpenAPI document](https://skmtc.dev/cekura/apis/cekura-api/revisions/a6fb6a739212?raw)
