REST API
NetXMS provides a REST API for programmatic access to the monitoring system.
The API is served directly from the netxmsd process; resource endpoint paths start with /v1/.
It is the primary integration API and is used by the Grafana data source plugin.
All API endpoints use JSON for request and response bodies.
The standalone WebAPI service (nxapisrv) used with older NetXMS versions is deprecated and has been removed; use the built-in web API described on this page.
|
Built-in Web API
Enabling the API
The HTTP listener, request routing, and the authentication endpoints (/, /v1/login, /v1/logout, /v1/ha/status) are part of the server core and are active by default (Enable defaults to true).
Loading the webapi server module adds the resource endpoints (/v1/objects, /v1/alarms, …).
To load the module, add it to netxmsd.conf and restart the server:
Module = webapi
The API listener is configured in the [WEBAPI] section of netxmsd.conf:
| Parameter | Default | Description |
|---|---|---|
|
|
Enable or disable the API listener |
|
loopback |
Address the HTTP listener binds to: |
|
|
HTTP listener port |
|
|
Number of threads serving HTTP requests |
|
|
Enable the TLS listener |
|
|
Address the TLS listener binds to |
|
|
TLS listener port |
|
Path to the TLS certificate file |
|
|
Path to the TLS certificate key file |
|
|
Path to the |
By default the HTTP listener accepts connections on the loopback interface only.
For remote clients, set Address in the [WEBAPI] section to any, *, or an explicit IP address.
|
The listener itself serves plain HTTP.
The TLS listener is terminated by an external reproxy process started by the server: it is bundled with the server on Windows, while on Linux reproxy must be installed separately.
Alternatively, place a TLS-offloading reverse proxy (nginx, Caddy, Traefik, etc.) in front of the HTTP port.
The base URL for API calls is:
http://<server>:8000/v1/
Authentication
Login
Obtain an authentication token by sending credentials to the login endpoint:
curl -X POST http://server:8000/v1/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "netxms"}'
On success, the server responds with status 201 and a token:
{
"token": "...",
"userId": 1,
"fullName": "...",
"systemAccessRights": 576460752303423487,
"changePassword": false,
"graceLogins": 0
}
Login tokens are ephemeral: each use extends the token’s validity by up to 4 hours, up to the absolute lifetime limit set by the WebAPI.AuthTokenMaxLifetime server configuration variable (24 hours by default).
When less than WebAPI.AuthTokenWarningThreshold seconds (1 hour by default) remain before that limit, responses carry the X-Token-Expires-In header (remaining seconds) and X-Token-Refresh-Recommended: true.
Use the token in the Authorization header of subsequent requests:
curl http://server:8000/v1/objects \
-H "Authorization: Bearer <token>"
To end the session, invalidate the token:
curl -X POST http://server:8000/v1/logout \
-H "Authorization: Bearer <token>"
Persistent Tokens
For long-lived integrations, issue a persistent token instead of logging in with credentials:
-
In the management client, navigate to Configuration > Users and groups, right-click the user, and select Issue authentication token…. The dialog lets you set the expiration time and a description.
-
Programmatically,
POST /v1/users/{user-id}/tokenswith a body containingvalidFor(seconds, required),persistent(defaulttrue),singleUse(allowed only together with"persistent": false), anddescription(up to 127 characters) fields. The expiration time of persistent tokens is capped at 2038-01-19. The token value is returned only in the response to this request;GET /v1/users/{user-id}/tokenslists tokens without their values.
Tokens are issued per user and are not scoped: a token grants the same access as the user account it was issued for. Create a dedicated account with minimal permissions for each integration.
Objects
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List all objects accessible to the authenticated user |
POST |
|
Create a new object |
GET |
|
Get details of a specific object |
PATCH |
|
Update common object properties |
DELETE |
|
Delete an object (asynchronous; 204 means the deletion was accepted) |
POST |
|
Get details of up to 500 objects in one request (body: |
POST |
|
Execute an object query |
POST |
|
Search objects by name, address, and other criteria |
For nodes, PATCH accepts primaryName (DNS name or IP address); the primary IP address is derived from it by the configuration poll that the change schedules, and the request fails with 409 if the resolved address is already used by another node or subnet.
Object documents include effectiveRights: the caller’s access rights on the object, one boolean attribute per right (for example, read, modify, executeScript).
Object queries use NXSL object query scripts, the same as in the management client:
curl -X POST http://server:8000/v1/objects/query \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"query": "type == NODE"}'
Optional body fields include rootObjectId (limit the query to a subtree), fields (additional object attributes to return), orderBy, and limit.
Alarms
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List active alarms (optional |
GET |
|
Get details of a specific alarm |
POST |
|
Acknowledge an alarm |
POST |
|
Resolve an alarm |
POST |
|
Terminate an alarm |
GET |
|
List comments of an alarm |
POST |
|
Add a comment to an alarm |
GET |
|
List events correlated to an alarm |
Alarm state change operations return status 204 on success.
Incidents
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List incidents |
POST |
|
Create an incident |
GET |
|
Get details of a specific incident |
PUT |
|
Update an incident |
POST |
|
Change incident state |
POST |
|
Assign an incident to a user |
POST |
|
Add a comment to an incident |
POST |
|
Link an alarm to an incident |
DELETE |
|
Unlink an alarm from an incident |
GET |
|
Get incident activity log |
Data Collection
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List DCIs configured on an object |
POST |
|
Create a DCI |
GET, PATCH, DELETE |
|
Get, update, or delete a DCI |
GET |
|
Get current values of all DCIs on an object |
POST |
|
Get current values of up to 500 DCIs on any objects in one request. Body: |
GET |
|
Get historical values of a DCI |
GET |
|
Get the last collected value of a table DCI |
GET |
|
Get DCIs shown in the object’s performance view |
GET |
|
List available agent metrics, tables, and lists Since 7.0.3 |
GET |
|
List available device-driver metrics Since 7.0.3 |
DCI configuration JSON uses relatedObject for the related object ID. It is returned when reading configuration and can be supplied when creating or updating a DCI. Since 7.0.3
The available-metrics endpoints require Read access to the object. The agent response contains metrics, tables, and lists arrays; the device-driver response contains a metrics array. Since 7.0.3
Current values report the DCI origin, data type, status, and type, and the severity of an active threshold, by name rather than by numeric code, for example "origin": "agent", "dataType": "int32", "status": "active", "type": "item". Since 7.0.2
Query parameters for historical data:
-
timeFrom— start time (Unix timestamp in seconds, ISO 8601 timestamp, relative offset such as-1d, ornow) -
timeTo— end time (same formats astimeFrom) -
maxRows— maximum number of data points to return -
maxDataPoints— when set, the server aggregates the response down to at most this many data points -
tier— storage tier to read from:auto(default),raw,hourly, ordaily -
function— aggregation function to apply when data is aggregated -
historicalDataType— type of historical data (0=processed, default; 1=raw; 2=raw and processed; 3=full table)
curl "http://server:8000/v1/objects/100/data-collection/200/history?timeFrom=1740000000&timeTo=1740086400&maxRows=1000" \
-H "Authorization: Bearer <token>"
Summary Tables
| Method | Endpoint | Description |
|---|---|---|
GET, POST |
|
List summary tables or create a new one |
GET, PUT, DELETE |
|
Get, update, or delete a summary table definition |
POST |
|
Query a configured DCI summary table. Body: |
POST |
|
Execute an ad-hoc summary table query from a table definition supplied in the request body |
Log Queries
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List available server logs |
GET |
|
Get details of a specific log |
POST |
|
Query a log using filter definitions |
POST |
|
Query a log using an SQL fragment |
GET |
|
Get a specific log record |
Server Information
| Method | Endpoint | Description |
|---|---|---|
GET |
|
Get server version, build, and configuration details |
GET |
|
Status of the current session: user ID, login name, and system access rights. Also full name, GUID, description, email address, phone number, and effective UI access rules Since 7.0.2 |
GET |
|
HA status; requires no authentication and works on a standby server |
Command Execution
| Method | Endpoint | Description |
|---|---|---|
POST |
|
Execute an agent action on a node |
POST |
|
Execute an NXSL script on an object |
POST |
|
Execute a dashboard script on an object |
POST |
|
Expand macros in text in the context of an object |
POST |
|
Start a remote control (VNC) session to a node |
POST |
|
Enter or leave maintenance mode |
POST |
|
Set object managed or unmanaged state |
POST |
|
Send wake-on-LAN to a node or interface (requires Control access right) |
GET |
|
Take a screenshot on a node via the agent (returns a PNG image) |
Interactive SSH Terminal
Open a terminal with POST /v1/objects/{id}/ssh-terminal, then connect a WebSocket to the returned wsUrl (/v1/ssh-terminal/{token}). Since 7.0.3
The POST requires the Initiate TCP proxy sessions system access right and Control access to the node. The selected SSH proxy agent must provide ssh.nsm.
The JSON body requires columns and rows (each 1 to 1024), with optional terminalType. Omit login to use the node’s stored login, password, and SSH key; when login is supplied, optional password and keyId override those credentials.
The response includes token, wsUrl, and expiresIn. The one-use WebSocket token expires after 30 seconds; the WebSocket URL authenticates with that token. Send terminal input as binary frames; output also arrives as binary frames. Resize with a text frame containing {"type":"resize","columns":120,"rows":40}.
Events and Pushed Data
| Method | Endpoint | Description |
|---|---|---|
POST |
|
Send an event, identified by |
POST |
|
Push values to DCIs with Push origin. Body is an array of elements with |
Data Export
DCI history can be exported as a ZIP archive (metrics.csv, data.csv, manifest.json) for external analysis.
The export runs as a background task, can optionally replace object names and metric identifiers with pseudonyms, and is recorded in the audit log.
metrics.csv also includes delta_method (original, simple, average_per_second, or average_per_minute), transformation (whether a transformation script is configured), and the owner’s time_zone and time_zone_rule when available. Since 7.0.3
manifest.json records a SHA-256 digest for each CSV file under files.metrics.sha256 and files.data.sha256, so a consumer can verify the extracted files. Since 7.0.3
| Method | Endpoint | Description |
|---|---|---|
POST |
|
Start an export of DCIs selected by system tag patterns under a root object or by an explicit DCI list; returns |
POST |
|
Preview which metrics an export request would select, without running it |
GET |
|
Get export progress and state (only for the user who started the export) |
GET |
|
Download the archive ( |
Network Data
| Method | Endpoint | Description |
|---|---|---|
GET |
|
ARP cache of a node |
GET |
|
Routing table of a node |
GET |
|
Switch forwarding database (FDB) of a node |
GET |
|
Layer 2, IP, OSPF, or internal communication topology of a node |
GET |
|
MAC address connection history (see Topology) |
GET |
|
Radio interfaces of a node, access point, or wireless domain Since 7.0.2 |
GET |
|
Wireless stations of a node, access point, or wireless domain Since 7.0.2 |
Device Configuration Backup
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List configuration backups of a node |
GET |
|
Get one configuration backup |
POST |
|
Start configuration restore; runs as a background task |
GET |
|
Status of a background task (for example, a configuration restore) |
AI Messages
AI messages and approval requests can be accessed through the API. Since 7.0.3
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List messages addressed to the authenticated user; optional |
GET |
|
Get a message addressed to the authenticated user |
PUT |
|
Set |
DELETE |
|
Delete a message; requires its initiator or a user with Manage AI tasks rights |
The type filter accepts informational, alert, and approvalRequest; status accepts pending, read, approved, and rejected. Approval and rejection apply to approval requests only. Expired messages return 404; an operation that does not apply to the message returns 409.
User and Group Creation
POST /v1/users and POST /v1/user-groups apply the supplied properties when creating the account or group, rather than only its name. Since 7.0.3 They accept the same configurable properties as the corresponding PUT /v1/users/{id} or PUT /v1/user-groups/{id} operation; the caller needs the Manage users system access right.
SSH Key Import
POST /v1/ssh-keys imports a key when its JSON body contains name and privateKey; the server derives the public key from an unencrypted OpenSSH private key. Without privateKey, it generates a key pair. PUT /v1/ssh-keys/{id} without privateKey renames the key and keeps its key pair. The server ignores publicKey in requests. Invalid names or private keys return 400; updating an unknown key returns 404. Creating or changing keys requires the Manage SSH keys system access right. See SSH Key Management.
Server Configuration
| Method | Endpoint | Description |
|---|---|---|
GET |
|
List server configuration variables (requires the Edit server configuration variables system access right; hidden variables are never returned) |
GET, PUT, DELETE |
|
Get, set, or delete a server configuration variable |
POST |
|
Reset a server configuration variable to its default value |
The tables on this page list commonly used endpoints.
The complete API — including AI assistant, user, event processing policy, notification channel, script library, asset management, and device configuration backup endpoints — is described by the OpenAPI specification in the source repository: src/server/webapi/openapi.yaml.
Error Handling
The API returns standard HTTP status codes:
| Code | Description |
|---|---|
200 |
Success |
201 |
Resource created |
204 |
Success, no response body |
400 |
Bad request (invalid parameters) |
401 |
Authentication required or token expired |
403 |
Access denied (insufficient permissions) |
404 |
Resource not found |
409 |
Conflict (for example, a name or address is already in use) |
415 |
Unsupported media type (a POST, PUT, or PATCH request with a body must use |
426 |
Upgrade required (WebSocket endpoints) |
500 |
Internal server error |
503 |
Service unavailable (returned for most routes on a standby server in an HA setup, and by AI chat endpoints when the AI assistant is not initialized) |
Error responses include a JSON body with the failure reason:
{
"reason": "Access denied"
}
Failed login attempts may additionally return an errorCode field with details on the failure reason.
Usage Examples
Python — Acknowledge All Critical Alarms
import requests
BASE = "http://server:8000/v1"
# Login
resp = requests.post(f"{BASE}/login",
json={"username": "admin", "password": "netxms"})
resp.raise_for_status()
headers = {"Authorization": f"Bearer {resp.json()['token']}"}
# Get active alarms and acknowledge critical ones (severity 4)
for alarm in requests.get(f"{BASE}/alarms", headers=headers).json():
if alarm["severity"] == 4:
requests.post(f"{BASE}/alarms/{alarm['id']}/acknowledge", headers=headers)
print(f"Acknowledged alarm {alarm['id']}: {alarm['message']}")
# Logout
requests.post(f"{BASE}/logout", headers=headers)
Bash — Acknowledge All Critical Alarms
#!/bin/bash
API="http://server:8000/v1"
# Login
TOKEN=$(curl -s -X POST "$API/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"netxms"}' | jq -r '.token')
# Get critical alarms and acknowledge them
curl -s "$API/alarms" -H "Authorization: Bearer $TOKEN" | \
jq -r '.[] | select(.severity == 4) | .id' | \
while read id; do
curl -s -X POST "$API/alarms/$id/acknowledge" \
-H "Authorization: Bearer $TOKEN"
echo "Acknowledged alarm $id"
done
# Logout
curl -s -X POST "$API/logout" -H "Authorization: Bearer $TOKEN"
Best Practices
-
Use persistent tokens for automated integrations instead of logging in with credentials
-
Log out when done
-
Avoid polling too frequently; use reasonable intervals (30 seconds or more for dashboards)
-
Create a dedicated user account with minimal permissions for each integration
Next Steps
-
Grafana Integration — using the REST API with Grafana
-
External Tools Integration — connecting external tools to NetXMS