---
type: api
title: Dry run a package policy upgrade
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-fleet-package-policies-upgrade-dryrun
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-fleet-package-policies-upgrade-dryrun
products:
  - Kibana
---

# Dry run a package policy upgrade

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

## Paths

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

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

## Description

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

Preview the changes that would be applied by upgrading a package policy to a newer package version.<br/><br/>[Required authorization] Route required privileges: fleet-agent-policies-read AND integrations-read.

## Request Body

`application/json`

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

## Responses

#### `200`

Successful response

`application/json`

Type: `[] object · max: 10000`

- `agent_diff` ([] object · max: 1)
- `body` (object)
  - `message` (string)
- `diff` ([] union anyOf · max: 2)
  - **Kibana_HTTP_APIs_dry_run_package_policy_response**
    - `additional_datastreams_permissions` ([] string · max: 1000) — nullable
      Additional data stream permissions that will be added to the agent policy.
    - `agents` (number)
    - `cloud_connector_id` (string) — nullable
      ID of the cloud connector associated with this package policy.
    - `cloud_connector_name` (string · min: 1 · max: 255) — nullable
      Transient field for cloud connector name during creation.
    - `condition` (string · max: 10000) — nullable
      Agent condition expression to evaluate whether to apply this integration to its inputs.
    - `created_at` (string)
    - `created_by` (string)
    - `description` (string)
      Package policy description
    - `elasticsearch` (object)
      - `privileges` (object)
        - `cluster` ([] string · max: 100)
    - `enabled` (boolean)
    - `global_data_tags` ([] object · max: 100) — nullable
      - `name` (string)
        The name of the custom field. Cannot contain spaces.
      - `value` (number | string)
        The value of the custom field.
    - `id` (string · max: 255)
    - `inputs` (union anyOf)
      Package policy inputs.
      - **[]object**
        - `compiled_input` (object)
        - `condition` (string · max: 10000) — nullable
          Agent condition expression to evaluate whether to apply this input.
        - `config` (map string to object)
          Package variable (see integration documentation for more information)
          Map values (object)
          - `frozen` (boolean)
          - `type` (string)
          - `value` (object)
        - `deprecated` ({})
          - `description` (string · max: 4096)
          - `replaced_by` (map string to string)
          - `since` (string · max: 50)
        - `enabled` (boolean)
        - `id` (string)
        - `keep_enabled` (boolean)
        - `migrate_from` (string)
        - `name` (string)
        - `policy_template` (string)
        - `streams` ([] object · max: 1000)
          - `compiled_stream` (object)
          - `condition` (string · max: 10000) — nullable
            Agent condition expression to evaluate whether to apply this stream.
          - `config` (map string to object)
            Package variable (see integration documentation for more information)
            Map values (object)
            - `frozen` (boolean)
            - `type` (string)
            - `value` (object)
          - `data_stream` (object)
            - `dataset` (string)
            - `elasticsearch` (object)
              - `dynamic_dataset` (boolean)
              - `dynamic_namespace` (boolean)
              - `privileges` (object)
                - `indices` ([] string · max: 100)
            - `type` (string)
          - `deprecated` ({})
            - `description` (string · max: 4096)
            - `replaced_by` (map string to string)
            - `since` (string · max: 50)
          - `enabled` (boolean)
          - `id` (string)
          - `keep_enabled` (boolean)
          - `migrate_from` (string)
          - `release` (enum)
            Values: `ga`, `beta`, `experimental`
          - `var_group_selections` (map string to string)
            Variable group selections. Maps var_group name to the selected option name within that group.
          - `vars` (map string to object)
            Package variable (see integration documentation for more information)
            Map values (object)
            - `frozen` (boolean)
            - `type` (string)
            - `value` (object)
        - `type` (string)
        - `var_group_selections` (map string to string)
          Variable group selections. Maps var_group name to the selected option name within that group.
        - `vars` (map string to object)
          Package variable (see integration documentation for more information)
          Map values (object)
          - `frozen` (boolean)
          - `type` (string)
          - `value` (object)
      - **string to object**
        Package policy inputs. Refer to the integration documentation to know which inputs are available.
        - `<string>` (object)
          - `condition` (string · max: 10000) — nullable
            Agent condition expression to evaluate whether to apply this input.
          - `deprecated` ({})
            - `description` (string · max: 4096)
            - `replaced_by` (map string to string)
            - `since` (string · max: 50)
          - `enabled` (boolean)
            Enable or disable that input. Defaults to `true` (enabled).
          - `streams` (map string to object)
            Input streams. Refer to the integration documentation to know which streams are available.
            Map values (object)
            - `condition` (string · max: 10000) — nullable
              Agent condition expression to evaluate whether to apply this stream.
            - `deprecated` ({})
              - `description` (string · max: 4096)
              - `replaced_by` (map string to string)
              - `since` (string · max: 50)
            - `enabled` (boolean)
              Enable or disable that stream. Defaults to `true` (enabled).
            - `var_group_selections` (map string to string)
              Variable group selections. Maps var_group name to the selected option name within that group.
            - `vars` (map string to anyOf)
              Input/stream level variable. Refer to the integration documentation for more information.
          - `vars` (map string to anyOf)
            Input/stream level variable. Refer to the integration documentation for more information.
    - `is_managed` (boolean)
    - `name` (string)
      Unique name for the package policy.
    - `namespace` (string · max: 100)
      The package policy namespace. Leave blank to inherit the agent policy's namespace.
    - `output_id` (string) — nullable
    - `overrides` (object) — nullable
      Override settings that are defined in the package policy. The override option should be used only in unusual circumstances and not as a routine procedure.
      - `inputs` (map string to object)
    - `package` ({})
      - `experimental_data_stream_features` ([] object · max: 100)
        - `data_stream` (string · max: 1024)
        - `features` (object)
          - `doc_value_only_numeric` (boolean)
          - `doc_value_only_other` (boolean)
          - `synthetic_source` (boolean)
          - `tsdb` (boolean)
      - `fips_compatible` (boolean)
      - `name` (string · max: 255)
        Package name
      - `requires_root` (boolean)
      - `title` (string · max: 255)
      - `version` (string · max: 50)
        Package version
    - `package_agent_version_condition` (string)
    - `policy_id` (string) — nullable — deprecated
      ID of the agent policy which the package policy will be added to.
    - `policy_ids` ([] string · max: 1000)
    - `revision` (number)
      Package policy revision.
    - `secret_references` ([] object · max: 1000)
      - `id` (string)
    - `spaceIds` ([] string · max: 100)
    - `supports_agentless` (boolean) — nullable
      Indicates whether the package policy belongs to an agentless agent policy.
    - `supports_cloud_connector` (boolean) — nullable
      Indicates whether the package policy supports cloud connectors.
    - `updated_at` (string)
    - `updated_by` (string)
    - `var_group_selections` (map string to string)
      Variable group selections. Maps var_group name to the selected option name within that group.
    - `vars` (union anyOf)
      Package level variable.
      - **string to object**
        Package variable (see integration documentation for more information)
        - `<string>` (object)
          - `frozen` (boolean)
          - `type` (string)
          - `value` (object)
      - **string to anyOf**
        Input/stream level variable. Refer to the integration documentation for more information.
    - `version` (string)
      Package policy ES version.
  - **Kibana_HTTP_APIs_dry_run_package_policy**
    - `additional_datastreams_permissions` ([] string · max: 1000) — nullable
      Additional data stream permissions that will be added to the agent policy.
    - `cloud_connector_id` (string) — nullable
      ID of the cloud connector associated with this package policy.
    - `cloud_connector_name` (string · min: 1 · max: 255) — nullable
      Transient field for cloud connector name during creation.
    - `condition` (string · max: 10000) — nullable
      Agent condition expression to evaluate whether to apply this integration to its inputs.
    - `created_at` (string)
    - `created_by` (string)
    - `description` (string)
      Package policy description
    - `elasticsearch` (object)
      - `privileges` (object)
        - `cluster` ([] string · max: 100)
    - `enabled` (boolean)
    - `errors` ([] object · max: 10)
      - `key` (string)
      - `message` (string)
    - `force` (boolean)
    - `global_data_tags` ([] object · max: 100) — nullable
      - `name` (string)
        The name of the custom field. Cannot contain spaces.
      - `value` (number | string)
        The value of the custom field.
    - `id` (string · max: 255)
    - `inputs` ([] object · max: 100)
      - `compiled_input` (object)
      - `condition` (string · max: 10000) — nullable
        Agent condition expression to evaluate whether to apply this input.
      - `config` (map string to object)
        Package variable (see integration documentation for more information)
        Map values (object)
        - `frozen` (boolean)
        - `type` (string)
        - `value` (object)
      - `deprecated` ({})
        - `description` (string · max: 4096)
        - `replaced_by` (map string to string)
        - `since` (string · max: 50)
      - `enabled` (boolean)
      - `id` (string)
      - `keep_enabled` (boolean)
      - `migrate_from` (string)
      - `name` (string)
      - `policy_template` (string)
      - `streams` ([] object · max: 1000)
        - `compiled_stream` (object)
        - `condition` (string · max: 10000) — nullable
          Agent condition expression to evaluate whether to apply this stream.
        - `config` (map string to object)
          Package variable (see integration documentation for more information)
          Map values (object)
          - `frozen` (boolean)
          - `type` (string)
          - `value` (object)
        - `data_stream` (object)
          - `dataset` (string)
          - `elasticsearch` (object)
            - `dynamic_dataset` (boolean)
            - `dynamic_namespace` (boolean)
            - `privileges` (object)
              - `indices` ([] string · max: 100)
          - `type` (string)
        - `deprecated` ({})
          - `description` (string · max: 4096)
          - `replaced_by` (map string to string)
          - `since` (string · max: 50)
        - `enabled` (boolean)
        - `id` (string)
        - `keep_enabled` (boolean)
        - `migrate_from` (string)
        - `release` (enum)
          Values: `ga`, `beta`, `experimental`
        - `var_group_selections` (map string to string)
          Variable group selections. Maps var_group name to the selected option name within that group.
        - `vars` (map string to object)
          Package variable (see integration documentation for more information)
          Map values (object)
          - `frozen` (boolean)
          - `type` (string)
          - `value` (object)
      - `type` (string)
      - `var_group_selections` (map string to string)
        Variable group selections. Maps var_group name to the selected option name within that group.
      - `vars` (map string to object)
        Package variable (see integration documentation for more information)
        Map values (object)
        - `frozen` (boolean)
        - `type` (string)
        - `value` (object)
    - `is_managed` (boolean)
    - `missingVars` ([] string · max: 100)
    - `name` (string)
      Unique name for the package policy.
    - `namespace` (string · max: 100)
      The package policy namespace. Leave blank to inherit the agent policy's namespace.
    - `output_id` (string) — nullable
    - `overrides` (object) — nullable
      Override settings that are defined in the package policy. The override option should be used only in unusual circumstances and not as a routine procedure.
      - `inputs` (map string to object)
    - `package` ({})
      Same fields as `package` in `Kibana_HTTP_APIs_dry_run_package_policy_response`
    - `package_agent_version_condition` (string)
    - `policy_id` (string) — nullable — deprecated
      ID of the agent policy which the package policy will be added to.
    - `policy_ids` ([] string · max: 1000)
    - `revision` (number)
    - `secret_references` ([] object · max: 1000)
      - `id` (string)
    - `supports_agentless` (boolean) — nullable
      Indicates whether the package policy belongs to an agentless agent policy.
    - `supports_cloud_connector` (boolean) — nullable
      Indicates whether the package policy supports cloud connectors.
    - `updated_at` (string)
    - `updated_by` (string)
    - `var_group_selections` (map string to string)
      Variable group selections. Maps var_group name to the selected option name within that group.
    - `vars` (map string to object)
      Package variable (see integration documentation for more information)
      Map values (object)
      - `frozen` (boolean)
      - `type` (string)
      - `value` (object)
    - `version` (string)
      Package policy ES version.
- `hasErrors` (boolean)
- `name` (string)
- `statusCode` (number)
#### `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/dryrun
{
  "packagePolicyIds": [
    "package-policy-id-1"
  ]
}
```

#### curl

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

## Response Examples

#### Post dry run package policies

Preview of the package policy upgrade diff

```json
[
  {
    "diff": [
      {
        "id": "package-policy-id-1",
        "name": "nginx-1",
        "package": {
          "name": "nginx",
          "version": "1.20.0"
        }
      },
      {
        "name": "nginx-1",
        "package": {
          "name": "nginx",
          "version": "1.21.0"
        }
      }
    ],
    "hasErrors": false,
    "name": "nginx-1"
  }
]
```

#### Generic error response

Example of a generic error response

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

