> ## Documentation Index
> Fetch the complete documentation index at: https://velt.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Restore Agent Version

Use this API to roll an agent back one version step. It deletes the current version N from the subcollection and decrements the root document's `version` pointer to N-1. This is a **single-step undo**: calling it repeatedly walks backward through version history. It cannot go below version 1.

There is no target-version parameter. The operation always undoes the most recent change.

# Endpoint

`POST https://api.velt.dev/v2/agents/versions/restore`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**agentId** `string` *required*

Min 1 char. Agent ID.

## **Example Requests**

```JSON theme={null}
{
  "data": {
    "agentId": "abc123def456"
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Version restored successfully",
    "data": {
      "version": 2
    }
  }
}
```

| Field | Type | Description |
| - | - | - |
| `data.version` | number | The version the agent was restored to (N-1) |

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "FAILED_PRECONDITION"
  }
}
```

**Errors:** `INVALID_ARGUMENT` (missing or empty `agentId`) / `NOT_FOUND` (the workspace store database could not be resolved, the agent does not exist, or the previous version snapshot is missing) / `FAILED_PRECONDITION` (already at version 1; cannot go lower).

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "Version restored successfully",
    "data": {
      "version": 2
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.