Configuration

    Wazuh API Setup, Authentication and First Queries

    Authenticate to the Wazuh API with JWT, rotate the default password and query agents, rules and stats with curl.

    WazuGuardix Team June 16, 2026 7 min read

    The Wazuh API is a RESTful service that runs on the manager (port 55000 by default) and is the same API the dashboard uses. It supports JWT authentication and RBAC, so you can build scripts, integrations and CI/CD checks.

    1. Get a JWT token

    TOKEN=$(curl -k -u wazuh-wui:wazuh-wui -X POST "https://localhost:55000/security/user/authenticate?raw=true")
    echo $TOKEN

    2. Rotate the default password

    curl -k -X PUT -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
      "https://localhost:55000/security/users/1" \
      -d '{"password":"NewStrongP@ssw0rd!"}'

    3. List agents

    curl -k -H "Authorization: Bearer $TOKEN" "https://localhost:55000/agents?pretty=true&limit=5"

    4. Restart an agent remotely

    curl -k -X PUT -H "Authorization: Bearer $TOKEN" "https://localhost:55000/agents/001/restart"

    Note: JWT tokens expire after 900 seconds by default. Re-authenticate or extend the lifetime in /var/ossec/api/configuration/api.yaml.

    We integrate Wazuh API with Jira, ServiceNow and Slack for ticketing and notifications, contact us.

    Official reference

    Commands and configuration in this guide are based on the official Wazuh documentation. For the canonical source, see:

    Wazuh APIAutomationREST

    Need help running Wazuh in production?

    Our team designs, deploys and operates Wazuh end to end, from indexer sizing to custom rules and 24/7 SOC monitoring.