Access the Wazuh API Console
Run the command, replacing the agent id
Output results should indicate number of agents deleted
"data": {
"affected_items": [
"473"
],
"total_affected_items": 1,
"total_failed_items": 0,
"failed_items": []
},
"message": "All selected agents were deleted",
"error": 0
}
Additional Reference Below
Request details:
Subject: DeleteAgent
Latest update:
Hector Vijande commented:
Hi Torrance,
This environment was recently upgraded, and you are now at version 4.0.4.
Between version 3.8 and 4.x the API had been updated with several changes to improve its functionality. Please refer to this document to have more information about these changes: Migrating from theWazuhAPI 3.X
In your case, the command that you need to use is as follows:
DELETE/agents?agents_list=004&status=ALL&pretty=true
Note that the sintaxis and the required parameters now are different. We have a detailed explanation on each available API call for 4.0.4 at this link: API Reference
In the example above, I added the parameter ‘pretty=true’ to get an easier to read output, and the output confirming the agent was properly deleted should come back like this:
"data": {
"affected_items": [
"004"
],
"total_affected_items": 1,
"total_failed_items": 0,
"failed_items": [],
"older_than": "7d"
},
"message": "All selected agents were deleted",
"error": 0
}