---
docId: doc_b76035b4d87c4041bc88985dce53ed6e
title: Restore a version
description: Brings an old version's configuration back into the draft as a new version. It doesn't change the publication.
api:
  group: agentes/borrador
  auth: bearer
  operations:
    - operationId: restoreVersion
      method: POST
      path: '/v1/agents/{agentId}/draft/restore'
      postmanName: Restore a version into the draft
---

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

# Restore a version

Restore a previous configuration so you can continue editing it in the draft. Send its `versionId`. This creates a new version, preserves the history and **does not change the publication**.

## Example

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

```bash
curl https://api.platic.ai/v1/agents/$AGENT_ID/draft/restore \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "versionId": "v3" }'
```

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

```ts
await platic.agents.draft.restore("agent_123", { versionId: "v3" });
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `agentId` | string | Agent id | ✓ |

## Request body

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `versionId` | string | Version to restore, for example `v3` | ✓ |
| `note` | string | Note for the new version, up to 500 characters | - |

```json
{
  "versionId": "v3",
  "note": "Go back to last week's instructions"
}
```

## Response

The fields are those from [Update the draft](/api-reference/agents/drafts/update#response). `restoredFromVersionId` identifies the source version:

```json
{
  "status": "success",
  "data": {
    "changed": true,
    "draft": { "versionId": "v6", "number": 6 },
    "version": {
      "versionId": "v6",
      "number": 6,
      "basedOnVersionId": "v5",
      "restoredFromVersionId": "v3",
      "copiedFrom": null,
      "createdAt": "2026-10-28T12:15:00.000Z",
      "createdBy": { "kind": "api_key", "keyId": "k3yId" },
      "source": "api",
      "via": null,
      "note": "Go back to last week's instructions"
    }
  }
}
```

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `403` | `FORBIDDEN` | The credential can't edit this agent |
| `404` | `AGENT_NOT_FOUND` | The agent doesn't exist in the workspace or was deleted |
| `404` | `VERSION_NOT_FOUND` | `versionId` doesn't exist on that agent |
| `409` | `CONFLICT` | Someone else changed this at the same time. Try again |
| `422` | `INVALID_SUBAGENT_LINK` | The version links a subagent that was already deleted and that the current draft doesn't have |
| `422` | `INVALID_CONFIG` | The version includes a `model` that Platica no longer knows and that the current draft doesn't have |
| `422` | `UNSUPPORTED_REASONING_EFFORT` | The version includes a model with a [reasoning level](/api-reference/agents/configuration#reasoning-level) it doesn't accept and that the current draft doesn't have. `details.supportedEfforts` lists the supported values |
| `422` | `MODEL_FALLBACKS_REQUIRE_OWN_KEY` | The version includes a fallback the current draft no longer has and the workspace has no own key connected. See [fallback models](/api-reference/agents/configuration#fallback-models) |

## Notes

- If the version is the same as the draft, it answers `changed: false` without creating a version.
- Restoring doesn't publish. To put the restored version into production, [publish it](/api-reference/agents/publications/publish).
- To put a version that was already published back into production, without going through the draft, use [Roll back](/api-reference/agents/publications/rollback).
