When Wazuh agent enrollment through the API fits your fleet
If your agents are built into golden images, sit in segmented networks, or are deployed by automation pipelines that cannot reach the default registration port, the API enrollment path is the option to evaluate. With it, you request a client key from the Wazuh server through its API, then import that key on the endpoint so the agent can authenticate and connect. The agent still needs what the standard registration would give it: the manager address the agent connects to, a stable agent identity, the group assignment that decides which configuration it receives, and a key that matches the server's record for that identity.
Plan around the version you run. The current Wazuh release line is 4.14, and 4.14.9 was released on 14 October 2026, so most new deployments will be on that line or a patch behind it. Confirm the exact API endpoints, request parameters and response format for your specific server version in the Wazuh documentation before you write any automation against them, because the API surface and its authentication requirements are the parts most likely to differ between releases. The Wazuh release notes list the patch releases in the 4.14 line and are the place to check what changed.
Before you choose this path, decide who holds the API credentials that can issue keys, where those credentials are stored, and how long an issued key stays valid in your build process. A golden image that carries a pre-issued key is a shared secret, so every clone of that image inherits the same identity risk. Test the full sequence on one host from a clean image, confirm the agent appears under the expected group in the dashboard, and document how a rebuilt host avoids a key conflict with its old record.
Which enrollment path fits each host type
This table compares the three ways to get a Wazuh agent registered: deployment variables at install time, enrollment over port 1515, and the API key request and import path. Read each column against your host type to see what you must hold, where the path breaks down, and what to confirm in the vendor documentation before you commit.
| Enrollment path | Best-fit host types | What the operator must hold | Where it breaks down and what to confirm |
|---|---|---|---|
| Deployment variables at install | Hosts that boot from a package install with network access to the manager, such as standard Linux, Windows and macOS fleets | The manager address, the enrollment password and the group name to pass during installation | Each host registers at first start, so cloned images can share identity; confirm the variable names and password handling for your agent version |
| Enrollment over port 1515 | Hosts that can reach the manager's enrollment service on port 1515 and where the agent registers itself after installation | Network path to port 1515, the enrollment password, and any group or certificate settings the agent needs | Blocked by firewalls that allow only the API port; confirm the enrollment password setup and the default port in the Wazuh documentation for your release |
| API key request and import | Golden images, restricted networks, and automation pipelines that cannot open port 1515 but can call the server API | API credentials with rights to request a client key, and the key file to import on each host | Keys are sensitive and must be stored and rotated carefully; confirm the key request permissions and the import steps for your agent version |
| Golden image with API keys | Images built once and deployed to many hosts that need distinct agent identities | A pipeline that requests a key per host at provisioning time and places it before the agent first starts | Reusing one key across clones causes duplicate agents; confirm how the server handles key conflicts before you automate |
| Air-gapped or segmented networks | Enclaves where the manager is reachable only through a controlled API gateway | Offline-capable installers, the API credentials and key files moved through approved channels | Package sources and key transfer may need approval; confirm the offline installation guide steps and the required manager reachability |
How a client key moves from the server to the agent
The flow starts in the build or automation job, which requests a client key from the Wazuh server API and receives it back. The job stores the key in a key store that sits on the build side of the trust boundary, then imports it onto the agent host, which crosses into the endpoint. Check that the key crosses the boundary only once, is imported under the agent's own identity, and that the agent later connects to the Wazuh server with it. Treat the key as a credential throughout.
Illustrative flow of a client key from request to agent connection, with the trust boundary marked.
How the key request and import work in practice
The enrollment sequence has four steps. First, the automation authenticates to the Wazuh server API with an account that is allowed to manage agents. Second, it requests a client key for a named agent through the API, which makes the server record that agent name and wait for a matching key. Third, the returned key is written to the host, typically to the agent's client keys file, with the permissions the agent expects. Fourth, the key is imported on the agent so it can authenticate to the manager, and the agent is started. The final step is to confirm on the server that the agent appears with the expected name and an active status, either in the dashboard or through the agents listing in the API. The exact endpoints, request payload fields, and the import command differ between releases. Confirm each call and its parameters in the Wazuh documentation for the exact version you run (the current release line is 4.14), and test the sequence on a non-production host before you script it into a golden image.
The agent name and the key are a pair. The server ties the key to the agent name it recorded when the key was issued, so an agent that presents a key under a different name, or a name that was already issued a key, will fail to authenticate or will be rejected as a conflict. This is why the name in the key request must match the hostname or identifier the agent reports at startup, and why you should plan a naming convention before the first run. When you clone a golden image, the key is the first thing to remove or regenerate, otherwise every clone claims the same identity. Treat client keys as credentials: they should be transferred over an encrypted channel, stored with restricted file permissions, kept out of logs and version control, and removed from any staging location once imported. Anyone holding a valid key can impersonate that agent, so revoke and reissue keys when a host is retired or compromised.
How the API path changes for golden images, restricted networks and automation
Golden images carry the agent package and its configuration into every clone. If the agent is registered before capture, each clone can present the same identity to the server, which causes key conflicts and misleading agent records. The API path keeps enrollment out of the image so that each clone requests its own key at first boot.
- Pre-stage the package and non-secret settings: install the agent package in the image without registering it. Stage only values that are safe to share across clones, such as the manager address and group names.
- Clear identity before capture: remove the agent's client key and any registration state so clones do not inherit an identity. Confirm the exact files and paths for your operating system version in the Wazuh documentation.
- Generate keys per host at first boot: a first-boot script requests an agent name and key from the API, then imports the key. Derive the agent name from a value that is unique per instance, such as the hostname or cloud instance ID.
- Keep API credentials out of the image: fetch a short-lived credential from your secrets store at boot and keep it out of the image and its build logs.
- Watch for duplicates after rebuilds: a clone that reuses an existing name or key can overwrite another host's record, so check the agent list after each image rollout.
Before you release an image, confirm that a test clone registers once, gets a unique agent ID, and that the base image contains no key.
Hosts in restricted networks often cannot reach port 1515 on the manager, so the default enrollment flow stalls at the network boundary. The API path lets a system that is allowed to reach the server request the key, and then the key moves to the restricted host through a channel your security team approves. The agent still needs its own communication path to the manager for events, so the change affects enrollment, not everything the agent does.
- Test each path separately: check reachability to the enrollment port, the API port and the agent communication ports from the host segment. Ask the network team for the exact rules rather than assuming them.
- Request the key from an allowed system: a management host with API access requests the key, and the key is delivered to the restricted host through an approved transfer method.
- Treat the key as a secret: transfer it over an encrypted channel, keep its lifetime in the workflow as short as practical, and log who requested it.
- Confirm the agent communication ports: the agent must still reach the manager after enrollment. Confirm the required ports for your release before cutover.
- Document the exception: record the access path, its owner and the review date so auditors can trace how the host was enrolled.
Before cutover, check that the agent reports as active in the manager and that the host has no network path beyond the one you documented.
Pipelines and configuration management tools run without a person present, often on shared runners or in containers. They need enrollment that can be repeated without prompts, and they need to avoid leaving keys in logs or artifacts. The API path lets the pipeline create the agent record and retrieve the key, then pass that key to the target host during the same run.
- Create the agent record in the pipeline: call the agents endpoint with a name taken from the target inventory, then request the key from the key endpoint for that agent.
- Keep keys out of logs and artifacts: mask the key in CI output, and avoid writing it to build artifacts, job summaries or fact caches.
- Make the step idempotent: check whether an agent with the expected name already exists before creating one, so reruns do not create duplicates or rotate keys unexpectedly.
- Scope the automation account: give the account only the permissions needed for agent registration, and rotate its credentials on a schedule your security team sets.
- Import the key on the target: import the key with the agent's management tool, then restart the agent. Confirm the commands for your operating system in the documentation.
Before you rely on the pipeline, run it twice against a test inventory and confirm that the second run creates no new agents and that the agent list matches the inventory.
Setting up API enrollment for a managed fleet
This sequence takes API enrollment from a verified server and a scoped enrollment user to a repeatable image or automation step that registers agents without port 1515. Each step ends with a check that confirms the agent is registered, connected and still connected after a reboot.
Confirm server version and API reachability
The platform engineer records the Wazuh server version in the non-production environment and confirms that the pipeline runner can reach the server API port from the network segment where builds or automation run. Confirm the exact API port, the TLS certificate chain the runner trusts and any proxy rules with your network team, since the server documentation for your release is the reference. Done means a test request from the runner returns an authenticated API response, and the version matches the release line your agents will use.
Create a least-privilege enrollment API user
The Wazuh administrator creates a dedicated API user whose only purpose is requesting agent keys, and assigns it the narrowest role that allows agent registration under the RBAC model of your release. Do not reuse the default API account or a personal administrator login. Check the role's permissions against the documentation and confirm that the account cannot change server configuration or read unrelated data. Done means the account authenticates and a call outside its permitted actions is refused.
Request a key for a non-production agent
Using the enrollment account, the engineer requests a client key for a single test agent name and group, following the agent key request described in the API reference for your release. Record the returned key only in a temporary, access-restricted location and never in shell history or build logs. Done means the request succeeds, the agent name and group in the response match the request, and the key format matches what the import step expects on the test host.
Decide key storage and rotation
The security and platform leads agree where keys live (for example, a secrets manager your organization already operates), who can read them, how long a key stays valid and how it is replaced when a host is rebuilt or a key may be exposed. Keys act as credentials for an agent identity, so treat them like other service secrets. Confirm with your security team how these records fit your access and logging policies. Done means a written note names the store, the access group, the rotation trigger and the removal step for unused keys.
Import the key on a test host
The engineer places the key on a clean test host in the location the agent reads at startup, sets restrictive file ownership and permissions, then starts or restarts the agent service with the manager address and group defined in your configuration. Avoid logging the key during import. Done means the agent service runs without configuration errors in its own log and no port 1515 enrollment was attempted.
Confirm the agent connects and appears
On the server, the administrator checks the agent list and confirms that the test host appears with the expected name, group and an active connection state. Then the engineer reboots the test host and confirms the agent reconnects automatically without a new key request. Done means the agent is listed as active before and after the reboot, and the server log shows no duplicate registration for that host name.
Wire enrollment into the image build or automation
The platform team adds the key retrieval and import steps to the golden image pipeline or configuration management run, with the key injected at deploy time rather than baked into the image. Each cloned host must receive its own unique agent identity, so the build should not ship an enrolled agent state. Run the pipeline against a disposable test host, then confirm that the new host appears once in the agent list and that a second run with the same name is handled as your removal and key rules describe. Done means a repeatable run produces one connected agent per host with no secrets stored in artifacts.
Protecting keys, API credentials and the enrollment path
Requesting agent keys through the server API moves a trust decision out of the port 1515 enrollment flow and into an API account. The cards below cover the controls that keep that path from becoming a way to register rogue agents, and each one is something to confirm in your own environment before the first golden image is built.
Scope the key-request account
Anyone or anything that can call the key endpoint can register an agent, so the account used for key requests should be a dedicated API user with only the permissions that operation needs. Confirm in your Wazuh version which API roles can request keys, and keep those roles away from dashboard administration. Record who owns the account and which automation uses it.
Wazuh SSO docsKeep keys out of golden images
A client key written into a base image is copied to every machine cloned from it, so those hosts share an identity. Request keys at provisioning time, import them into the agent, and make sure the image build pipeline never stores them. Check the agent key file permissions and confirm that a cloned host regenerates or re-requests its key on first boot.
Expose the API only where needed
The server API should be reachable from the build and provisioning networks and not from the open internet. Terminate TLS with certificates your team controls, restrict the listening interface and source addresses with firewall rules, and confirm that the API port is not published through a load balancer by accident. Test the restriction from outside the allowed networks.
Log and review key requests
Every key request should leave a trace that ties it to an account, a source address and a time. Forward API authentication and agent registration events to your log pipeline, and review requests for agent names that do not match your naming standard or for bursts from unexpected hosts. Ask your team which alert or report will surface a request that nobody initiated.
Rotate and revoke after rebuilds
When a host is rebuilt, retired or suspected of compromise, its old key and agent record should stop being valid. Define who removes the stale agent entry, how a replacement key is issued, and how long a disconnected identity may remain in the agent list. Plan rotation of the API account credentials on a fixed schedule and after any staff change.
Separate enrollment and dashboard access
The account that requests agent keys should never be the same as a human administrator account in the dashboard, and neither should be shared. Keep the enrollment account narrow, store its credentials in a secrets manager, and keep dashboard administrators on named accounts with multi-factor sign-in where your identity provider allows it. Hardening the full set of these settings is a separate task, and it is worth scheduling as its own work item.
Keeping agent keys and records clean after rollout
Once enrollment runs through the server API, the recurring work is keeping a record of which key went to which host. Each key you request is tied to an agent name and, usually, an IP address that the server holds in its agent list. Store the issued keys in your secrets system with the host identifier, the agent name, the group and the date of issue, so that when a host is rebuilt or a key is lost you can tell whether an existing registration is still valid or should be replaced. Do not treat the agent list on the server as the only record, because a rebuilt host that re-registers under the same name can quietly take over an identity that was meant for a retired machine. Confirm in your environment how your server version handles a duplicate name or a key request for an agent that already exists before you write this into your runbook.
Reimaging is where duplicate and conflicting records usually start. A cloned or rebuilt host can keep the agent identity from the golden image, so two machines report under one ID, or a new host reuses a name still listed as connected from the old one. Build the rebuild path so the old agent is removed or deregistered before a new key is imported, and make re-enrollment after reimaging a checklist step rather than something engineers remember. Check disconnected and decommissioned agents on a fixed schedule, and confirm with your team which status means a host is gone and which means it is temporarily offline. Removal and cleanup procedures, including finding long-disconnected agents, are covered in the sibling topic on removing and cleaning up Wazuh agents.
Retest the enrollment process after every Wazuh upgrade, not only after the first rollout. The 4.14 line shipped patch releases on 17 March, 23 April, 1 July, 29 July, 23 September and 14 October 2026, roughly one every one to two months, so a change to the API, the key format or the enrollment defaults can arrive during normal maintenance. Keep a short test that requests a key, imports it on a test agent, confirms the agent connects under the expected group and then removes it. Run it on a non-production agent before each server or agent upgrade, and record the version tested. Review the Wazuh release notes for each patch before you schedule the upgrade window.
What to confirm in your environment before relying on the API path
The API enrollment path depends on details that vary by Wazuh version, agent build, identity model and server layout. Treat each item below as a question to answer with the vendor documentation or a test in a non-production environment before golden images or automation depend on it.
Exact API calls and key format
Confirm the endpoint, request method, authentication flow and the structure of the returned client key for the Wazuh server version you run. Key format and import steps are version-specific, so copy them from the documentation for your exact release line rather than from older scripts or blog posts. Run one full request and import cycle on a lab agent and record the output your pipeline will parse.
Wazuh release notesAgent and operating system support
Check that every agent version and operating system in your fleet supports the key import method you plan to use. Older agents or less common platforms may need a different enrollment route, so list each build in your inventory and test it. Include the Unix platforms in scope, since their install tooling can differ from Linux and Windows.
API user permissions
Decide which account makes key requests and confirm the minimum role it needs in the Wazuh API. Your security team will likely ask whether the account can read or change more than enrollment, how its credentials are stored, and whether its activity is logged. Test that the account fails cleanly when the role is reduced, and document who can rotate its password.
State after golden image cloning
Clone a prepared image to two hosts and observe how each enrolls, which identifiers it reports and whether one host overwrites the other. Duplicate keys or stored agent state copied with the image can cause conflicts that appear only after the clone boots. Confirm the cleanup steps your image pipeline must run before capture and after first boot.
Key handling in your change process
Define where imported keys live, who can read them, how long they remain valid and how they are removed when a host is retired. Keys should be treated as credentials and kept out of logs, tickets and shared repositories. Ask your change board to approve the storage location and the rotation trigger before the first production run.
Server topology and API reach
Confirm whether your Wazuh server runs as a single node or as a cluster, and which address the API answers on for agents in each network zone. In a cluster, the node that receives the request and the path agents use can differ, which changes firewall rules and load balancer configuration. Map the route from each restricted network to the API before you write automation against it.
Wazuh componentsQuestions teams ask before enrolling agents through the API
What drives the cost of building API enrollment in-house versus with a partner?
The main cost is skilled engineering time. Building the path is a one-time effort, while operating it, testing upgrades and handling keys is recurring. In-house, your team pays for server API access design, scripting, integration with your image pipeline, testing on each operating system you run, and documentation. A partner's fee follows from a written scope, so compare the same variables on both sides: the number of operating system families and image variants, whether target networks are restricted, how many change approvals are needed, and who maintains the enrollment scripts after handover. Ask any quote to separate the one-time build from ongoing support and upgrade testing, and to state which tasks remain with your team. DeployOpen does not publish a price list.
How long does an API enrollment build usually take?
No standard duration applies, because the schedule depends on scope and on your environment. The biggest drivers are the number of platforms, since Wazuh agents run on Linux, Windows, macOS, Solaris, AIX and HP-UX, and each family needs its own tested path. Other drivers include how many golden images or templates feed the process, how restricted the target networks are, how long change approval takes, and how large the test fleet must be before production use. Teams often underestimate the time spent on approvals and image rebuilds. Ask for a timeline tied to named milestones and a list of client dependencies in the written scope, so any delay can be traced to a specific party.
What do we need to provide for an API enrollment build?
Most engagements need administrative access, a test fleet, a change approver and access to the image pipeline. Plan for these items before work starts:
- Administrative access to the Wazuh server and its API, first in a non-production environment and then in production under change control.
- A test fleet that covers each operating system and image you plan to enroll, including at least one restricted network segment.
- Access to the golden image or template pipeline, so the enrollment step can be built and tested where it will run.
- A named change approver and an agreed window for production changes.
- Named owners for the server, the image pipeline and the agent group policy after handover.
Missing any of these usually pushes testing into production, so settle them in the written scope.
Can our team build API enrollment from the Wazuh documentation alone?
Yes, a team with Linux administration and automation skills can build it from the documentation, but the work involves more than running a command. The documentation covers deployment options, including Ansible and Puppet, which many teams use to standardize installs. It cannot settle how the API path fits your images, approval process, secrets storage and network policy. Plan for your team to test enrollment on each platform, record which steps are repeatable, and check each step against the version you run. If internal capacity is limited, a partner can build the path and hand over scripts and runbooks, so your team can operate them afterward.
How does rotating enrollment keys affect agents already running?
Confirm how rotation behaves in the documentation for your release before you rotate, because key handling is version-specific and it determines which agents need re-enrollment. Test the sequence on a non-production group first: rotate the key, enroll a fresh test host, confirm it reports to the server, and confirm that an existing agent keeps reporting. Record which agents would need re-enrollment, schedule them in batches, and document a rollback path. Ask any partner to provide the rotation runbook with its rollback steps, and to name who approves each production batch.
Does enrolling agents through the API replace port 1515 registration?
The API method does not have to replace port 1515 registration. It is an alternative path for cases where a golden image, restricted network or automation job cannot use port 1515, or where keys must be requested from the server API in a controlled step. Many environments keep both: standard registration for hosts that can reach port 1515 and API-issued keys for the exceptions. Confirm which ports remain required for agent-to-server communication after enrollment in your release, because enrollment reachability and ongoing reporting are separate requirements. Document which path each host type uses, so audits and troubleshooting can trace how every agent was enrolled.
What changes for agent enrollment after a Wazuh upgrade?
Expect to retest the enrollment path after each upgrade, because the server, agent versions and key handling can change. The current Wazuh release line is 4.14, and its patch releases shipped on 17 March, 23 April, 1 July, 29 July, 23 September and 14 October 2026, so changes arrive often. Before each upgrade, read the Wazuh release notes for enrollment, API and agent changes. Update the staging fleet first, run the full enrollment test on each operating system family, and confirm that agent versions in your image pipeline are supported by the server version you run.
How DeployOpen works on this
DeployOpen scopes enrollment through the Wazuh server API as a written, fixed-scope piece of work covering the key request flow, import method, restricted network paths and automation hooks in your environment. We build and test the flow against a representative sample of hosts before rollout, then hand over documentation and runbooks your team can operate.
How we scope
- Inventory which images, networks and automation tools need enrollment without port 1515 access.
- Agree in writing which operating systems, agent versions and Wazuh server nodes the work covers.
- Confirm who requests and stores API credentials, and how key import will be automated and audited.
How we build
- Build the key request and import sequence for your golden images and provisioning pipelines.
- Test enrollment on a sample of hosts, including a rebuilt host that reuses a previous agent name.
- Verify that agents appear under the intended groups and report active status on the server.
How we hand over
- Deliver the enrollment runbook, API call examples and the configuration used in your environment.
- Document the credential handling, key storage and access controls agreed during the scope phase.
- Walk your operations and security staff through troubleshooting steps and the rollback path.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after handover.
- Review enrollment changes when Wazuh releases new agent or server versions in your environment.
- Retest the enrollment path after infrastructure changes such as new networks or image updates.

