Skip to main content
NervesHub has a JSON API for devices, firmware, archives, deployment groups and their releases, products, organizations, signing keys, CA certificates, webhooks and support scripts. The nh CLI is built on it, and you can call it from CI or your own tooling. The Endpoints section in the sidebar is generated from the server’s OpenAPI document.

Base URL

Every path starts with /api on the host that serves the NervesHub web interface.
This is not the host devices connect to. Devices use the device endpoint described in the device WebSocket protocol.

OpenAPI document

Each instance serves its own OpenAPI 3.0 document, generated from the running code. The endpoint reference on this site is built from https://manage.nervescloud.com/api/openapi. If you self-host, fetch the document from your own instance to see what your version offers.

Authentication

Send a user access token or a product API key as a bearer token.
See Authentication for how to get each credential and what each can reach.

URL structure

Most resources belong to a product, which belongs to an organization.
Organization resources leave out the product.
A device can also be addressed by identifier alone, without naming its organization or product.
The deployments path manages what the web interface calls deployment groups.

Response format

Responses are JSON. A successful response wraps its payload in data.
A list returns an array under data. A successful delete returns 204 with no body.

Pagination

Two lists are paginated: a product’s devices and its support scripts (including the scripts listed for one device). Every other list returns all of its entries. Pass the page and page size in a pagination query parameter.
A paginated response carries a pagination object beside data.
The device list also takes sort (a column name), sort_direction (asc or desc, default asc) and filters. See the endpoint reference for the filter keys. Device logs and device metrics are not paged. They take limit (1 to 1000, default 100), since, before and order.

Errors

An error response has an errors object. Most errors carry one message in detail.
A validation error lists messages by field instead.

Status codes

A role that lacks a permission gets 401, not 403. If a token works on /api/users/me but an action returns 401, check the role. See Roles.

Rate limits

Only the two endpoints the CLI uses to sign in through the browser are rate limited. Both are limited per client address. A request over the limit gets 429 with a Retry-After header giving the seconds to wait.