# Restore an experiment version

Bring an old setup back by writing it forward as a new save. History is never rewritten: the version you restored from stays in the list, and the restore is one more entry after it.

> Page: https://langwatch.ai/docs/api-reference/experiments/restore-an-experiment-version
> Source: https://github.com/langwatch/langwatch/blob/main/docs/api-reference/experiments/restore-an-experiment-version.mdx
> Index of all pages: https://langwatch.ai/docs/llms.txt

## Endpoint

`POST https://app.langwatch.ai/api/v1/experiments/{slug}/versions/{version}/restore`

## Authentication

### project_api_key

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

```json
{"id":"project_api_key","type":"apiKey","in":"header","name":"X-Auth-Token"}
```

## Parameters

### slug (path, required)

```json
{"type":"string","minLength":1}
```

### version (path, required)

The version to restore, as listed by `GET /api/experiments/{slug}/versions`

```json
{"type":"integer","minimum":0,"maximum":9007199254740991}
```

## Request example

```bash
curl --request POST \
  --url 'https://app.langwatch.ai/api/v1/experiments/<slug>/versions/<version>/restore' \
  --header "X-Auth-Token: $LANGWATCH_API_KEY"
```

## Responses

### 200

Success

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "version": {
      "type": "number",
      "description": "The new version the restore wrote. History is never rewritten, so the restored version is still in the list."
    }
  },
  "required": ["version"],
  "additionalProperties": false
}
```

### 401

Missing or invalid API key, or the key lacks the permission

### 404

No such experiment or version in this project

### 409

Someone else saved since you read this state (experiment_stale_workbench_state).

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.
