> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Agents

Get a list of agents.

<Note>
  External Documentation

  To learn more, visit the [Wazuh Server documentation](https://documentation.wazuh.com/current/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agents).
</Note>

## Basic Parameters

<div className="integrations-table">
  | Parameter         | Description                                                                                                                                                                                                                  |
  | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Agent IDs         | A comma-separated list, without any whitespace before or after the commas, of agents IDs to return.                                                                                                                          |
  | Distinct          | Select to look for distinct values.                                                                                                                                                                                          |
  | Fields            | A comma-separated list, without any whitespace before or after the commas, of fields to return.<br /><br />**Note:** Use '.' for nested fields, for example: `field1 , field2.nestedField1, field3`                          |
  | Limit             | Maximum number of elements to return.                                                                                                                                                                                        |
  | Name              | Filter by the name of the agent.                                                                                                                                                                                             |
  | Offset            | The offset of the first element to return.                                                                                                                                                                                   |
  | Pretty            | Select to show results in human-readable format.                                                                                                                                                                             |
  | Query             | A query to filter the results by. <br /><br />**For example**: `status=active`                                                                                                                                               |
  | Return All Pages  | Automatically fetch all resources, page by page.                                                                                                                                                                             |
  | Search Text       | A string used to filter elements containing the specified text.<br /><br />**Note:** To obtain a complementary search, use `-` at the beginning.                                                                             |
  | Sort              | A comma-separated list, without any whitespace before or after the commas, of fields to sort by. Use `+`/`-` at the beginning to list in ascending or descending order. Use `.` for nested fields.                           |
  | Status            | A comma-separated list, without any whitespace before or after the commas, of statuses to filter the agents by.<br /><br />Options:<br />- **active**<br />- **pending**<br />- **never\_connected**<br />- **disconnected** |
  | Wait For Complete | Select to disable timeout response.                                                                                                                                                                                          |
</div>

## Advanced Parameters

<div className="integrations-table">
  | Parameter           | Description                                                                                                                                                                                                                                        |
  | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Agent Register IP   | Filter by the IP used when registering the agent.                                                                                                                                                                                                  |
  | Group               | Filter by the group of the agent.                                                                                                                                                                                                                  |
  | Group Config Status | Filter by the agent's group configure status.                                                                                                                                                                                                      |
  | IP                  | Filter by the IP used by the agent to communicate with the manager.<br /><br />**Note:** If it's not available, it will have the same value as `Register IP`.                                                                                      |
  | Manager             | Filter by manager hostname to which the agents are connected to.                                                                                                                                                                                   |
  | Node Name           | Filter by the node name.                                                                                                                                                                                                                           |
  | OS Name             | Filter by the OS (Operating System) name of the agent.                                                                                                                                                                                             |
  | OS Platform         | Filter by the OS (Operating System) platform of the agent.                                                                                                                                                                                         |
  | OS Version          | Filter by the OS (Operating System) version of the agent.                                                                                                                                                                                          |
  | Older Than          | Filter agents based on the time elapsed since their last keep-alive signal. You can specify the time using seconds (s), minutes (m), hours (h), or days (d). <br /><br />**For example:** `7d`, `10s`, or simply `10` (which defaults to seconds). |
  | Version             | Filter by agents version using one of the following formats: `X.Y.Z`, `vX.Y.Z`, `wazuh X.Y.Z` or `wazuh vX.Y.Z`. <br /><br />**For example:** `4.4.0`                                                                                              |
</div>

## Example Output

```json theme={"dark"}
{
	"data": {
		"affected_items": [
			{
				"os": {
					"arch": "x86_64",
					"codename": "Focal Fossa",
					"major": "20",
					"minor": "04",
					"name": "Ubuntu",
					"platform": "ubuntu",
					"uname": "Linux |ac7cb188d538 |5.8.0-45-generic |#51~20.04.1-Ubuntu SMP Tue Feb 23 13:46:31 UTC 2021 |x86_64",
					"version": "20.04.2 LTS"
				},
				"lastKeepAlive": "2021-05-26T12:40:40Z",
				"id": "001",
				"dateAdd": "2021-05-26T12:40:08.000Z",
				"configSum": "ab73af41699f13fdd81903b5f23d8d00",
				"manager": "wazuh-worker2",
				"group": [
					"default"
				],
				"registerIP": "any",
				"ip": "172.25.0.6",
				"name": "ac7cb188d538",
				"status": "active",
				"mergedSum": "9a016508cea1e997ab8569f5cfab30f5",
				"version": "Wazuh v4.3.0",
				"node_name": "worker2",
				"group_config_status": "synced",
				"status_code": 0
			},
			{
				"os": {
					"arch": "x86_64",
					"codename": "Focal Fossa",
					"major": "20",
					"minor": "04",
					"name": "Ubuntu",
					"platform": "ubuntu",
					"uname": "Linux |ac7cb188d538 |5.8.0-45-generic |#51~20.04.1-Ubuntu SMP Tue Feb 23 13:46:31 UTC 2021 |x86_64",
					"version": "20.04.2 LTS"
				},
				"lastKeepAlive": "2021-05-26T12:40:40Z",
				"id": "002",
				"dateAdd": "2021-05-26T12:40:10.000Z",
				"configSum": "ab73af41699f13fdd81903b5f23d8d00",
				"manager": "wazuh-worker2",
				"group": [
					"default"
				],
				"registerIP": "any",
				"ip": "172.25.0.11",
				"name": "91642a418627",
				"status": "active",
				"mergedSum": "9a016508cea1e997ab8569f5cfab30f5",
				"version": "Wazuh v4.3.0",
				"node_name": "worker2",
				"group_config_status": "synced",
				"status_code": 0
			},
			{
				"os": {
					"arch": "x86_64",
					"codename": "Focal Fossa",
					"major": "20",
					"minor": "04",
					"name": "Ubuntu",
					"platform": "ubuntu",
					"uname": "Linux |ac7cb188d538 |5.8.0-45-generic |#51~20.04.1-Ubuntu SMP Tue Feb 23 13:46:31 UTC 2021 |x86_64",
					"version": "20.04.2 LTS"
				},
				"lastKeepAlive": "2021-05-26T12:40:40Z",
				"id": "003",
				"dateAdd": "2021-05-26T12:40:10.000Z",
				"configSum": "ab73af41699f13fdd81903b5f23d8d00",
				"manager": "wazuh-worker2",
				"group": [
					"default"
				],
				"registerIP": "any",
				"ip": "172.25.0.10",
				"name": "a442e15bc84e",
				"status": "active",
				"mergedSum": "9a016508cea1e997ab8569f5cfab30f5",
				"version": "Wazuh v4.3.0",
				"node_name": "worker1",
				"group_config_status": "not synced",
				"status_code": 0
			}
		],
		"total_affected_items": 3,
		"total_failed_items": 0,
		"failed_items": []
	},
	"message": "All selected agents information was returned",
	"error": 0
}
```

## Workflow Library Example

[List Agents with Wazuh Server and Send Results Via Email](https://library.blinkops.com/workflows/list-agents-with-wazuh-server-and-send-results-via-email)

<div className="iframe-wrapper">
  <div className="iframe-media">
    <img src="https://mintcdn.com/blinkops-2/ojHYuDeYX5FWuN8a/img/Icons/play-box.svg?fit=max&auto=format&n=ojHYuDeYX5FWuN8a&q=85&s=b8af968e71438a9499c3223c9bd29fb2" alt="Workflow Library" width="16" height="16" data-path="img/Icons/play-box.svg" />

    Preview this Workflow on desktop
  </div>

  <iframe className="iframe" src="https://library.blinkops.com/workflows/list-agents-with-wazuh-server-and-send-results-via-email/canvas" />
</div>
