REST API

Use the SNClient REST API to run checks or do administrative tasks.

The endpoint list also includes non-REST URLs.

Endpoints

These endpoints are available if the WEBServer is enabled in the modules section.

/

Redirects to /index.html

/index.html

Returns a simple OK message:

Example:

curl \
    -u user:changeme \
    -X POST \
    https://127.0.0.1:8443/index.html

Returns:

snclient working...

Check Endpoints

These endpoints are available if the WEBServer is enabled in the modules section.

/query/{command}

Legacy check command endpoint.

Example:

curl \
    -u user:changeme \
    -X POST \
    https://127.0.0.1:8443/query/check_uptime

/api/v1/queries/{command}/commands/execute

Version 1 check command endpoint.

Example:

curl \
    -u user:changeme \
    -X POST \
    https://127.0.0.1:8443/api/v1/queries/check_uptime/commands/execute

/api/v1/inventory

Returns the check inventory as JSON.

Example:

curl \
    -u user:changeme \
    -X POST \
    https://127.0.0.1:8443/api/v1/inventory

Returns:

{
    "inventory": {
        "cpu": [
            {
                "core": "core1",
                "core_id": "core1",
                "load": "43",
                "time": "5m"
            },
            ...
        ],
        ...
        "temperature": [
            {
                "crit": "100.000000",
                "label": "Core 1",
                "max": "100.000000",
                "min": "0.000000",
                "name": "coretemp",
                "path": "/sys/class/hwmon/hwmon5/temp3_input",
                "temperature": "44.000000"
            }
        ],
        "uptime": [
            {
                "boot": "2023-12-04 07:16:01",
                "uptime": "8d 09:07h",
                "uptime_value": "724072.8"
            }
        ]
    },
    "localtime": 1702398235
}

/api/v1/inventory/{module}

Returns the check inventory for a specific module as JSON. The keys in the inventory hash map returned by /api/v1/inventory identify the available modules.

Example:

curl \
    -u user:changeme \
    -X POST \
    https://127.0.0.1:8443/api/v1/inventory/memory

Prometheus Endpoints

These endpoints are available if the PrometheusServer is enabled in the modules section.

/metrics

Returns Prometheus metrics for SNClient itself.

Node Exporter Endpoints

These endpoints are available if the NodeExporterServer or WindowsExporterServer is enabled in the modules section.

/node/metrics

Used by the WindowsExporter and NodeExporter.

Returns Prometheus metrics from those exporters.

Exporter Exporter Endpoints

These endpoints are available if the ExporterExporterServer is enabled in the modules section.

/list

Used by the ExporterExporter server.

Returns a list of exporters.

/proxy

Used by the ExporterExporter server.

Returns metrics for the specified exporter.

Administrative Endpoints

These endpoints are available if the WEBAdminServer is enabled in the modules section.

Use a separate password for administrative tasks. For example:

[/settings/WEBAdmin/server]
password = mysecretadminpassword

/api/v1/admin/reload

Reload the configuration.

Example:

curl \
    -u user:changeme \
    -X POST \
    https://127.0.0.1:8443/api/v1/admin/reload

Returns

{"success":true}

/api/v1/admin/log/level

Override the current log level temporarily or permanently.

duration (in seconds) is optional. If it is greater than 0, SNClient restores the previous log level automatically after that duration.

Example:

curl \
    -u user:changeme \
    -H 'Content-Type: application/json' \
    -d '{ "level": "debug", "duration": 60 }' \
    https://127.0.0.1:8443/api/v1/admin/log/level

Returns

{
    "success": true,
    "previous": "info",
    "current": "debug",
    "expires_at": "2026-05-21T12:34:56Z"
}

/api/v1/admin/log/file

Download the current logfile as plain text. Returns 404 when logging to stdout/stderr.

Example:

curl \
    -u user:changeme \
    -o snclient.log \
    https://127.0.0.1:8443/api/v1/admin/log/file

/api/v1/admin/certs/replace

Replace the TLS certificate and key while SNClient runs. Reload is optional.

Encode the certificates with Base64, as in this example.

If the new certificate comes from a Certificate Signing Request (CSR) generated by the CSR endpoint, omit keydata. SNClient updates the certificate only if its public key matches the public key generated by the CSR endpoint.

Example:

curl \
    -u user:changeme \
    -d '{ "certdata": "'$(base64 -w 0 ./server.crt)'", "keydata": "'$(base64 -w 0 dist/server.key)'", "reload": true }' \
    https://127.0.0.1:8443/api/v1/admin/certs/replace

Returns

{"success":true}

/api/v1/admin/csr

Requests a new CSR. It uses the existing private key unless the user requests a new one. Only CommonName is required. The remaining fields are optional.

You can also set an optional ChallengePassword in the CSR request.

Example:

curl \
    -u user:changeme \
    -d '{"Country":"DE","State":"Bavaria","Locality":"Earth","Organization":"snclient","OrganizationalUnit":"IT","HostName":"Root CA SNClient", "NewKey":true, "KeyLength":4096}' \
    https://127.0.0.1:8443/api/v1/admin/csr

Returns a PEM-encoded CSR. If you specify NewKey:true, SNClient generates a new private key and stores it in a temporary file. It keeps this file until you upload the signed certificate to the /api/v1/admin/certs/replace endpoint. SNClient then saves the new private key in the key file specified in the configuration.

/api/v1/admin/updates/install

Check for updates.

The endpoint has the following optional parameters:

  • channel: set channel to fetch updates from. Defaults to the configured channel.
  • force: force installing an update. Default: false
  • version: force installing a specific version. Default is to use the latest version.
  • restart: restart after installing the update: Default: true

Example:

curl \
    -u user:changeme \
    -H 'Content-Type: application/json' \
    -d '{ "channel": "stable", "restart": false }' \
    -X POST \
    https://127.0.0.1:8443/api/v1/admin/updates/install

Returns

{
    "success":  true,
    "message": "update found and installed",
    "version": "v0.27.0024"
}

Note: On success, this endpoint does not return a result because the daemon restarts during the request.