---
docId: doc_bee76e7740b8449bb45fc334c4211a08
title: Create a scenario
description: Create version 1 of a workspace scenario. It is active immediately.
api:
  group: agentes/evals/escenarios
  auth: bearer
  operations:
    - operationId: createEvalScenario
      method: POST
      path: '/v1/evals/scenarios'
      postmanName: Create a scenario
---

<script>
  import { Ways } from '$lib/components';
</script>

# Create a scenario

Define a test conversation and what the agent should achieve. Send its content in `scenario` with a unique `scenarioId`; version 1 is created and active for use in a suite.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X POST "https://api.platic.ai/v1/evals/scenarios" \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "scenario": {
    "scenarioId": "greets",
    "title": "Greets the customer",
    "type": "script",
    "user": { "steps": ["Hola"] },
    "expect": { "checks": [{ "kind": "message_contains", "text": "Hola", "role": "agent" }] }
  }
}'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.evals.scenarios.create({
  scenario: {
    scenarioId: "greets",
    title: "Greets the customer",
    type: "script",
    user: { steps: ["Hola"] },
    expect: { checks: [{ kind: "message_contains", text: "Hola", role: "agent" }] },
  },
});
```

</Ways.Way>
</Ways>

## Request body

```json
{
  "scenario": {
    "scenarioId": "no_invented_prices",
    "title": "Asks about prices",
    "type": "persona",
    "user": {
      "persona": "Customer comparing options. Writes short and wants concrete numbers.",
      "goal": "Find out how much it costs and what it includes.",
      "behaviors": ["Asks the price in the first message", "Asks to confirm whether there are extra costs"]
    },
    "expect": {
      "outcome": "Gives only the prices that are in its knowledge and never makes up figures.",
      "checks": [{ "kind": "assistance_requested", "expected": false, "severity": "should" }]
    },
    "run": { "nTrials": 3, "maxTurns": 8 }
  }
}
```

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `scenario` | object | The scenario's content. All its fields are in [Scenario format](/api-reference/evals/scenarios/format#a-scenarios-content). | ✓ |
| `scenario.scenarioId` | string | You choose it: unique in the workspace, up to 200 characters. | ✓ |
| `scenario.profileId` | string | The [profile](/api-reference/evals/scenarios/profiles). If you do not send it, `general`. | — |

## Response

`201` with the scenario:

```json
{
  "status": "success",
  "data": {
    "scenarioId": "no_invented_prices",
    "version": 1,
    "scope": "workspace",
    "status": "active",
    "proposedBy": "user",
    "contentHash": "sha256:a41d…",
    "scenario": {
      "scenarioId": "no_invented_prices",
      "title": "Asks about prices",
      "profileId": "general",
      "type": "persona",
      "run": { "nTrials": 3, "maxTurns": 8 }
    }
  }
}
```

The response includes the complete `scenario`; the example shows only part of it. Defaults are applied.

## Response fields

The same as in [List scenarios](/api-reference/evals/scenarios/list#response-fields).

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | The content is not valid. `details.issues` has the path of each problem. It includes a `profileId` that does not exist, `setup` with content and the `state_equals` check (see [what is no longer accepted](/api-reference/evals/scenarios/format#what-is-no-longer-accepted)). |
| `409` | `EVAL_CONFLICT` | A scenario with that `scenarioId` already exists. Choose another, or save a [new version](/api-reference/evals/scenarios/new-version) of the existing one. |

With a `profileId` that does not exist:

```json
{
  "code": 400,
  "error": "Bad Request - The request has validation errors",
  "details": {
    "code": "INVALID_REQUEST",
    "message": "Ese perfil no existe. Usa GET /v1/evals/profiles o omite profileId para usar general."
  }
}
```

## Notes

- It requires permission to edit agents (any).
- Next: [create a suite](/api-reference/evals/suites/create) with this scenario.
