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

# Revert Agent to a Version

> Put an agent's settings back to how they were in an earlier version

Use this endpoint to undo changes: it saves the agent with the settings recorded in an earlier version from [List Agent Change History](/api-reference/agents/history). Nothing is removed from the history. The revert is recorded as a new version, so it can itself be undone the same way.

## Path Parameters

<ParamField path="agentId" type="string" required>
  The unique identifier of the agent (UUID format)
</ParamField>

<ParamField path="versionId" type="integer" required>
  The `id` of the version to restore, from [List Agent Change History](/api-reference/agents/history). Use `id`, not the `version` display number.
</ParamField>

## Request Body

No request body.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.telzino.com/v1/agents/123e4567-e89b-12d3-a456-426614174000/history/13789/revert \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const agentId = '123e4567-e89b-12d3-a456-426614174000';
  const versionId = 13789;

  const response = await fetch(
    `https://api.telzino.com/v1/agents/${agentId}/history/${versionId}/revert`,
    {
      method: 'POST',
      headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
    }
  );

  const result = await response.json();
  ```

  ```python Python theme={null}
  import requests

  agent_id = '123e4567-e89b-12d3-a456-426614174000'
  version_id = 13789

  response = requests.post(
      f'https://api.telzino.com/v1/agents/{agent_id}/history/{version_id}/revert',
      headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
  )

  result = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "message": "Agent reverted. If any settings changed, the new version appears in the change history within a few seconds."
  }
  ```

  ```json 401 theme={null}
  {
    "error": "invalid_request",
    "error_description": "Missing or malformed Authorization header"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "invalid_request",
    "error_description": "versionId must be a positive integer: the id of a version from GET /v1/agents/{agentId}/history"
  }
  ```

  ```json 403 theme={null}
  {
    "error": "forbidden",
    "error_description": "Feature(s) not available for this organization: warm_transfer"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "not_found",
    "error_description": "Version not found for this agent"
  }
  ```

  ```json 503 theme={null}
  {
    "error": "temporarily_unavailable",
    "error_description": "Could not revert the agent right now. Retry shortly."
  }
  ```
</ResponseExample>

## Behavior

**The response is a confirmation only.** It does not return the agent or the restored fields. To see exactly what changed, read [List Agent Change History](/api-reference/agents/history) a few seconds later: the revert appears as a new entry with `action: "reverted"`, `reverted_from_id` set to the version you restored, `actor.id` set to `api:<accountId>`, and `source: "dashboard-api"`.

**Only recorded settings are restored.** The settings the change history records come back to their values in that version. Everything else stays as it is now: agent status, functions, outbound and voicemail greetings, AMD/IVR, screenshare, email server, call limits and retries, agent type, integrations, SIP, and knowledge base documents. Web transfer also stays, except that restoring call transfer **off** turns web transfer off with it.

**The organization's feature locks apply**, as for [Update Agent](/api-reference/agents/update). A revert that would switch on an AI model, voice provider, cloned voice, warm transfer, knowledge base (RAG), PII redaction or email template the organization can no longer use is refused with `403`, and nothing is saved. So is a revert that changes the knowledge base settings while RAG is no longer available. Keeping a setting the agent already has on is not refused.

**The agent's save rules apply too.** A version that breaks one of the rules every agent save follows is refused with `403`, and the message says which rule.

**Reverting to the current settings changes nothing.** If the version's settings already match the agent, the request still returns `200` ("If any settings changed, …"), but no new version is recorded.

**Applied immediately.** The agent's cached configuration is refreshed as part of the request, so new calls use the restored settings. Calls already in progress are not interrupted.

**LiveKit agents only.** Agents on other providers return `403`, matching [Update Agent](/api-reference/agents/update).

<Info>
  Scoped API keys can use this endpoint for agents inside their reseller or organization. An agent outside the key's scope returns `404`, the same as an agent that does not exist.
</Info>

## Common Uses

### Undo a bad change

1. List the history and find the last good version, the one just before the unwanted change:

```bash theme={null}
curl "https://api.telzino.com/v1/agents/{agentId}/history?limit=10" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

2. Revert to that version's `id`:

```bash theme={null}
curl -X POST https://api.telzino.com/v1/agents/{agentId}/history/{id}/revert \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

3. A few seconds later, list the history again to confirm the new `reverted` entry and what it changed.

### Undo a revert

A revert is an ordinary version. Revert to the version just before it to undo it.

## Troubleshooting

| Error | Cause | Solution |
| - | - | - |
| `401` "Missing or malformed Authorization header" | No token, or a malformed one | Send `Authorization: Bearer YOUR_ACCESS_TOKEN` (see [Authentication](/api-reference/authentication)) |
| `401` with any other message | The token has expired, or was issued before the API key's secret was rotated | Get a new token (see [Authentication](/api-reference/authentication)) |
| `400` "versionId must be a positive integer" | The path has something other than a version `id` (for example the `version` number with a `v`, or a decimal) | Use the numeric `id` from [List Agent Change History](/api-reference/agents/history) |
| `403` "Cannot update vida agents via this API" | Agent is not a LiveKit agent | Only LiveKit agents can be updated through the API |
| `403` "Feature(s) not available for this organization: …" | The version turns on warm transfer or the knowledge base, and the organization is locked out of it | Revert to a version without that feature, or have the feature enabled for the organization first |
| `403` "RAG feature is not enabled for this organization" | The version turns on the knowledge base, or changes its settings, and RAG is off for the account or organization | Enable RAG first, or revert to a version with the current knowledge base settings |
| `403` "Custom voices feature is not enabled for this organization" | The version uses a cloned voice and custom voices are off for the organization | Enable custom voices first, or revert to a version with a stock voice |
| `403` other message | Another setting in the version (such as the AI model or voice provider) is no longer available to the organization, or the version breaks one of the agent's save rules | The message names the setting or rule; revert to a different version or change the setting with [Update Agent](/api-reference/agents/update) |
| `404` "Agent not found or access denied" | Wrong agent ID, or the agent belongs to another account or is outside the key's scope | Verify the ID with [List Agents](/api-reference/agents/list) and check your access token |
| `404` "Version not found for this agent" | The `id` belongs to another agent, or the version was removed by retention | List this agent's history and pick an `id` from it |
| `503` "Could not revert the agent right now" | A temporary problem on our side; nothing was saved | Retry shortly |
| `500` "Internal server error" | An unexpected error | Retry; if it keeps happening, contact support |
| `200` but no new history entry | The version's settings already matched the agent's | Nothing to fix; the agent already had those settings |


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