---
type: api
title: Rollback an agent
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-agents-agentid-rollback
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-agents-agentid-rollback
products:
  - Kibana
---

# Rollback an agent

Availability: 9.4+

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/fleet/agents/{agentId}/rollback`
- `POST` `/s/{space_id}/api/fleet/agents/{agentId}/rollback`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#basicauth)

#### Path Parameters

- `agentId` (string)
  The agent ID to rollback

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Rollback an agent to the previous version.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.

## Responses

#### `200`

OK: A successful request.

`application/json`

Any of:
- **Kibana_HTTP_APIs_action_id_response**
  - `actionId` (string)
- **Kibana_HTTP_APIs_action_message_response**
  - `message` (string)
#### `400`

A bad request.

`application/json`

- `attributes` (object)
- `error` (string)
- `errorType` (string)
- `message` (string)
- `statusCode` (number)
## Code Examples

#### Console

```console
POST /api/fleet/agents/{agentId}/rollback
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/agents/{agentId}/rollback" \
  -H "kbn-xsrf: true"
```

## Response Examples

#### Success

```json
{
  "actionId": "actionId"
}
```

#### Bad request

```json
{
  "message": "Bad Request"
}
```

