---
type: api
title: Rollback an agent
description: Rollback an agent to the previous version.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-post-fleet-agents-agentid-rollback
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-post-fleet-agents-agentid-rollback
products:
  - Kibana
---

# Rollback an agent

Availability: Experimental since 9.4

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

## Paths

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

#### Path parameters

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

## Description

Rollback an agent to the previous version.

## Required authorization

- Privileges: `fleet-agents-all`

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Responses

#### `200`

OK: A successful request.

`application/json`

Any of:
- **action_id_response**
  - `actionId` (string)
- **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 kbn:/api/fleet/agents/AGENT_ID/rollback
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/agents/${AGENT_ID}/rollback" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Success

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

#### Bad request

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

