---
type: api
title: Upgrade a package policy
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-package-policies-upgrade
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-package-policies-upgrade
products:
  - Kibana
---

# Upgrade a package policy

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

## Paths

- `POST` `/api/fleet/package_policies/upgrade`
- `POST` `/s/{space_id}/api/fleet/package_policies/upgrade`

- [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)

## Description

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

Upgrade a package policy to a newer package version.<br/><br/>[Required authorization] Route required privileges: fleet-agent-policies-all AND integrations-all.

## Request Body

`application/json`

- `packagePolicyIds` ([] string · max: 1000) — required

## Responses

#### `200`

Successful response

`application/json`

Type: `[] object · max: 10000`

- `body` (object)
  - `message` (string)
- `id` (string)
- `name` (string)
- `statusCode` (number)
- `success` (boolean)
#### `400`

Bad Request

`application/json`

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

#### Console

```console
POST /api/fleet/package_policies/upgrade
{
  "packagePolicyIds": [
    "package-policy-id-1"
  ]
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/package_policies/upgrade" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "packagePolicyIds": [
    "package-policy-id-1"
  ]
}'
```

## Response Examples

#### Post upgrade package policies

Results of the upgrade operation

```json
[
  {
    "id": "package-policy-id-1",
    "name": "nginx-1",
    "success": true
  }
]
```

#### Generic error response

Example of a generic error response

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

