REST API Reference
Everything you do in the GridNMS web app is backed by a REST API, so you can script bulk operations, build reports, or wire GridNMS into your own systems.
Authentication
Section titled “Authentication”The API uses personal API tokens. A token acts as you — its access is the intersection of your own permissions and sites with whatever scope the token was minted with, so it can never reach more than your account can, and can be narrowed to reach less (see Scoping a token below).
Create a token:
- Open Profile → API Tokens (your avatar, top-right — see Your Account).
- Give it a name and create it.
- Copy the token — it starts with
gnms_and is shown only once. Store it somewhere safe (a secret manager, a CI secret). If you lose it, revoke it and make a new one.
Use it by sending it as a Bearer token on every request:
export GNMS_TOKEN="gnms_your_token_here"curl -H "Authorization: Bearer $GNMS_TOKEN" https://app.gridnms.io/api/v1/devicesRevoke a token any time from the same Profile → API Tokens screen — revocation, and any change to your own role, takes effect on the very next request.
Scoping a token
Section titled “Scoping a token”By default a new token inherits your full account access. You can narrow it at creation time:
- Read-only — a convenience preset that limits the token to read access
across every resource. Pass
"readOnly": true. - A custom scope — a
scopePermsmap naming exactly which resources the token may use and for which actions (read,write,delete), for example{"devices": ["read"], "events": ["read", "write"]}. An explicitscopePermsalways wins overreadOnlyrather than combining with it. - Site restriction — a
scopeSiteslist of site IDs. Omit it to inherit every site your account can already see.
GET /api/v1/tokens/scope-options returns the current list of valid resource
names and actions, so you can build a picker instead of hardcoding the
vocabulary:
curl -H "Authorization: Bearer $GNMS_TOKEN" \ https://app.gridnms.io/api/v1/tokens/scope-options# → { "success": true, "data": { "resources": ["devices","events",…], "actions": ["read","write","delete"] } }Create a read-only token, from a script running as a logged-in session:
curl -X POST -H "Content-Type: application/json" \ -d '{"name":"reporting-bot","readOnly":true}' \ https://app.gridnms.io/api/v1/tokensCreate a token scoped to just device reads on two sites:
curl -X POST -H "Content-Type: application/json" \ -d '{"name":"device-dashboard","scopePerms":{"devices":["read"]},"scopeSites":[12,15]}' \ https://app.gridnms.io/api/v1/tokensA request outside a token’s scope is rejected with
403 { "success": false, "code": "token_scope_denied" } — distinguishable from
an ordinary permission 403, so your integration can tell “this token isn’t
allowed to do that” apart from “your account role can’t do that.”
Base URL & conventions
Section titled “Base URL & conventions”- Base URL:
https://app.gridnms.io(self-hosted: your own instance host). - Path prefix:
/api/v1is the canonical, versioned prefix — use it for all new integrations. The unversioned/apiprefix is a permanent alias: every endpoint below is reachable identically under either prefix, and always will be. - Response envelope: every response is JSON in the shape
{ "success": true, "data": … }. List endpoints also return atotalCount(ortotal) for pagination. - Pagination: list endpoints take
page(1-based, default1) andpageSize(default25). - Timestamps are Unix seconds (integers).
- Errors: a
401means your token is missing or invalid; a403means either your account lacks permission (or site access) for that resource, or the token’s own scope doesn’t cover it (seecode: "token_scope_denied"above); a404means the resource doesn’t exist or isn’t visible to you; a400means a query parameter is invalid or not recognized.
Endpoints
Section titled “Endpoints”The stable, customer-facing read endpoints (shown at the versioned /api/v1
prefix — the unversioned /api prefix works identically):
| Method & path | What it does |
|---|---|
GET /api/v1/devices |
List devices (filters: search, Address, monitor, class, collector, page, pageSize). |
GET /api/v1/devices/{id} |
Get one device. |
GET /api/v1/events |
List events (filters: from, to, Severity, Source, Device, Tag, Message, Name, SenderHost, hideCaseManaged, sort, dir, page, pageSize). Filter names are case-sensitive; any other query parameter is rejected with 400. |
GET /api/v1/events/{id} |
Get one event. |
GET /api/v1/cases |
List cases (filters: status, severity, priority, assignee, tag, q, page, pageSize). |
GET /api/v1/cases/{id} |
Get one case with its events and activity. |
GET /api/v1/interfaces?deviceId={id} |
List a device’s interfaces (deviceId is required). |
GET /api/v1/tokens |
List your API tokens (metadata only, never the secret). |
POST /api/v1/tokens |
Create a token. Body: { "name": "…", "readOnly"?, "scopePerms"?, "scopeSites"? } — see Scoping a token. Returns the plaintext token once. |
DELETE /api/v1/tokens/{id} |
Revoke one of your tokens. |
GET /api/v1/tokens/scope-options |
List the resources and actions a token’s scopePerms may name. |
Examples
Section titled “Examples”List monitored devices:
curl -H "Authorization: Bearer $GNMS_TOKEN" \ "https://app.gridnms.io/api/v1/devices?monitor=1&pageSize=50"Get a single device:
curl -H "Authorization: Bearer $GNMS_TOKEN" \ https://app.gridnms.io/api/v1/devices/42Events from the last hour, minor severity or worse:
FROM=$(($(date +%s) - 3600))curl -H "Authorization: Bearer $GNMS_TOKEN" \ "https://app.gridnms.io/api/v1/events?from=$FROM&Severity=3"List cases that are still open:
curl -H "Authorization: Bearer $GNMS_TOKEN" \ "https://app.gridnms.io/api/v1/cases?status=0,1"List a device’s interfaces:
curl -H "Authorization: Bearer $GNMS_TOKEN" \ "https://app.gridnms.io/api/v1/interfaces?deviceId=42"Severity & status codes
Section titled “Severity & status codes”Several endpoints use numeric codes:
- Severity:
1critical,2major,3minor,4warning,5info. Event filters treatSeverityas an inclusive ceiling —Severity=3returns critical, major, and minor. - Events are immutable — an event is a point-in-time record of something
that happened, with no open/acknowledged/closed status of its own. The
ongoing investigation lifecycle lives on Cases instead; an event that’s
been triaged shows
InCase/CaseIdpointing at the case handling it. - Case status:
0open,1investigating,2resolved,3closed.
See Severity & Status Codes for the full reference.
Machine-readable spec
Section titled “Machine-readable spec”A full OpenAPI 3.1 description of the API is served at:
https://app.gridnms.io/api/openapi.jsonImport it into Postman, Insomnia, or any OpenAPI tool to get an auto-generated client and request collection.
docs built 2026-09-26 · 195c6d00