---
type: api
title: Upgrade an agent
description: Upgrade a specific agent to a newer version.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-post-fleet-agents-agentid-upgrade
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-post-fleet-agents-agentid-upgrade
products:
  - Kibana
---

# Upgrade an agent

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

## Paths

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

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

#### Path Parameters

- `agentId` (string)
  The agent ID

## Description

Upgrade a specific agent to a newer version.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.

## Request Body

`application/json`

- `force` (boolean) — optional
- `skipRateLimitCheck` (boolean) — optional
- `source_uri` (string) — optional
- `version` (string) — required

## Responses

#### `200`

Successful response

`application/json`

Type: `object`

#### `400`

Bad Request

`application/json`

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

#### Console

```console
POST /api/fleet/agents/{agentId}/upgrade
{
  "version": "8.17.0"
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/agents/{agentId}/upgrade" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "version": "8.17.0"
}'
```

## Response Examples

#### Post upgrade agent

Agent upgrade initiated

```json
{}
```

#### Generic error response

Example of a generic error response

```json
{
  "error": "Bad Request",
  "message": "An error message describing what went wrong",
  "statusCode": 400
}
```

