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

# Roll Back Agent

> Repoint production at a previously deployed version.

### Overview

Moves the agent's `production` pointer back to a version that has been deployed to production before, recording a new deployment with that version's original semver. Phone numbers attached to the agent begin answering with the restored version. Find candidates with [List Agent Deployments](https://docs.bland.ai/api-v2/get/agents-id-deployments.md), where `is_rollback_eligible` is `true`. `staging` is not changed.

Requires an admin, owner, operator, or prompter role.

### Headers

**authorization** `string` *required*

Your API key for authentication.

### Path Parameters

**agent\_id** `string` *required*

The agent's unique identifier.

### Body Parameters

**version\_id** `string` *required*

ID of the version to restore. It must belong to this agent, have at least one production deployment on record, and not be the current production pin. Missing or empty returns `400 BAD_REQUEST`. A version never deployed to production, or one that is already live, also returns `400 BAD_REQUEST` with a message explaining which. An ID that is not one of this agent's versions returns `404 NOT_FOUND`.

### Response

**data.semver** `string`

The restored version's number, for example `1.3.1`.

**data.environments** `array`

The agent's three environments after the rollback. Each has `id`, `env_type` (`dev`, `staging`, or `production`), and `current_version_id` (the pinned version, or `null` if unpinned).

**errors** `null | array`

`null` on success, or a list of error objects if the request failed.

```json Response theme={null}
{
  "data": {
    "semver": "1.3.1",
    "environments": [
      {
        "id": "3b4442ac-eaff-4a8d-bd9b-103affc43fc4",
        "env_type": "dev",
        "current_version_id": null
      },
      {
        "id": "6e92b74f-071f-4a09-85a5-5a3e6625ddf5",
        "env_type": "staging",
        "current_version_id": "4671db05-2d34-4171-9626-79a468e73f61"
      },
      {
        "id": "2c0ff980-fedf-4ebc-9117-dd21702d6e27",
        "env_type": "production",
        "current_version_id": "e6926b11-5513-4187-9dcf-5800b899f8da"
      }
    ]
  },
  "errors": null
}
```

```json Never Deployed theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "BAD_REQUEST",
      "message": "Cannot roll back to a version that was never deployed to production"
    }
  ]
}
```

```json Already Current theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "BAD_REQUEST",
      "message": "Production is already pinned to this version"
    }
  ]
}
```

```json Version Not Found theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "NOT_FOUND",
      "message": "Version not found on this agent"
    }
  ]
}
```

***

Docs for agents: [llms.txt](https://docs.bland.ai/llms.txt)


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