---
docId: doc_e56e8bf2b318469486f814f132531b83
title: New version of a scenario
description: Save the next version of a scenario. Earlier versions do not change.
api:
  group: agentes/evals/escenarios
  auth: bearer
  operations:
    - operationId: addEvalScenarioVersion
      method: POST
      path: '/v1/evals/scenarios/{scenarioId}/versions'
      postmanName: New version of a scenario
---

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

# New version of a scenario

Edit a scenario by saving a new version. Send the complete content in `scenario`, including `profileId`, and specify `scenarioId` in the URL. Previous versions are preserved.

Suites with a pinned version keep using it; other suites use the new version in their next run. Editing a platform scenario creates a copy in your workspace.

## Example

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

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

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

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

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `scenarioId` | string | The scenario you add the version to | ✓ |

## Request body

```json
{
  "scenario": {
    "title": "Books an appointment",
    "profileId": "general",
    "type": "script",
    "user": { "steps": ["Hi, I want to book an appointment", "Tuesday afternoon", "Under the name Ana López"] },
    "expect": {
      "outcome": "The agent asks only for the missing details and confirms the day and time.",
      "checks": [{ "kind": "tool_called", "tool": "book_appointment" }]
    },
    "run": { "nTrials": 3 }
  }
}
```

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `scenario` | object | The complete content of the new version, with the fields of [Scenario format](/api-reference/evals/scenarios/format#a-scenarios-content). `scenarioId` comes from the route. | ✓ |
| `scenario.profileId` | string | Here it does not default to `general`: send it, normally the same as the previous version. | ✓ |

## Response

`201` with the new version:

```json
{
  "status": "success",
  "data": {
    "scenarioId": "books_tuesday_appointment",
    "version": 3,
    "scope": "workspace",
    "status": "active",
    "proposedBy": "user",
    "contentHash": "sha256:0c7e…",
    "scenario": {
      "scenarioId": "books_tuesday_appointment",
      "title": "Books an appointment",
      "profileId": "general",
      "type": "script",
      "run": { "nTrials": 3, "maxTurns": 12 }
    }
  }
}
```

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 `setup` with content and the `state_equals` check (see [what is no longer accepted](/api-reference/evals/scenarios/format#what-is-no-longer-accepted)). |
| `404` | `EVAL_NOT_FOUND` | The scenario does not exist in your workspace. |

## Notes

- Past runs do not change: each trial reports the version it tested in `scenarioVersion`.
- It requires permission to edit agents (any).
