---
type: api
title: Bulk get agent policies
description: Get multiple agent policies by ID.<br/><br/>[Required authorization] Route required privileges: fleet-agent-policies-read OR fleet-agents-read OR fleet-setup.
url: https://www.elastic.co/elastic/docs-builder/docs/4922/api/doc/kibana-serverless/operation/operation-post-fleet-agent-policies-bulk-get
resource: https://www.elastic.co/elastic/docs-builder/docs/4922/api/doc/kibana-serverless/operation/operation-post-fleet-agent-policies-bulk-get
products:
  - Kibana
---

# Bulk get agent policies

Authentication: required

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

## Paths

- `POST` `/api/fleet/agent_policies/_bulk_get`
- `POST` `/s/{space_id}/api/fleet/agent_policies/_bulk_get`

#### 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.

## Description

Get multiple agent policies by ID.

## Required privileges

- Privileges: `fleet-agent-policies-read` or `fleet-agents-read` or `fleet-setup`

## Query string parameters

- `format` (enum) — optional
  Format for the response: simplified or legacy
  Values: `simplified`, `legacy`

## Header parameters

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

## Request body

`application/json`

- `full` (boolean) — optional
  get full policies with package policies populated
- `ids` (string[] · max items: 1000) — required
  list of package policy ids
- `ignoreMissing` (boolean) — optional

## Responses

#### `200`

Successful response

`application/json`

- `items` (object[] · max items: 10000)
  - `active_agents_per_version` (object[] · max items: 1000)
    Number of active agents per version, excluding OpAMP agents. These are the agents package-level agent version conditions apply to.
    - `count` (number)
    - `version` (string)
  - `advanced_settings` (object)
    - `agent_download_target_directory` (object)
    - `agent_download_timeout` (object)
    - `agent_features_disable_policy_change_acks_enabled` (object)
    - `agent_features_include_tags_in_events_enabled` (object)
    - `agent_internal` (object)
    - `agent_limits_go_max_procs` (object)
    - `agent_logging_files_interval` (object)
    - `agent_logging_files_keepfiles` (object)
    - `agent_logging_files_rotateeverybytes` (object)
    - `agent_logging_level` (object)
    - `agent_logging_metrics_period` (object)
    - `agent_logging_to_files` (object)
    - `agent_monitoring_runtime_experimental` (object)
  - `agent_features` (object[] · max items: 100)
    - `enabled` (boolean)
    - `name` (string)
  - `agentless` (object)
    - `cloud_connectors` (object)
      - `enabled` (boolean)
      - `target_csp` (enum)
        Values: `aws`, `azure`, `gcp`
    - `cluster_id` (string)
    - `resources` (object)
      - `requests` (object)
        - `cpu` (string)
        - `memory` (string)
  - `agents` (number)
  - `agents_per_version` (object[] · max items: 1000)
    - `count` (number)
    - `version` (string)
  - `created_at` (string)
  - `data_output_id` (string) — nullable
  - `description` (string)
  - `download_source_id` (string) — nullable — deprecated
    Use `download_source_ids` instead
  - `download_source_ids` (string[] · max items: 3)
    An ordered list of agent binary download sources. When downloading an upgrade, Elastic Agent tries them in order until a download succeeds. Elastic Agent versions earlier than 9.6.0 only use the first source. All sources use the first source's proxy, SSL, authentication, and `reserve_diskspace` settings. If the first source uses a proxy, Fleet uses the proxy's SSL settings instead of the source's. An empty list uses the default download source. On update, omitting this field keeps the current list. If you set only the deprecated `download_source_id`, Fleet replaces the list with that source, or clears it if the value is `null`.
  - `fips_agents` (number)
  - `fleet_server_host_id` (string) — nullable
  - `global_data_tags` (object[] · max items: 100)
    User defined data tags that are added to all of the inputs. The values can be strings or numbers.
    - `name` (string)
    - `value` (number | string)
  - `has_agent_version_conditions` (boolean)
  - `has_fleet_server` (boolean)
  - `id` (string)
  - `inactivity_timeout` (number · min: 0 · default: 1209600)
  - `is_default` (boolean)
  - `is_default_fleet_server` (boolean)
  - `is_managed` (boolean)
  - `is_preconfigured` (boolean)
  - `is_protected` (boolean)
    Indicates whether the agent policy has tamper protection enabled. Defaults to `false`.
  - `is_verifier` (boolean)
  - `keep_monitoring_alive` (boolean) — nullable
    When set to true, monitoring will be enabled but logs/metrics collection will be disabled
  - `min_agent_version` (string) — nullable
  - `monitoring_diagnostics` (object)
    - `limit` (object)
      - `burst` (number)
      - `interval` (string)
    - `uploader` (object)
      - `init_dur` (string)
      - `max_dur` (string)
      - `max_retries` (number)
  - `monitoring_enabled` (enum[] · max items: 3)
    Values: `logs`, `metrics`, `traces`
  - `monitoring_http` (object)
    - `buffer` (object)
      - `enabled` (boolean · default: false)
    - `enabled` (boolean)
    - `host` (string)
    - `port` (number · min: 0 · max: 65353)
  - `monitoring_output_id` (string) — nullable
  - `monitoring_pprof_enabled` (boolean)
  - `name` (string · min length: 1)
  - `namespace` (string · min length: 1)
  - `overrides` (map string to object) — nullable
    Override settings that are defined in the agent policy. Input settings cannot be overridden. The override option should be used only in unusual circumstances and not as a routine procedure.
  - `package_agent_version_conditions` (object[] · max items: 1000) — nullable
    - `name` (string)
    - `title` (string)
    - `version_condition` (string)
  - `package_policies` (union anyOf)
    - **[]string**
    - **[]package_policy_response**
      - `additional_datastreams_permissions` (string[] · max items: 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 length: 1 · max length: 255) — nullable
        Transient field for cloud connector name during creation.
      - `condition` (string · max length: 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 items: 100)
      - `enabled` (boolean)
      - `global_data_tags` (object[] · max items: 100) — nullable
        - `name` (string)
          The name of the custom field. Cannot contain spaces.
        - `value` (number | string)
          The value of the custom field.
      - `id` (string)
        Package policy unique identifier.
      - `inputs` (union anyOf)
        Package policy inputs.
        - **[]{ compiled_input, enabled, streams, … }**
          - `compiled_input` (object)
          - `condition` (string · max length: 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` (object)
            - `description` (string · max length: 4096)
            - `replaced_by` (map string to string)
              Map values (string · max length: 1024)
            - `since` (string · max length: 50)
          - `enabled` (boolean)
          - `id` (string)
          - `keep_enabled` (boolean)
          - `migrate_from` (string)
          - `name` (string)
          - `policy_template` (string)
          - `streams` (object[] · max items: 1000)
            - `compiled_stream` (object)
            - `condition` (string · max length: 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 items: 100)
              - `type` (string)
            - `deprecated` (object)
              - `description` (string · max length: 4096)
              - `replaced_by` (map string to string)
                Map values (string · max length: 1024)
              - `since` (string · max length: 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.
              Map values (string · max length: 1024)
            - `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.
            Map values (string · max length: 1024)
          - `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 length: 10000) — nullable
              Agent condition expression to evaluate whether to apply this input.
            - `deprecated` (object)
              - `description` (string · max length: 4096)
              - `replaced_by` (map string to string)
                Map values (string · max length: 1024)
              - `since` (string · max length: 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 length: 10000) — nullable
                Agent condition expression to evaluate whether to apply this stream.
              - `deprecated` (object)
                - `description` (string · max length: 4096)
                - `replaced_by` (map string to string)
                  Map values (string · max length: 1024)
                - `since` (string · max length: 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.
                Map values (string · max length: 1024)
              - `vars` (map string to anyOf)
                Input/stream level variable. Refer to the integration documentation for more information.
                Map values (union anyOf · default: null)
                Any of:
                - **[]string**
                - **string**
                - **[]number**
                - **number**
                - **boolean**
                - **{ id, isSecretRef }**
                  - `id` (string · max length: 255)
                  - `isSecretRef` (boolean)
            - `vars` (map string to anyOf)
              Input/stream level variable. Refer to the integration documentation for more information.
              Map values (union anyOf · default: null)
              Any of:
              - **[]string**
              - **string**
              - **[]number**
              - **number**
              - **boolean**
              - **{ id, isSecretRef }**
                - `id` (string · max length: 255)
                - `isSecretRef` (boolean)
      - `is_managed` (boolean)
      - `name` (string)
        Unique name for the package policy.
      - `namespace` (string · max length: 100)
        The package policy namespace. Leave blank to inherit the agent policy's namespace.
      - `onboarding_deployment_id` (string · max length: 256) — nullable
        ID of the cloud onboarding instance that manages this package policy. Set by Fleet, read-only.
      - `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` (object)
        - `experimental_data_stream_features` (object[] · max items: 100)
          - `data_stream` (string · max length: 1024)
          - `features` (object)
            - `doc_value_only_numeric` (boolean)
            - `doc_value_only_other` (boolean)
            - `synthetic_source` (boolean)
            - `tsdb` (boolean)
        - `fips_compatible` (boolean)
        - `name` (string · max length: 255)
          Package name
        - `requires_root` (boolean)
        - `title` (string · max length: 255)
        - `version` (string · max length: 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 items: 1000)
      - `revision` (number)
        Package policy revision.
      - `secret_references` (object[] · max items: 1000)
        - `id` (string)
      - `spaceIds` (string[] · max items: 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.
        Map values (string · max length: 1024)
      - `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.
  - `required_versions` (object[] · max items: 100) — nullable
    - `percentage` (number · min: 0 · max: 100)
      Target percentage of agents to auto upgrade
    - `version` (string)
      Target version for automatic agent upgrade
  - `revision` (number)
  - `schema_version` (string)
  - `space_ids` (string[] · max items: 100)
  - `status` (enum)
    Values: `active`, `inactive`
  - `supports_agentless` (boolean) — nullable
    Indicates whether the agent policy supports agentless integrations.
  - `unenroll_timeout` (number · min: 0)
  - `unprivileged_agents` (number)
  - `updated_at` (string)
  - `updated_by` (string)
  - `version` (string)
#### `400`

Bad Request

`application/json`

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

Not Found

`application/json`

## Code examples

#### Console

```console
POST kbn:/api/fleet/agent_policies/_bulk_get
{
  "ids": [
    "agent-policy-id-1",
    "agent-policy-id-2"
  ]
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/agent_policies/_bulk_get" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": [
      "agent-policy-id-1",
      "agent-policy-id-2"
    ]
  }'
```

## Response examples

#### Post bulk get agent policies

`application/json`

The requested agent policies

```json
{
  "items": [
    {
      "id": "agent-policy-id-1",
      "is_managed": false,
      "is_protected": false,
      "name": "My agent policy",
      "namespace": "default",
      "revision": 1,
      "status": "active",
      "updated_at": "2024-01-15T10:00:00.000Z",
      "updated_by": "user1"
    }
  ]
}
```

#### Generic error response

`application/json`

Example of a generic error response

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

#### Not found

`application/json`

One or more agent policies were not found

```json
{
  "error": "Not Found",
  "message": "An error message describing what went wrong",
  "statusCode": 404
}
```

