---
title: "List all Datadog Agents"
method: GET
path: "/api/v2/fleet/agents"
tags: ["Fleet Automation"]
---

# List all Datadog Agents

`GET /api/v2/fleet/agents`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/fleet/agents`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token`
- TypeScript: <https://skmtc.dev/datadog/apis/datadog-api-v2-collection/docs/api/v2/fleet/agents/get.ts> (a function with typed inputs; its response is checked against the schema)

Retrieve a paginated list of Datadog Agents.

Returns agents with support for pagination, sorting, and filtering.
Use `page_number` and `page_size` to navigate pages, `filter` to narrow by field values,
and `tags` to filter by agent tags.

## Query parameters

- `page_number` integer
- `page_size` integer
- `filter` string
- `tags` string
- `sort_attribute` string
- `sort_descending` boolean

## Response `200`

OK

- FleetAgentsV2Response: Response containing a paginated list of Datadog Agents.
  - `data` FleetAgentV2[], required: Array of agents matching the query criteria.
    - `attributes` FleetAgentV2Attributes, required: Attributes of a Datadog Agent in the v2 list response.
      - `agent_version` string: The Datadog Agent version.
      - `api_key_name` string: The name of the API key used by the agent, if available and not redacted.
      - `api_key_uuid` string: The UUID of the API key used by the agent.
      - `cloud_provider` string: The cloud provider where the agent is running.
      - `cluster_name` string: The Kubernetes cluster name, if the agent runs in a cluster.
      - `datadog_data_center` string: The Datadog data center the agent reports to.
      - `ecs_fargate_cluster_name` string: The ECS Fargate cluster name, if the agent runs in an ECS Fargate environment.
      - `ecs_fargate_task_arn` string: The ECS Fargate task ARN, if the agent runs in an ECS Fargate environment.
      - `enabled_products` string[]: Datadog products enabled on the agent.
      - `env` string[]: Environments the agent is reporting from.
      - `first_seen_at` integer: Unix timestamp when the agent was first seen.
      - `fleet_policies` string[]: Identifiers of fleet policies applied to the agent.
      - `hostname` string: The hostname of the agent.
      - `instrumentation_error_counts` integer: Number of instrumentation errors on the agent. Absent from the response when the count is zero.
      - `instrumentation_status` 'success' | 'failure': The single-step instrumentation status of the Agent.
      - `integrations` string[]: Names of integrations configured on the agent.
      - `ip_addresses` string[]: IP addresses of the agent host.
      - `is_single_step_instrumentation_enabled` boolean: Whether single-step instrumentation is enabled on the agent.
      - `last_restart_at` integer: Unix timestamp of the last agent restart.
      - `os` string: The operating system of the host.
      - `otel_collector_deployment_types` string[]: OpenTelemetry collector deployment types associated with the agent.
      - `otel_collector_distributions` string[]: OpenTelemetry collector distributions associated with the agent.
      - `otel_collector_versions` string[]: All OpenTelemetry collector versions associated with the agent.
      - `otel_resource_attributes` string[]: OpenTelemetry resource attributes reported by the agent.
      - `pod_name` string: The Kubernetes pod name, if the agent runs as a pod.
      - `remote_agent_management` string: The remote agent management status.
      - `remote_config_status` string: The remote configuration connection status of the agent.
      - `services` string[]: Services running on the agent.
      - `tags` FleetAgentAttributesTagsItems[]: Tags associated with the agent. Returned as an empty array when the agent has no tags.
        - `key` string: The tag key.
        - `value` string: The tag value.
      - `team` string: The team associated with the agent.
    - `id` string, required: The unique agent key identifier.
    - `type` 'agent', required: The type of the agent resource.
  - `meta` FleetAgentsV2ResponseMeta: Metadata for the v2 list of agents, including pagination information.
    - `page` FleetAgentsV2Page: Pagination details for the v2 list of agents.
      - `total_count` integer: Total number of agents in the fleet, regardless of any filter.
      - `total_filtered_count` integer: Total number of agents matching the current filter criteria.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/3f70db624329?raw)
