Device API

Use the device API to register devices and set up their inputs and feeds from a template

Getting started guide

Your API keys

There are two API keys: a read only key, safe to use in dashboards and shared links, and a read & write key that lets devices post data to your account.

Log in or create an account to get your keys.

Three ways to authenticate

RECOMMENDED POST body: apikey=APIKEY
HEADER Authorization: Bearer APIKEY
URL &apikey=APIKEY

No HTTPS on your device? Emoncms also supports AES-128-CBC encrypted posting using your API key as a pre-shared key. See the reference below.

Device key authentication

A device key posts data for one node only, so a device that is out in the field never carries your account write key.

The input API accepts a device key in place of an apikey, in the URL or the POST body:

RECOMMENDED POST body: devicekey=DEVICEKEY
URL &devicekey=DEVICEKEY

The node the data is posted to must match the nodeid configured for that device, otherwise the post is rejected. Generate a key with device/generatekey.json below.

Device templates

A template defines a device type and the default inputs, feeds and process lists for it. Template files live in Modules/device/data/*.json.

Setting up a device is two steps: create it with a nodeid and a type, then initialize it to build the inputs and feeds that type expects.

Initialize a device once, on installation. Initializing the same device twice duplicates its inputs and feeds. Use device/template/prepare.json first to see exactly what will be created.

Go to the Devices page

Reference

/
{{ module.name.toUpperCase() }} API {{ group.name }}
KEY REQUIRED
read write public ok

No endpoints match your filter

Using an AI assistant to write API client code? Point it at the machine readable reference: site/api.md · site/api.json · llms.txt