---
type: api
title: Dry run package policy upgrade
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4268/api/doc/kibana/v8/operation/operation-upgrade-package-policy-dry-run
resource: https://www.elastic.co/elastic/docs-builder/docs/4268/api/doc/kibana/v8/operation/operation-upgrade-package-policy-dry-run
products:
  - Kibana
---

# Dry run package policy upgrade

Authentication: required

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

## Paths

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

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Request body

`application/json`

- `packagePolicyIds` (string[]) — required
- `packageVersion` (string) — optional

## Responses

#### `200`

OK

`application/json`

Type: `object[]`

An array; each item has these fields:

- `agent_diff` (object[][])
- `diff` (object[])
  - `id` (string)
  - `inputs` (union oneOf)
    One of: `object[]` or `object`
  - `revision` (number)
  - `description` (string)
  - `enabled` (boolean)
  - `name` (string)
  - `namespace` (string)
  - `output_id` (string)
  - `overrides` (object)
  - `package` (object)
    - `name` (string)
    - `requires_root` (boolean)
    - `title` (string)
    - `version` (string)
  - `policy_id` (string) — nullable — deprecated
  - `policy_ids` (string[])
  - `errors` (object[])
    - `key` (string)
    - `message` (string)
  - `missingVars` (string[])
- `hasErrors` (boolean)
#### `400`

Generic Error

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (number)
## Code examples

#### Console

```console
POST kbn:/api/fleet/package_policies/upgrade/dryrun
{
  "packagePolicyIds": [
    "string"
  ]
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/package_policies/upgrade/dryrun" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "packagePolicyIds": [
      "string"
    ]
  }'
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
[
  {
    "agent_diff": [
      [
        {
          "data_stream": {
            "namespace": "string"
          },
          "id": "string",
          "meta": {},
          "name": "string",
          "revision": 0,
          "streams": {
            "id": "string"
          },
          "type": "string",
          "use_output": "string"
        }
      ]
    ],
    "diff": [
      {
        "id": "string",
        "inputs": [],
        "revision": 0,
        "description": "string",
        "enabled": false,
        "name": "string",
        "namespace": "string",
        "output_id": "string",
        "overrides": {},
        "package": {
          "name": "string",
          "requires_root": false,
          "title": "string",
          "version": "string"
        },
        "policy_id": "string",
        "policy_ids": [
          "string"
        ],
        "errors": [
          {
            "key": "string",
            "message": "string"
          }
        ],
        "missingVars": [
          "string"
        ]
      }
    ],
    "hasErrors": false
  }
]
```

#### 400

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "error": "string",
  "message": "string",
  "statusCode": 0
}
```

