# Run a test scenario

`POST https://api.cademi.com.br/api/v3/sandbox/test-scenarios/{scenario_id}/runs`

Operation ID: `sandbox.test_scenarios.runs.create` · API v3

Runs a test scenario in the sandbox. Records created by the scenario have `meta.simulated` set to `true`, and the corresponding events are delivered to webhooks and event streams as they would be in production. Scenario parameters can be supplied in `params`.

Available only with sandbox credentials. Production credentials receive `409 Conflict` with the `sandbox_required` error code.

The run is processed asynchronously. The `Location` header points to the operation that tracks its progress. The `Idempotency-Key` header is required; retrying with the same key returns the same operation without running the scenario again.

Resetting the sandbox deletes the data created by scenario runs.

Required permissions: `sandbox.manage`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `scenario_id` | path | string | yes |  |

## Request body

Content type: `application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `params` | object | no |  |

## Responses

### 202

The scenario run was accepted for asynchronous processing. Returns the operation that tracks it.

Body: `data`: Operation.

Fields of Operation:

| Field | Type | Required | Description |
|---|---|---|---|
| `attempt` | object or null | yes |  |
| `cancellation_requested` | boolean | yes |  |
| `created_at` | string (date-time) | yes |  |
| `error` | object or null | yes |  |
| `expires_at` | string (date-time) | yes |  |
| `finished_at` | string or null (date-time) | yes |  |
| `id` | string | yes | Public ID, with the op_ prefix. |
| `items_url` | string | yes |  |
| `object` | string, one of `operation` | yes |  |
| `progress` | object | yes |  |
| `result_url` | string or null | yes |  |
| `started_at` | string or null (date-time) | yes |  |
| `status` | string, one of `queued`, `running`, `succeeded`, `partially_succeeded`, `failed`, `canceled` | yes |  |
| `type` | string | yes | Type of the operation, from a fixed set of values. |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

No test scenario exists with the supplied ID.

Body: Error.

### 409

The operation requires sandbox credentials.

Body: Error.

### 422

The Idempotency-Key header is missing or the request body is invalid.

Body: Error.

Full schema: https://cademi.dev/openapi/v3.json
