The API Console provides an interactive interface for testing and exploring Wazuh API endpoints directly from the dashboard. It’s accessible through the Settings page under the API section.
Accessing the API Console
Navigate to Settings > API in the Wazuh Dashboard to access the API console interface.
Navigate to Settings
Click on the Wazuh icon and select Settings from the menu
Select API Tab
Click on the API tab to view configured API connections
Open Console
Select an API host and open the console interface
Making API Requests
The console supports all standard HTTP methods used by the Wazuh API:
GET Requests
Retrieve information from the Wazuh API:
With query parameters:
GET /agents?limit= 10 &offset= 0 &sort=+id
POST Requests
Create resources or perform actions:
POST /agents
{
"name" : "new-agent" ,
"ip" : "192.168.1.100"
}
PUT Requests
Update existing resources:
PUT /agents/ 001 /group/webservers
DELETE Requests
Remove resources:
DELETE /agents?agents_list= 001 , 002 &status=never_connected
Requests in the console follow this format:
<METHOD> <PATH>
<BODY (optional)>
HTTP method: GET, POST, PUT, DELETE, PATCH
API endpoint path, starting with /. Query parameters can be included.
JSON request body for POST, PUT, and PATCH requests
The console displays responses in a formatted JSON view:
{
"data" : {
"affected_items" : [
{
"id" : "001" ,
"name" : "agent-001" ,
"status" : "active"
}
],
"total_affected_items" : 1 ,
"total_failed_items" : 0 ,
"failed_items" : []
},
"message" : "All selected agents were returned" ,
"error" : 0
}
The main response data containing affected items and metadata Array of resources affected by the request
Count of successfully processed items
Count of items that failed processing
Array of items that encountered errors
Human-readable description of the response
Error code (0 indicates success)
Common Endpoints
Here are some frequently used endpoints you can test in the console:
Agent Management
# List all agents
GET /agents
# Get specific agent details
GET /agents?agents_list= 001
# Get agent summary by status
GET /agents/summary/status
# Restart an agent
PUT /agents/ 001 /restart
# Get manager status
GET /manager/status
# Get manager configuration
GET /manager/configuration
# Get manager logs summary
GET /manager/logs/summary
Rules and Decoders
# List rules
GET /rules
# Get specific rule
GET /rules?rule_ids= 1002
# List decoders
GET /decoders
# Get decoder files
GET /decoders/files
Security Configuration Assessment
# Get SCA checks for an agent
GET /sca/ 001
# Get SCA check details
GET /sca/ 001 /checks/ 1000
Features
Auto-completion
The console provides intelligent auto-completion for:
API endpoint paths
HTTP methods
Common query parameters
Request body schemas
Request History
Access previously executed requests from the history panel:
View History
Click the history icon to view recent requests
Reuse Request
Click on a previous request to load it into the console
Clear History
Use the clear button to remove all history entries
Multi-host Support
Switch between different configured API hosts:
Select the API host from the dropdown
The console automatically uses the selected host’s credentials
All requests are sent to the selected host
Error Handling
The console displays detailed error information when requests fail:
{
"data" : {
"title" : "Permission Denied" ,
"detail" : "Permission denied: Resource type: agent:id"
},
"message" : "Permission denied" ,
"error" : 4000
}
Common Error Codes
Wazuh API error (invalid request)
Programmatic Usage
While the console is designed for interactive use, you can also make programmatic API requests:
Client-Side (Public Plugin)
import { WzRequest } from '../../react-services' ;
// GET request
const response = await WzRequest . apiReq (
'GET' ,
'/agents/summary/status' ,
{}
);
// POST request with body
const createResponse = await WzRequest . apiReq (
'POST' ,
'/agents' ,
{
name: 'new-agent' ,
ip: '192.168.1.100'
}
);
Server-Side (Server Plugin)
// In a route handler
router . post (
{
path: '/api/request' ,
validate: {
body: schema . object ({
method: schema . string (),
path: schema . string (),
body: schema . any (),
}),
},
},
async ( context , request , response ) => {
const { method , path , body } = request . body ;
const result = await context . wazuh_core . api . client . asCurrentUser . request (
method ,
path ,
body ,
{ apiHostID: 'default' }
);
return response . ok ({ body: result });
}
);
Best Practices
Use Query Parameters for Filtering
Instead of fetching all data and filtering client-side, use query parameters: # Good
GET /agents?status=active&limit= 50
# Avoid
GET /agents
For large datasets, use offset and limit: GET /agents?offset= 0 &limit= 500
GET /agents?offset= 500 &limit= 500
Verify user permissions before attempting operations:
Query specific resources instead of retrieving all: # Good
GET /agents?agents_list= 001 , 002 , 003
# Less efficient
GET /agents
Wazuh API Reference Official Wazuh API documentation
Server Routes Dashboard plugin API endpoints
Authentication API authentication methods
RBAC Role-based access control