Help Shape What We Build Next: Take the 2026 Blues Developer Survey

Blues Developers
What’s New
Resources
API Reference
Notecard and Notehub API documentation
Blog
Technical articles for developers
Connected Product Guidebook
In-depth guides for connected product development
Developer Certification
Get certified on wireless connectivity with Blues
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Webinars
Listing of Blues technical webinars
Blues.comNotehub
Shop
Docs
Help
Support DocsNotehub StatusSecurity AdvisoriesVisit our Forum
Sign In
Docs Home
What’s New
Resources
API Reference
Notecard and Notehub API documentation
Blog
Technical articles for developers
Connected Product Guidebook
In-depth guides for connected product development
Developer Certification
Get certified on wireless connectivity with Blues
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Webinars
Listing of Blues technical webinars
Blues.comNotehub
Shop
Docs
Tools & SDKs
Notecard CLI
Firmware Libraries
Arduino Library
C Library
ESP-IDF Library
Go Library
Python Library
Zephyr Library
Notehub SDKs
Notehub JS Library
InstallationUsageAPI Reference
Notehub Py Library
Notehub API Postman Collection
Generative AI Tools
Blues Expert MCP
Notehub MCP
homechevron_rightDocschevron_rightTools & SDKschevron_rightNotehub Sdkschevron_rightNotehub JS Library Installation and Usage

Notehub JS Library Overview

The Notehub JS library is an npm package built for JavaScript applications. It provides a quick, JavaScript-friendly way to connect to the Notehub API, and perform Notehub API requests with a clean, intuitive interface.

Installation

You can install the Notehub JS library in any JavaScript application using the steps below.

Start by installing the @blues-inc/notehub-js package in your project using your package manager of choice. The example below uses npm:

$
npm install @blues-inc/notehub-js

Once the package is installed, you can import the library using either import or require:

Using import:

import * as NotehubJs from "@blues-inc/notehub-js";
note

Using import in a TypeScript project will currently cause an error because type definitions are not yet included. To resolve this, create a .d.ts file in your project (for example, types/notehub-js.d.ts) with the following declaration:

declare module "@blues-inc/notehub-js";

Using require:

const NotehubJs = require("@blues-inc/notehub-js");

Usage

Authentication

The Notehub JS library authenticates using a Personal Access Token (PAT). Set your token once on the shared ApiClient instance before making any API calls:

import * as NotehubJs from "@blues-inc/notehub-js";

const defaultClient = NotehubJs.ApiClient.instance;
const auth = defaultClient.authentications["personalAccessToken"];
auth.accessToken = "YOUR_ACCESS_TOKEN";

Finding Your Project UID

Most API methods require a ProjectUID — a unique identifier for your Notehub project in the format app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. You can find it on your project's Settings page in Notehub.

Example: Fetching Events

Here's a complete example that retrieves the 10 most recent events from a project:

import * as NotehubJs from "@blues-inc/notehub-js";

const defaultClient = NotehubJs.ApiClient.instance;
const auth = defaultClient.authentications["personalAccessToken"];
auth.accessToken = "YOUR_ACCESS_TOKEN";

const projectUID = "app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
const eventApi = new NotehubJs.EventApi();

eventApi.getEvents(projectUID, { pageSize: 10, sortOrder: "desc" }).then(
  (data) => console.log(data.events),
  (error) => console.error(error)
);

// If you're using TypeScript you may need to add types to avoid
// compilation errors
// eventApi.getEvents(projectUID, { pageSize: 10, sortOrder: "desc" }).then(
//   (data: any) => console.log(data.events),
//   (error: unknown) => console.error(error)
// );

getEvents() returns events oldest-first by default, so the example sets sortOrder: "desc" to get the newest ones. The response contains an events array and a has_more flag that tells you whether there are more pages to fetch with the pageNum option.

The library also supports async/await:

try {
  const data = await eventApi.getEvents(projectUID, {
    pageSize: 10,
    sortOrder: "desc",
  });
  console.log(data.events);
} catch (error) {
  console.error(error.status ?? error, error.body);
}

When Notehub returns an error response, the error includes the HTTP status and the response body.

Usage Limits

The Notehub API has usage limits. Exceeding the request threshold may result in 429 responses (error.status === 429). See Notehub API Usage Limits for details.

API Reference

APIDescription
Device APIManage devices, environment variables, and Notefiles
Event APIQuery project and fleet events, with cursor and filter support
Jobs APIManage and run Notehub batch jobs
Monitor APICreate and manage monitors that trigger alerts on event data
Organization APIRetrieve your organizations, their plans, and daily balance history
Project APIManage projects, fleets, firmware, environment variables, and more
Route APICreate and manage routes for forwarding event data
Usage APIQuery data, event, route log, and session usage by time range

Device API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
addDbNotePOST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}Add a note to a .db notefile
addQiNotePOST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}Queue a note for a Notecard
createNotefilePOST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notefiles/{notefileID}Create an empty notefile
deleteDeviceDELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}Delete a device
deleteDeviceEnvironmentVariableDELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables/{key}Delete a device environment variable
deleteNoteDELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}Delete a note
deleteNotefilesDELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/filesDelete notefiles
disableDevicePOST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/disableDisable a device
enableDevicePOST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/enableEnable a device
getDbNoteGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}Get a note
getDeviceGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}Get a device
getDeviceEnvironmentHierarchyGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_hierarchyGet a device's environment hierarchy
getDeviceEnvironmentVariablesGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variablesGet device environment variables
getDeviceEnvironmentVariablesByPinGET /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pinGet device environment variables using a PIN
getDeviceHealthLogGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/health-logGet a device's health log
getDeviceJourneyGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys/{journeyID}Get a journey and its events
getDeviceJourneysGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeysList a device's journeys
getDeviceLatestEventsGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/latestGet a device's latest event per notefile
getDevicePlansGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/plansGet a device's cellular data plans
getDevicePublicKeyGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/public-keyGet a device's public key
getDevicePublicKeysGET /v1/projects/{projectOrProductUID}/devices/public-keysList public keys of all devices
getDeviceSessionsGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/sessionsList a device's sessions
getDevicesGET /v1/projects/{projectOrProductUID}/devicesList devices in a project
getFleetDevicesGET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/devicesList devices in a fleet
getNotefileGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}Get the notes in a notefile
getSessionsGET /v1/projects/{projectOrProductUID}/sessionsList sessions in a project
listNotefilesGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/filesList a device's notefiles and notes
provisionDevicePOST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/provisionProvision a Notecard
setDeviceEnvironmentVariablesPUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variablesSet device environment variables
setDeviceEnvironmentVariablesByPinPUT /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pinSet device environment variables using a PIN
signalDevicePOST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/signalSend a signal to a connected Notecard
updateDbNotePUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}Update a note in a .db notefile

addDbNote

addDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)

Add a note to a .db notefile

Add a note with the given ID to a database notefile on a device, synced to the Notecard on its next sync. To change an existing note, use `UpdateDbNote`; to queue a note in a `.qi` notefile, use `AddQiNote`. Requires the Owner or Developer role. Returns 400 unless the notefile ends in `.db` or `.dbs`, or if `payload` isn't valid base64.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
let noteInput = new NotehubJs.NoteInput(); // NoteInput | Body or payload of note to be added to the device
apiInstance
  .addDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
notefileIDStringNotefile name, including its extension, e.g. `config.db` or `commands.qi`.
noteIDStringNote ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
noteInputNoteInputBody or payload of note to be added to the device
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

addQiNote

addQiNote(projectOrProductUID, deviceUID, notefileID, noteInput)

Queue a note for a Notecard

Add a note to an inbound queue (`.qi`) notefile on a device, creating the notefile if needed. The Notecard receives it on its next sync. For a `.db` notefile, use `AddDbNote`; to reach a connected Notecard immediately, use `SignalDevice`. Requires the Owner or Developer role. Returns 400 unless the notefile ends in `.qi` or `.qis`, or if `payload` isn't valid base64.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteInput = new NotehubJs.NoteInput(); // NoteInput | Body or payload of note to be added to the device
apiInstance
  .addQiNote(projectOrProductUID, deviceUID, notefileID, noteInput)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
notefileIDStringNotefile name, including its extension, e.g. `config.db` or `commands.qi`.
noteInputNoteInputBody or payload of note to be added to the device
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

createNotefile

createNotefile(projectOrProductUID, deviceUID, notefileID)

Create an empty notefile

Create an empty notefile on a device. `AddQiNote` creates a notefile when needed, so this is only required for an empty one. Requires the Owner or Developer role. Returns 400 if the notefile already exists.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
apiInstance.createNotefile(projectOrProductUID, deviceUID, notefileID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
notefileIDStringNotefile name, including its extension, e.g. `config.db` or `commands.qi`.
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteDevice

deleteDevice(projectOrProductUID, deviceUID)

Delete a device

Delete a device and its notefiles from a project. Its events are kept. A Notecard that syncs again is added back as a new device; to block it instead, use `DisableDevice`. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.deleteDevice(projectOrProductUID, deviceUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteDeviceEnvironmentVariable

EnvironmentVariables deleteDeviceEnvironmentVariable(projectOrProductUID, deviceUID, key)

Delete a device environment variable

Delete one device environment variable and return the ones left. Fleet and project variables with the same name then apply. Deleting a variable that doesn't exist succeeds. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance
  .deleteDeviceEnvironmentVariable(projectOrProductUID, deviceUID, key)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
keyStringThe environment variable key to delete.
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteNote

deleteNote(projectOrProductUID, deviceUID, notefileID, noteID)

Delete a note

Delete one note from a notefile on a device. To delete whole notefiles, use `DeleteNotefiles`. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
apiInstance.deleteNote(projectOrProductUID, deviceUID, notefileID, noteID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
notefileIDStringNotefile name, including its extension, e.g. `config.db` or `commands.qi`.
noteIDStringNote ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteNotefiles

deleteNotefiles(projectOrProductUID, deviceUID, deleteNotefilesRequest)

Delete notefiles

Delete notefiles and all their notes from a device. To delete one note, use `DeleteNote`. Requires the Owner or Developer role. Returns 400 if `files` is empty.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let deleteNotefilesRequest = new NotehubJs.DeleteNotefilesRequest(); // DeleteNotefilesRequest | The notefiles to delete.
apiInstance
  .deleteNotefiles(projectOrProductUID, deviceUID, deleteNotefilesRequest)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
deleteNotefilesRequestDeleteNotefilesRequestThe notefiles to delete.
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

disableDevice

disableDevice(projectOrProductUID, deviceUID)

Disable a device

Stop a device from connecting to Notehub, ending any open session. The device and its data stay in the project; undo with `EnableDevice`. Does nothing if it's already disabled. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.disableDevice(projectOrProductUID, deviceUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

enableDevice

enableDevice(projectOrProductUID, deviceUID)

Enable a device

Re-enable a device turned off with `DisableDevice`, so it can connect to Notehub again. Does nothing if the device is already enabled. Requires the Owner or Developer role. Returns 409 if the device's cellular service was deactivated; it must be reactivated instead.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.enableDevice(projectOrProductUID, deviceUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDbNote

GetDbNote200Response getDbNote(projectOrProductUID, deviceUID, notefileID, noteID, opts)

Get a note

Get one note's body, payload and time from a notefile on a device. To get every note in a notefile, use `GetNotefile`. With `delete=true`, the note is deleted after it is read, which requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
let opts = {
  _delete: true, // Boolean | If true, delete the note after returning it. Requires the Owner or Developer role.
  deleted: true, // Boolean | If true, also return the note if it has been deleted.
};
apiInstance
  .getDbNote(projectOrProductUID, deviceUID, notefileID, noteID, opts)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
notefileIDStringNotefile name, including its extension, e.g. `config.db` or `commands.qi`.
noteIDStringNote ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
_deleteBooleanIf true, delete the note after returning it. Requires the Owner or Developer role.[optional]
deletedBooleanIf true, also return the note if it has been deleted.[optional]
Return type

GetDbNote200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDevice

Device getDevice(projectOrProductUID, deviceUID)

Get a device

Get one device's details: serial number, product, fleets, locations, firmware versions, SIM usage and DFU state. To find devices by tag, serial number or other fields, use `GetDevices`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDevice(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

Device

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceEnvironmentHierarchy

EnvTreeJsonNode getDeviceEnvironmentHierarchy(projectOrProductUID, deviceUID)

Get a device's environment hierarchy

Get a device's environment variables and the fleet and project variables it inherits, as a tree. Each variable has its precedence and whether it is used or overridden. For just the resolved values, use `GetDeviceEnvironmentVariables`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceEnvironmentHierarchy(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

EnvTreeJsonNode

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceEnvironmentVariables

GetDeviceEnvironmentVariablesByPin200Response getDeviceEnvironmentVariables(projectOrProductUID, deviceUID)

Get device environment variables

Get a device's own environment variables, its `env.default` values, and its effective values. Effective values merge in project and fleet variables, which device variables override. To see where each value comes from, use `GetDeviceEnvironmentHierarchy`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceEnvironmentVariables(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

GetDeviceEnvironmentVariablesByPin200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceEnvironmentVariablesByPin

GetDeviceEnvironmentVariablesByPin200Response getDeviceEnvironmentVariablesByPin(productUID, deviceUID, xAuthToken)

Get device environment variables using a PIN

Get a device's environment variables using its PIN instead of an API token. Pass the PIN in `X-Auth-Token`. Made for device dashboard pages; with a token, use `GetDeviceEnvironmentVariables`, which also returns effective values. Returns 401 if the project's device dashboard URL has no `[pin]`, or the PIN is wrong.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.bridge:sensors"; // String |
let deviceUID = "dev:000000000000000"; // String |
let xAuthToken = "xAuthToken_example"; // String | The device's PIN, used instead of an API token.
apiInstance
  .getDeviceEnvironmentVariablesByPin(productUID, deviceUID, xAuthToken)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
productUIDString
deviceUIDString
xAuthTokenStringThe device's PIN, used instead of an API token.
Return type

GetDeviceEnvironmentVariablesByPin200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceHealthLog

GetDeviceHealthLog200Response getDeviceHealthLog(projectOrProductUID, deviceUID, opts)

Get a device's health log

Get a device's health log: timestamped status messages such as restarts and completed firmware updates. Only the latest 100 entries are kept. To filter by date, pass both `startDate` and `endDate`; `startDate` alone returns 400, and the same value for both returns every entry.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  logType: ["null"], // [String] | Return only these kinds of entry. If omitted, all entries are returned. - `boot`: the device restarted - `dfu_completed`: a host firmware update finished
};
apiInstance.getDeviceHealthLog(projectOrProductUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
logType[String]Return only these kinds of entry. If omitted, all entries are returned. - `boot`: the device restarted - `dfu_completed`: a host firmware update finished[optional]
Return type

GetDeviceHealthLog200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceJourney

GetDeviceJourney200Response getDeviceJourney(projectOrProductUID, deviceUID, journeyID, opts)

Get a journey and its events

Get one journey's start and end time and its events, oldest first. Only events with a location are included, and a run of events at the same location is reduced to the first. The events are paginated; `journey.has_more` is true if there are more. Returns 404 if the journey doesn't exist, and 403 if the organization is suspended.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let journeyID = 789; // Number | Identifier of the journey, taken from the numeric `journey` field in the event body (a Unix timestamp marking the start of the journey).
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
};
apiInstance
  .getDeviceJourney(projectOrProductUID, deviceUID, journeyID, opts)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
journeyIDNumberIdentifier of the journey, taken from the numeric `journey` field in the event body (a Unix timestamp marking the start of the journey).
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
Return type

GetDeviceJourney200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceJourneys

GetDeviceJourneys200Response getDeviceJourneys(projectOrProductUID, deviceUID, opts)

List a device's journeys

List a device's journeys, newest first, without their events. A journey is the events whose body has the same `journey` value and a `jcount` field; one-event journeys are left out. For a journey's events, use `GetDeviceJourney`. Returns at most 100; `has_more` is true if there are more. `startDate` and `endDate` filter on the journey's start. Returns 403 if the organization is suspended.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
};
apiInstance.getDeviceJourneys(projectOrProductUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
Return type

GetDeviceJourneys200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceLatestEvents

GetDeviceLatestEvents200Response getDeviceLatestEvents(projectOrProductUID, deviceUID)

Get a device's latest event per notefile

Get the most recent event from each of a device's notefiles, sorted by notefile name. `_env.qo` is left out. To search a device's event history, use `GetEvents`. Returns 403 if the organization is suspended.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceLatestEvents(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

GetDeviceLatestEvents200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDevicePlans

GetDevicePlans200Response getDevicePlans(projectOrProductUID, deviceUID)

Get a device's cellular data plans

Get the data plan of each cellular SIM in a device: plan type, data used and remaining, and expiry. Covers the built-in SIM and any external SIM, but not satellite plans. Returns 404 if the device has no cellular or satellite SIM.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDevicePlans(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

GetDevicePlans200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDevicePublicKey

GetDevicePublicKey200Response getDevicePublicKey(projectOrProductUID, deviceUID)

Get a device's public key

Get one Notecard's public key, in PEM format. For every device in the project, use `GetDevicePublicKeys`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDevicePublicKey(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

GetDevicePublicKey200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDevicePublicKeys

GetDevicePublicKeys200Response getDevicePublicKeys(projectOrProductUID, opts)

List public keys of all devices

List the public key of every device in a project. For one device, use `GetDevicePublicKey`. Paginated. Deleted devices are included only when reading with a `cursor`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
};
apiInstance.getDevicePublicKeys(projectOrProductUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
Return type

GetDevicePublicKeys200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceSessions

GetDeviceSessions200Response getDeviceSessions(projectOrProductUID, deviceUID, opts)

List a device's sessions

List a device's sessions, its connections to Notehub. Each shows why it opened and closed, signal strength, location and data usage. `startDate` and `endDate` filter on when the session began. For every device's sessions, use `GetSessions`. Paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  firstSync: false, // Boolean | If true, return only sessions whose `why_session_opened` begins with \"first sync\".
};
apiInstance.getDeviceSessions(projectOrProductUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
firstSyncBooleanIf true, return only sessions whose `why_session_opened` begins with "first sync".[optional] [default to false]
Return type

GetDeviceSessions200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDevices

GetDevices200Response getDevices(projectOrProductUID, opts)

List devices in a project

List the devices in a project, with optional filters such as tag, serial number, fleet, location and firmware version. For one fleet's devices, use `GetFleetDevices`. Paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  deviceUID: ["null"], // [String] | A DeviceUID.
  tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
  serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  fleetUID: ["null"], // [String] |
  notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getDevices(projectOrProductUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
deviceUID[String]A DeviceUID.[optional]
tag[String]Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`.[optional]
serialNumber[String]Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
fleetUID[String][optional]
notecardFirmware[String]Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
location[String]Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
hostFirmware[String]Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
productUID[String]ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
sku[String]SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
Return type

GetDevices200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getFleetDevices

GetDevices200Response getFleetDevices(projectOrProductUID, fleetUID, opts)

List devices in a fleet

List the devices in one fleet, with the same filters as `GetDevices`. To list a device's fleets instead, use `GetDeviceFleets`. Paginated. Returns 404 if the fleet doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  deviceUID: ["null"], // [String] | A DeviceUID.
  tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
  serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getFleetDevices(projectOrProductUID, fleetUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
deviceUID[String]A DeviceUID.[optional]
tag[String]Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`.[optional]
serialNumber[String]Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
notecardFirmware[String]Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
location[String]Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
hostFirmware[String]Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
productUID[String]ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
sku[String]SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
Return type

GetDevices200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getNotefile

GetNotefile200Response getNotefile(projectOrProductUID, deviceUID, notefileID, opts)

Get the notes in a notefile

Get the notes in one notefile on a device. For a `.qi` notefile, that's the notes still queued; for a `.db` notefile, every note. To list all of a device's notefiles with their notes, use `ListNotefiles`. With `delete=true`, the returned notes are deleted, which requires the Owner or Developer role. Returns 400 if `notefileID` has no valid notefile extension.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let opts = {
  max: 56, // Number | The most notes to return.
  deleted: true, // Boolean | If true, also return deleted notes.
  _delete: true, // Boolean | If true, delete the notes this request returns. Requires the Owner or Developer role.
};
apiInstance.getNotefile(projectOrProductUID, deviceUID, notefileID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
notefileIDStringNotefile name, including its extension, e.g. `config.db` or `commands.qi`.
maxNumberThe most notes to return.[optional]
deletedBooleanIf true, also return deleted notes.[optional]
_deleteBooleanIf true, delete the notes this request returns. Requires the Owner or Developer role.[optional]
Return type

GetNotefile200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getSessions

GetDeviceSessions200Response getSessions(projectOrProductUID, opts)

List sessions in a project

List the sessions of every device in a project, as `GetDeviceSessions` does for one device. `startDate` and `endDate` filter on when the session began. `deviceUID` and `fleetUID` each match any of their values; `fleetUID` matches the fleets recorded on the session. Paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  firstSync: false, // Boolean | If true, return only sessions whose `why_session_opened` begins with \"first sync\".
  deviceUID: ["null"], // [String] | A DeviceUID.
  fleetUID: ["null"], // [String] |
};
apiInstance.getSessions(projectOrProductUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
firstSyncBooleanIf true, return only sessions whose `why_session_opened` begins with "first sync".[optional] [default to false]
deviceUID[String]A DeviceUID.[optional]
fleetUID[String][optional]
Return type

GetDeviceSessions200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

listNotefiles

[Notefile] listNotefiles(projectOrProductUID, deviceUID, opts)

List a device's notefiles and notes

List a device's notefiles with the notes in each, sorted `.qo`, then `.qi`, then `.db`. `.qo` notefiles are listed without notes, since Notehub empties them as it processes them. Most system notefiles (names starting with `_`) are left out. For one notefile, use `GetNotefile`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
  files: ["null"], // [String] | Notefiles to include, e.g. `config.db`. If omitted, all are listed.
  pending: true, // Boolean | show only files that are pending sync to the Notecard
};
apiInstance.listNotefiles(projectOrProductUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
files[String]Notefiles to include, e.g. `config.db`. If omitted, all are listed.[optional]
pendingBooleanshow only files that are pending sync to the Notecard[optional]
Return type

[Notefile]

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

provisionDevice

Object provisionDevice(projectOrProductUID, deviceUID, provisionDeviceRequest)

Provision a Notecard

Add a Notecard to a project before it first connects, with its product, serial number and fleets. A device that already exists isn't reset and keeps its fleets. Requires the Owner or Developer role. Returns 404 if `product_uid` doesn't exist, and 400 if it belongs to another project or `deviceUID` isn't a valid Notecard DeviceUID.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let provisionDeviceRequest = new NotehubJs.ProvisionDeviceRequest(); // ProvisionDeviceRequest | The product, serial number and fleets for the device.
apiInstance
  .provisionDevice(projectOrProductUID, deviceUID, provisionDeviceRequest)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
provisionDeviceRequestProvisionDeviceRequestThe product, serial number and fleets for the device.
Return type

Object

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

setDeviceEnvironmentVariables

EnvironmentVariables setDeviceEnvironmentVariables(projectOrProductUID, deviceUID, environmentVariables)

Set device environment variables

Add or change a device's environment variables; variables you don't send keep their values. A value of `""` or `-` deletes that variable. Setting `_fw`, `_fwc` or `_fwm` starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 400 if a note's key isn't a variable.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let environmentVariables = new NotehubJs.EnvironmentVariables(); // EnvironmentVariables | The variables to add or change, and optional notes.
apiInstance
  .setDeviceEnvironmentVariables(
    projectOrProductUID,
    deviceUID,
    environmentVariables
  )
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
environmentVariablesEnvironmentVariablesThe variables to add or change, and optional notes.
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

setDeviceEnvironmentVariablesByPin

EnvironmentVariables setDeviceEnvironmentVariablesByPin(productUID, deviceUID, xAuthToken, environmentVariables)

Set device environment variables using a PIN

Add or change a device's environment variables using its PIN instead of an API token. Pass the PIN in `X-Auth-Token`. Works like `SetDeviceEnvironmentVariables`: a value of `""` or `-` deletes that variable. Returns 401 if the project's device dashboard URL has no `[pin]`, or the PIN is wrong.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.bridge:sensors"; // String |
let deviceUID = "dev:000000000000000"; // String |
let xAuthToken = "xAuthToken_example"; // String | The device's PIN, used instead of an API token.
let environmentVariables = new NotehubJs.EnvironmentVariables(); // EnvironmentVariables | The variables to add or change, and optional notes.
apiInstance
  .setDeviceEnvironmentVariablesByPin(
    productUID,
    deviceUID,
    xAuthToken,
    environmentVariables
  )
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
productUIDString
deviceUIDString
xAuthTokenStringThe device's PIN, used instead of an API token.
environmentVariablesEnvironmentVariablesThe variables to add or change, and optional notes.
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

signalDevice

SignalDevice200Response signalDevice(projectOrProductUID, deviceUID, body)

Send a signal to a connected Notecard

Send a JSON object straight to a Notecard, which the host can read with `hub.signal`. It's delivered only if the Notecard is connected to Notehub at that moment, and is never queued; `connected` in the response says whether it was. To queue data for the next sync, use `AddQiNote` instead. Requires the Owner or Developer role. Returns 400 if the body has a `type` field.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let body = new NotehubJs.Body(); // Body | The signal to send.
apiInstance.signalDevice(projectOrProductUID, deviceUID, body).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
bodyBodyThe signal to send.
Return type

SignalDevice200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

updateDbNote

updateDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)

Update a note in a .db notefile

Replace the body and payload of a note in a database notefile on a device, synced to the Notecard on its next sync. To add a new note, use `AddDbNote`. Requires the Owner or Developer role. Returns 400 unless the notefile ends in `.db` or `.dbs`, or if `payload` isn't valid base64.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
let noteInput = new NotehubJs.NoteInput(); // NoteInput | Body or payload of note to be added to the device
apiInstance
  .updateDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
notefileIDStringNotefile name, including its extension, e.g. `config.db` or `commands.qi`.
noteIDStringNote ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
noteInputNoteInputBody or payload of note to be added to the device
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

Event API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
getEventsGET /v1/projects/{projectOrProductUID}/eventsList events in a project
getFleetEventsGET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/eventsList events in a fleet
getRouteLogsByEventGET /v1/projects/{projectOrProductUID}/events/{eventUID}/route-logsGet an event's route logs

getEvents

GetEvents200Response getEvents(projectOrProductUID, opts)

List events in a project

List a project's events, filtered by device, notefile, date, fleet, session and more. Use `cursor` to read events in the order Notehub stored them and to poll for new ones. Set `format=csv` for CSV. For one fleet, use `GetFleetEvents`. Paginated. Returns 403 if the organization is suspended, and 500 if the query times out; narrow the filters and retry.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.EventApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  deviceUID: ["null"], // [String] | A DeviceUID.
  sensorUID: ["null"], // [String] | SensorUID to filter by, matched exactly. Repeat for more than one.
  sortBy: "'captured'", // String |
  sortOrder: "'asc'", // String |
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  dateType: "uploaded", // String | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it
  systemFilesOnly: true, // Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.
  files: "_health.qo, data.qo", // String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.
  format: "'json'", // String | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields`
  serialNumber: ["null"], // [String] | Serial number to filter by. Repeat for more than one.
  fleetUID: ["null"], // [String] | Filter by FleetUID
  sessionUID: ["null"], // [String] | SessionUID to filter by. Repeat for more than one.
  eventUID: ["null"], // [String] | EventUID to filter by. Repeat for more than one.
  selectFields: "selectFields_example", // String | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns.
};
apiInstance.getEvents(projectOrProductUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
deviceUID[String]A DeviceUID.[optional]
sensorUID[String]SensorUID to filter by, matched exactly. Repeat for more than one.[optional]
sortByString[optional] [default to 'captured']
sortOrderString[optional] [default to 'asc']
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
dateTypeStringWhich time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it[optional] [default to 'captured']
systemFilesOnlyBooleanIf true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.[optional]
filesStringComma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.[optional]
formatStringResponse format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields`[optional] [default to 'json']
serialNumber[String]Serial number to filter by. Repeat for more than one.[optional]
fleetUID[String]Filter by FleetUID[optional]
sessionUID[String]SessionUID to filter by. Repeat for more than one.[optional]
eventUID[String]EventUID to filter by. Repeat for more than one.[optional]
selectFieldsStringComma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns.[optional]
Return type

GetEvents200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json, text/csv

getFleetEvents

GetEvents200Response getFleetEvents(projectOrProductUID, fleetUID, opts)

List events in a fleet

List the events from one fleet, with the same filters, `cursor` and CSV output as `GetEvents`. Paginated. Returns 403 if the organization is suspended, and 500 if the query times out; narrow the filters and retry.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.EventApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  deviceUID: ["null"], // [String] | A DeviceUID.
  sensorUID: ["null"], // [String] | SensorUID to filter by, matched exactly. Repeat for more than one.
  sortBy: "'captured'", // String |
  sortOrder: "'asc'", // String |
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  dateType: "uploaded", // String | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it
  systemFilesOnly: true, // Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.
  files: "_health.qo, data.qo", // String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.
  format: "'json'", // String | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields`
  serialNumber: ["null"], // [String] | Serial number to filter by. Repeat for more than one.
  sessionUID: ["null"], // [String] | SessionUID to filter by. Repeat for more than one.
  eventUID: ["null"], // [String] | EventUID to filter by. Repeat for more than one.
  selectFields: "selectFields_example", // String | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns.
};
apiInstance.getFleetEvents(projectOrProductUID, fleetUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
deviceUID[String]A DeviceUID.[optional]
sensorUID[String]SensorUID to filter by, matched exactly. Repeat for more than one.[optional]
sortByString[optional] [default to 'captured']
sortOrderString[optional] [default to 'asc']
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
dateTypeStringWhich time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it[optional] [default to 'captured']
systemFilesOnlyBooleanIf true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.[optional]
filesStringComma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.[optional]
formatStringResponse format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields`[optional] [default to 'json']
serialNumber[String]Serial number to filter by. Repeat for more than one.[optional]
sessionUID[String]SessionUID to filter by. Repeat for more than one.[optional]
eventUID[String]EventUID to filter by. Repeat for more than one.[optional]
selectFieldsStringComma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns.[optional]
Return type

GetEvents200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json, text/csv

getRouteLogsByEvent

[RouteLog] getRouteLogsByEvent(projectOrProductUID, eventUID)

Get an event's route logs

Get the log of every attempt to send one event to each route, with the response status, body and duration. For a route's logs across events, use `GetRouteLogsByRoute`. Returns 404 if the event doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.EventApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let eventUID = "4506f411-dea6-44a0-9743-1130f57d7747"; // String | EventUID, e.g. `4506f411-dea6-44a0-9743-1130f57d7747`.
apiInstance.getRouteLogsByEvent(projectOrProductUID, eventUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
eventUIDStringEventUID, e.g. `4506f411-dea6-44a0-9743-1130f57d7747`.
Return type

[RouteLog]

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

Jobs API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
cancelJobRunPOST /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID}/cancelCancel a job run
createJobPOST /v1/projects/{projectOrProductUID}/jobsCreate a batch job
deleteJobDELETE /v1/projects/{projectOrProductUID}/jobs/{jobUID}Delete a batch job
deleteJobRunDELETE /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID}Delete a job run
getJobGET /v1/projects/{projectOrProductUID}/jobs/{jobUID}Get a batch job
getJobRunGET /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID}Get a job run
getJobRunsGET /v1/projects/{projectOrProductUID}/jobs/{jobUID}/runsList a job's runs
getJobsGET /v1/projects/{projectOrProductUID}/jobsList batch jobs
runJobPOST /v1/projects/{projectOrProductUID}/jobs/{jobUID}/runRun a batch job

cancelJobRun

CancelJobRun200Response cancelJobRun(projectOrProductUID, reportUID)

Cancel a job run

Ask a running job to stop. `successful` is false if the run couldn't be cancelled. Requires the Owner or Developer role. Returns 404 if the run doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let reportUID = "my-reconciliation-job-1707654321000"; // String | Job run UID, as returned by `RunJob`.
apiInstance.cancelJobRun(projectOrProductUID, reportUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
reportUIDStringJob run UID, as returned by `RunJob`.
Return type

CancelJobRun200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

createJob

CreateJob201Response createJob(projectOrProductUID, name, jobDefinition)

Create a batch job

Create a batch job from a definition that selects devices and the changes to make to them. It doesn't run until `RunJob`. Each call creates a new job with its own UID; names needn't be unique. Requires the Owner or Developer role. Returns 400 without a `name`; an invalid definition returns 500.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let name = "name_example"; // String | Job name, shown in lists. It doesn't have to be unique.
let jobDefinition = new NotehubJs.JobDefinition(); // JobDefinition | The batch job definition
apiInstance.createJob(projectOrProductUID, name, jobDefinition).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
nameStringJob name, shown in lists. It doesn't have to be unique.
jobDefinitionJobDefinitionThe batch job definition
Return type

CreateJob201Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

deleteJob

DeleteJob200Response deleteJob(projectOrProductUID, jobUID)

Delete a batch job

Delete a batch job. Requires the Owner or Developer role. Returns 404 if the job doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
apiInstance.deleteJob(projectOrProductUID, jobUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
jobUIDStringBatch job UID, as returned by `CreateJob`.
Return type

DeleteJob200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteJobRun

deleteJobRun(projectOrProductUID, reportUID)

Delete a job run

Delete a job run and its results. Deleting a run that doesn't exist also succeeds. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let reportUID = "my-reconciliation-job-1707654321000"; // String | Job run UID, as returned by `RunJob`.
apiInstance.deleteJobRun(projectOrProductUID, reportUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
reportUIDStringJob run UID, as returned by `RunJob`.
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getJob

JobDetail getJob(projectOrProductUID, jobUID)

Get a batch job

Get one batch job's definition and its latest run's status. Returns 404 if the job doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
apiInstance.getJob(projectOrProductUID, jobUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
jobUIDStringBatch job UID, as returned by `CreateJob`.
Return type

JobDetail

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getJobRun

JobRun getJobRun(projectOrProductUID, reportUID, opts)

Get a job run

Get a job run's status and, with `view=detail`, its full results. Returns 404 if the run doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let reportUID = "my-reconciliation-job-1707654321000"; // String | Job run UID, as returned by `RunJob`.
let opts = {
  view: "'summary'", // String | Controls the level of detail returned: 'summary' returns metadata only, 'detail' returns the full result payload
};
apiInstance.getJobRun(projectOrProductUID, reportUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
reportUIDStringJob run UID, as returned by `RunJob`.
viewStringControls the level of detail returned: 'summary' returns metadata only, 'detail' returns the full result payload[optional] [default to 'summary']
Return type

JobRun

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getJobRuns

GetJobRuns200Response getJobRuns(projectOrProductUID, jobUID, opts)

List a job's runs

List a batch job's runs, optionally filtered by status or dry-run flag. Returns 404 if the job doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
let opts = {
  status: "status_example", // String | Return only runs with this status.
  dryRun: true, // Boolean | If set, return only dry runs (`true`) or only real runs (`false`).
};
apiInstance.getJobRuns(projectOrProductUID, jobUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
jobUIDStringBatch job UID, as returned by `CreateJob`.
statusStringReturn only runs with this status.[optional]
dryRunBooleanIf set, return only dry runs (`true`) or only real runs (`false`).[optional]
Return type

GetJobRuns200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getJobs

GetJobs200Response getJobs(projectOrProductUID)

List batch jobs

List a project's batch jobs with their latest run's status. A batch job applies changes, such as environment variables, to a selected set of devices.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getJobs(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

GetJobs200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

runJob

RunJob200Response runJob(projectOrProductUID, jobUID, opts)

Run a batch job

Start a run of a batch job and return its run UID. The run continues in the background, and `GetJobRun` shows its progress. With `dry_run=true`, it reports what would change without changing anything. Requires the Owner or Developer role. Returns 404 if the job doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
let opts = {
  dryRun: false, // Boolean | If true, report what the job would change without changing anything.
};
apiInstance.runJob(projectOrProductUID, jobUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
jobUIDStringBatch job UID, as returned by `CreateJob`.
dryRunBooleanIf true, report what the job would change without changing anything.[optional] [default to false]
Return type

RunJob200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

Monitor API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
createMonitorPOST /v1/projects/{projectOrProductUID}/monitorsCreate a monitor
deleteMonitorDELETE /v1/projects/{projectOrProductUID}/monitors/{monitorUID}Delete a monitor
getMonitorGET /v1/projects/{projectOrProductUID}/monitors/{monitorUID}Get a monitor
getMonitorsGET /v1/projects/{projectOrProductUID}/monitorsList monitors
updateMonitorPUT /v1/projects/{projectOrProductUID}/monitors/{monitorUID}Update a monitor

createMonitor

Monitor createMonitor(projectOrProductUID, createMonitor)

Create a monitor

Create a monitor that raises an alert and notifies email, Slack or Twilio when its condition holds. It can watch an event value (`event`, the default), devices going quiet (`heartbeat`), or data usage (`usage`). Requires the Owner or Developer role. Returns 403 if the project's plan doesn't allow the monitor, and 400 for invalid settings.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createMonitor = new NotehubJs.CreateMonitor(); // CreateMonitor | Body or payload of monitor to be created
apiInstance.createMonitor(projectOrProductUID, createMonitor).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
createMonitorCreateMonitorBody or payload of monitor to be created
Return type

Monitor

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

deleteMonitor

Monitor deleteMonitor(projectOrProductUID, monitorUID)

Delete a monitor

Delete a monitor so it stops raising alerts. Returns an empty monitor object. To pause it instead, set `disabled` with `UpdateMonitor`. Requires the Owner or Developer role. Returns 404 if the monitor never existed; deleting it again succeeds.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
apiInstance.deleteMonitor(projectOrProductUID, monitorUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
monitorUIDStringMonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
Return type

Monitor

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getMonitor

Monitor getMonitor(projectOrProductUID, monitorUID)

Get a monitor

Get one monitor's settings and whether it's in alert. Slack and Twilio credentials in `alert_routes` come back as `(omitted)`. Returns 404 if the monitor never existed; a deleted monitor is still returned.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
apiInstance.getMonitor(projectOrProductUID, monitorUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
monitorUIDStringMonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
Return type

Monitor

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getMonitors

[Monitor] getMonitors(projectOrProductUID)

List monitors

List a project's monitors with their settings and whether each is in alert. For the alerts they've raised, use `GetAlerts`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getMonitors(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

[Monitor]

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

updateMonitor

Monitor updateMonitor(projectOrProductUID, monitorUID, monitor)

Update a monitor

Replace a monitor's settings with the whole monitor, as `GetMonitor` returns it. Omitted fields are cleared or reset, except `source_type`, `fleet_filter`, `notefile_filter`, `condition_type`, `aggregate_window` and `alert_routes`. Slack and Twilio credentials left as `(omitted)` are kept. Requires the Owner or Developer role. Returns 403 if the plan doesn't allow a new `source_type`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
let monitor = new NotehubJs.Monitor(); // Monitor | Body or payload of monitor to be created
apiInstance.updateMonitor(projectOrProductUID, monitorUID, monitor).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
monitorUIDStringMonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
monitorMonitorBody or payload of monitor to be created
Return type

Monitor

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

Organization API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
getOrganizationGET /v1/organizations/{organizationUID}Get an organization
getOrganizationBalanceHistoryGET /v1/organizations/{organizationUID}/balance-historyGet an organization's daily balance
getOrganizationsGET /v1/organizationsList your organizations

getOrganization

GetOrganization200Response getOrganization(organizationUID)

Get an organization

Get an organization's name, owner, contact email and current plan. The plan has its type, event capacity, billing period and remaining balance. For the daily history, use `GetOrganizationBalanceHistory`. Requires the `org_admin`, `billing_manager` or `org_support` role in the organization. Returns 403 if your membership is deactivated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.OrganizationApi();
let organizationUID = "00000000-0000-0000-000000000001"; // String | Organization UID. List with `GetOrganizations`.
apiInstance.getOrganization(organizationUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
organizationUIDStringOrganization UID. List with `GetOrganizations`.
Return type

GetOrganization200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getOrganizationBalanceHistory

GetOrganizationBalanceHistory200Response getOrganizationBalanceHistory(organizationUID, opts)

Get an organization's daily balance

Get an organization's events used and remaining event capacity for each day. The range is `startDate` to `endDate`, which default to the start of the billing period and today. Requires the `org_admin`, `billing_manager` or `org_support` role in the organization. Returns 400 if `startDate` is after `endDate`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.OrganizationApi();
let organizationUID = "00000000-0000-0000-000000000001"; // String | Organization UID. List with `GetOrganizations`.
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
};
apiInstance.getOrganizationBalanceHistory(organizationUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
organizationUIDStringOrganization UID. List with `GetOrganizations`.
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
Return type

GetOrganizationBalanceHistory200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getOrganizations

GetOrganizations200Response getOrganizations()

List your organizations

List the organizations you belong to, with your role in each. A scoped token gets an empty list. Returns 401 if your email address isn't verified.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.OrganizationApi();
apiInstance.getOrganizations().then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters

This endpoint does not need any parameter.

Return type

GetOrganizations200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

Project API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
addDeviceToFleetsPUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleetsAdd a device to fleets
cloneProjectPOST /v1/projects/{projectOrProductUID}/cloneClone a project
createFleetPOST /v1/projects/{projectOrProductUID}/fleetsCreate a fleet
createProductPOST /v1/projects/{projectOrProductUID}/productsCreate a product
createProjectPOST /v1/projectsCreate a project
createProjectSecretPOST /v1/projects/{projectOrProductUID}/secretsCreate a project secret
deleteDeviceFromFleetsDELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleetsRemove a device from fleets
deleteFirmwareDELETE /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename}Delete host firmware
deleteFleetDELETE /v1/projects/{projectOrProductUID}/fleets/{fleetUID}Delete a fleet
deleteFleetEnvironmentVariableDELETE /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables/{key}Delete a fleet environment variable
deleteProductDELETE /v1/projects/{projectOrProductUID}/products/{productUID}Delete a product
deleteProjectDELETE /v1/projects/{projectOrProductUID}Delete a project
deleteProjectEnvironmentVariableDELETE /v1/projects/{projectOrProductUID}/environment_variables/{key}Delete a project environment variable
deleteProjectSecretDELETE /v1/projects/{projectOrProductUID}/secrets/{secretName}Delete a project secret
disableGlobalEventTransformationPOST /v1/projects/{projectOrProductUID}/global-transformation/disableDisable the global event transformation
downloadFirmwareGET /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename}Download host firmware
enableGlobalEventTransformationPOST /v1/projects/{projectOrProductUID}/global-transformation/enableEnable the global event transformation
getAWSRoleConfigGET /v1/projects/{projectOrProductUID}/aws-role-configGet AWS role configuration for role-based authentication
getDeviceDfuHistoryGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/historyGet a device's firmware update history
getDeviceDfuStatusGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/statusGet a device's firmware update status
getDeviceFleetsGET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleetsList a device's fleets
getDevicesDfuHistoryGET /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/historyList devices' firmware update history
getDevicesDfuStatusGET /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/statusList devices' firmware status
getFirmwareInfoGET /v1/projects/{projectOrProductUID}/firmwareList firmware
getFleetGET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}Get a fleet
getFleetEnvironmentHierarchyGET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_hierarchyGet a fleet's environment hierarchy
getFleetEnvironmentVariablesGET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variablesGet fleet environment variables
getFleetsGET /v1/projects/{projectOrProductUID}/fleetsList fleets
getNotefileSchemasGET /v1/projects/{projectOrProductUID}/schemasList Notefile schemas
getProductsGET /v1/projects/{projectOrProductUID}/productsList a project's products
getProjectGET /v1/projects/{projectOrProductUID}Get a project
getProjectByProductGET /v1/products/{productUID}/projectGet the project for a ProductUID
getProjectEnvironmentHierarchyGET /v1/projects/{projectOrProductUID}/environment_hierarchyGet the project environment hierarchy
getProjectEnvironmentVariablesGET /v1/projects/{projectOrProductUID}/environment_variablesGet project environment variables
getProjectMembersGET /v1/projects/{projectOrProductUID}/membersList project members
getProjectSecretsGET /v1/projects/{projectOrProductUID}/secretsList project secrets
getProjectsGET /v1/projectsList projects
performDfuActionPOST /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/{action}Start or cancel firmware updates
setFleetEnvironmentVariablesPUT /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variablesSet fleet environment variables
setGlobalEventTransformationPOST /v1/projects/{projectOrProductUID}/global-transformationSet the global event transformation
setProjectEnvironmentVariablesPUT /v1/projects/{projectOrProductUID}/environment_variablesSet project environment variables
updateFirmwarePOST /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename}Update host firmware metadata
updateFleetPUT /v1/projects/{projectOrProductUID}/fleets/{fleetUID}Update a fleet
updateProjectSecretPUT /v1/projects/{projectOrProductUID}/secrets/{secretName}Update a project secret
uploadFirmwarePUT /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename}Upload firmware

addDeviceToFleets

GetDeviceFleets200Response addDeviceToFleets(projectOrProductUID, deviceUID, addDeviceToFleetsRequest)

Add a device to fleets

Add a device to one or more fleets, keeping the fleets it's already in, and return all its fleets. Fleets it's already in are skipped, so a retry is safe. Requires the Owner or Developer role. Returns 400 if a fleet doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let addDeviceToFleetsRequest = new NotehubJs.AddDeviceToFleetsRequest(); // AddDeviceToFleetsRequest | The fleets to add the device to.
apiInstance
  .addDeviceToFleets(projectOrProductUID, deviceUID, addDeviceToFleetsRequest)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
addDeviceToFleetsRequestAddDeviceToFleetsRequestThe fleets to add the device to.
Return type

GetDeviceFleets200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

cloneProject

Project cloneProject(projectOrProductUID, cloneProjectRequest)

Clone a project

Create a new project as a copy of this one. Settings, environment variables, transformation, fleets, routes and host firmware are copied; devices, products and members aren't. Copied fleets get new FleetUIDs. Requires the Owner role (400 otherwise), a verified email address (401 otherwise), and permission to create projects in the target organization (403 otherwise).

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let cloneProjectRequest = new NotehubJs.CloneProjectRequest(); // CloneProjectRequest | The new project's name and organization, and what to leave out of the copy.
apiInstance.cloneProject(projectOrProductUID, cloneProjectRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
cloneProjectRequestCloneProjectRequestThe new project's name and organization, and what to leave out of the copy.
Return type

Project

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

createFleet

Fleet createFleet(projectOrProductUID, createFleetRequest)

Create a fleet

Create a fleet in the project. Connectivity assurance is on unless `connectivity_assurance.enabled` is `false`. A second call creates another fleet. Requires the Owner or Developer role. Returns 400 if `label` is missing or empty.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createFleetRequest = new NotehubJs.CreateFleetRequest(); // CreateFleetRequest | The new fleet's name and settings.
apiInstance.createFleet(projectOrProductUID, createFleetRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
createFleetRequestCreateFleetRequestThe new fleet's name and settings.
Return type

Fleet

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

createProduct

Product createProduct(projectOrProductUID, createProductRequest)

Create a product

Add a ProductUID to the project, formed from the caller's reversed email and `product_uid`. For `jane@acme.com` and `sensors` it is `com.acme.jane:sensors`. Requires the Owner or Developer role and a verified email address (400 otherwise). Returns 404 if an `auto_provision_fleets` entry isn't a fleet in this project, and 500 if `product_uid` is invalid or already taken.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createProductRequest = new NotehubJs.CreateProductRequest(); // CreateProductRequest | The new product's UID suffix, name and provisioning settings.
apiInstance.createProduct(projectOrProductUID, createProductRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
createProductRequestCreateProductRequestThe new product's UID suffix, name and provisioning settings.
Return type

Product

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

createProject

Project createProject(createProjectRequest)

Create a project

Create a project in an organization, with one default fleet, no products, and the caller as its Owner. A second call creates another project. Requires a verified email address (401 otherwise) and permission to create projects in the organization (403 otherwise).

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let createProjectRequest = new NotehubJs.CreateProjectRequest(); // CreateProjectRequest | The new project's name and organization.
apiInstance.createProject(createProjectRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
createProjectRequestCreateProjectRequestThe new project's name and organization.
Return type

Project

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

createProjectSecret

ProjectSecret createProjectSecret(projectOrProductUID, createProjectSecretRequest)

Create a project secret

Store a secret value that routes and alerts can reference as `[$$name]` without exposing it. The value can't be read back. Requires the Owner or Developer role. Returns 409 if the name is taken, and 400 if it's invalid.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createProjectSecretRequest = new NotehubJs.CreateProjectSecretRequest(); // CreateProjectSecretRequest |
apiInstance
  .createProjectSecret(projectOrProductUID, createProjectSecretRequest)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
createProjectSecretRequestCreateProjectSecretRequest
Return type

ProjectSecret

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

deleteDeviceFromFleets

GetDeviceFleets200Response deleteDeviceFromFleets(projectOrProductUID, deviceUID, deleteDeviceFromFleetsRequest)

Remove a device from fleets

Remove a device from one or more fleets and return the fleets it's still in. Fleets it isn't in are ignored, so a retry is safe. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let deleteDeviceFromFleetsRequest =
  new NotehubJs.DeleteDeviceFromFleetsRequest(); // DeleteDeviceFromFleetsRequest | The fleets to remove the device from.
apiInstance
  .deleteDeviceFromFleets(
    projectOrProductUID,
    deviceUID,
    deleteDeviceFromFleetsRequest
  )
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
deleteDeviceFromFleetsRequestDeleteDeviceFromFleetsRequestThe fleets to remove the device from.
Return type

GetDeviceFleets200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

deleteFirmware

deleteFirmware(projectOrProductUID, firmwareType, filename)

Delete host firmware

Delete a host firmware file by its stored filename, including its `$` timestamp suffix. Notecard firmware can't be deleted. Requires the Owner or Developer role. Returns 404 if the file doesn't exist, and 400 for a sub-project, whose parent manages host firmware.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String |
let filename = "filename_example"; // String |
apiInstance.deleteFirmware(projectOrProductUID, firmwareType, filename).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
firmwareTypeString
filenameString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteFleet

deleteFleet(projectOrProductUID, fleetUID)

Delete a fleet

Delete a fleet and remove it from all its devices. The devices stay in the project; the fleet's environment variables are deleted. To remove one device from a fleet, use `DeleteDeviceFromFleets`. Requires the Owner or Developer role. Returns 400 if the fleet does not exist, including on a retry.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.deleteFleet(projectOrProductUID, fleetUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteFleetEnvironmentVariable

EnvironmentVariables deleteFleetEnvironmentVariable(projectOrProductUID, fleetUID, key)

Delete a fleet environment variable

Delete one fleet environment variable and return the ones left. Requires the Owner or Developer role. Returns 404 if the fleet or the variable doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let key = "key_example"; // String | Name of the environment variable to delete.
apiInstance
  .deleteFleetEnvironmentVariable(projectOrProductUID, fleetUID, key)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
keyStringName of the environment variable to delete.
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteProduct

deleteProduct(projectOrProductUID, productUID)

Delete a product

Remove a ProductUID from the project. Accepts the UID with or without the `product:` prefix. Requires the Owner or Developer role. Returns 404 if the project has no such ProductUID.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let productUID = "com.blues.bridge:sensors"; // String |
apiInstance.deleteProduct(projectOrProductUID, productUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
productUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteProject

deleteProject(projectOrProductUID)

Delete a project

Delete a project, its ProductUIDs, and every member's access to it. Can't be undone through the API. Requires the Owner or Developer role. Returns 200 with no body.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.deleteProject(projectOrProductUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteProjectEnvironmentVariable

EnvironmentVariables deleteProjectEnvironmentVariable(projectOrProductUID, key)

Delete a project environment variable

Delete one project environment variable and return the ones left. Deleting a variable that doesn't exist still succeeds. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let key = "key_example"; // String | Name of the environment variable to delete.
apiInstance.deleteProjectEnvironmentVariable(projectOrProductUID, key).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
keyStringName of the environment variable to delete.
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

deleteProjectSecret

deleteProjectSecret(projectOrProductUID, secretName)

Delete a project secret

Delete a project secret. Routes and alerts that still reference it can no longer resolve it. Requires the Owner or Developer role. Returns 404 if the secret doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let secretName = "secretName_example"; // String | Name of the secret, as listed by `GetProjectSecrets`.
apiInstance.deleteProjectSecret(projectOrProductUID, secretName).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
secretNameStringName of the secret, as listed by `GetProjectSecrets`.
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

disableGlobalEventTransformation

disableGlobalEventTransformation(projectOrProductUID)

Disable the global event transformation

Stop applying the project's global event transformation to new events. The expression is kept, so `EnableGlobalEventTransformation` can turn it back on. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent's transformation applies.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.disableGlobalEventTransformation(projectOrProductUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

downloadFirmware

File downloadFirmware(projectOrProductUID, firmwareType, filename)

Download host firmware

Download a host firmware binary by its stored filename, including its `$` timestamp suffix. Notecard firmware can't be downloaded (400). Requires the Owner or Developer role. Returns 404 if the file doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let filename = "filename_example"; // String |
apiInstance.downloadFirmware(projectOrProductUID, firmwareType, filename).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
firmwareTypeStringWhich firmware: `host` (the host microcontroller's) or `notecard`.
filenameString
Return type

File

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/octet-stream, application/json

enableGlobalEventTransformation

enableGlobalEventTransformation(projectOrProductUID)

Enable the global event transformation

Resume applying the project's global event transformation to new events, without changing the expression. Undoes `DisableGlobalEventTransformation`. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent's transformation applies.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.enableGlobalEventTransformation(projectOrProductUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getAWSRoleConfig

AWSRoleConfig getAWSRoleConfig(projectOrProductUID)

Get AWS role configuration for role-based authentication

Get the AWS account ID and External ID for the IAM role trust policy used by AWS routes with role-based authentication. The External ID is created on the first call and stays the same after that.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getAWSRoleConfig(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

AWSRoleConfig

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceDfuHistory

DeviceDfuHistory getDeviceDfuHistory(projectOrProductUID, deviceUID, firmwareType)

Get a device's firmware update history

Get a device's current host or Notecard firmware version and every firmware update requested for it, newest first. For just the latest update, use `GetDeviceDfuStatus`. Returns 400 if the device isn't in the project.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
apiInstance
  .getDeviceDfuHistory(projectOrProductUID, deviceUID, firmwareType)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
firmwareTypeStringWhich firmware: `host` (the host microcontroller's) or `notecard`.
Return type

DeviceDfuHistory

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceDfuStatus

DeviceDfuStatus getDeviceDfuStatus(projectOrProductUID, deviceUID, firmwareType)

Get a device's firmware update status

Get a device's current host or Notecard firmware version and its latest firmware update. Includes whether an update is in progress. For every past update, use `GetDeviceDfuHistory`. Returns 400 if the device isn't in the project.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
apiInstance
  .getDeviceDfuStatus(projectOrProductUID, deviceUID, firmwareType)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
firmwareTypeStringWhich firmware: `host` (the host microcontroller's) or `notecard`.
Return type

DeviceDfuStatus

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDeviceFleets

GetDeviceFleets200Response getDeviceFleets(projectOrProductUID, deviceUID)

List a device's fleets

List the fleets a device belongs to, with only each fleet's UID, label and creation time. For a fleet's full details use `GetFleet`. Returns 404 if the device isn't in the project.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceFleets(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
deviceUIDString
Return type

GetDeviceFleets200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDevicesDfuHistory

DeviceDfuHistoryPage getDevicesDfuHistory(projectOrProductUID, firmwareType, opts)

List devices' firmware update history

List every host or Notecard firmware update requested for each matching device, newest first. Includes each device's current firmware version. For just the latest update, use `GetDevicesDfuStatus`. Paginated, by page or `cursor`. With a `cursor`, changes made through fleet or project firmware settings don't appear until the device itself is next updated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  sortBy: "'captured'", // String |
  sortOrder: "'asc'", // String |
  deviceUID: ["null"], // [String] | A DeviceUID.
  tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
  serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  fleetUID: "fleetUID_example", // String |
  notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getDevicesDfuHistory(projectOrProductUID, firmwareType, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
firmwareTypeStringWhich firmware: `host` (the host microcontroller's) or `notecard`.
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
sortByString[optional] [default to 'captured']
sortOrderString[optional] [default to 'asc']
deviceUID[String]A DeviceUID.[optional]
tag[String]Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`.[optional]
serialNumber[String]Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
fleetUIDString[optional]
notecardFirmware[String]Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
location[String]Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
hostFirmware[String]Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
productUID[String]ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
sku[String]SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
Return type

DeviceDfuHistoryPage

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDevicesDfuStatus

DeviceDfuStatusPage getDevicesDfuStatus(projectOrProductUID, firmwareType, opts)

List devices' firmware status

List the host or Notecard firmware version each matching device runs now, with its latest firmware update. Use this to find which firmware devices run. Paginated, by page or `cursor`. With a `cursor`, changes made through fleet or project firmware settings don't appear until the device itself is next updated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  sortBy: "'captured'", // String |
  sortOrder: "'asc'", // String |
  deviceUID: ["null"], // [String] | A DeviceUID.
  tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
  serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  fleetUID: "fleetUID_example", // String |
  notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getDevicesDfuStatus(projectOrProductUID, firmwareType, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
firmwareTypeStringWhich firmware: `host` (the host microcontroller's) or `notecard`.
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
sortByString[optional] [default to 'captured']
sortOrderString[optional] [default to 'asc']
deviceUID[String]A DeviceUID.[optional]
tag[String]Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`.[optional]
serialNumber[String]Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
fleetUIDString[optional]
notecardFirmware[String]Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
location[String]Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
hostFirmware[String]Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
productUID[String]ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
sku[String]SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
Return type

DeviceDfuStatusPage

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getFirmwareInfo

[FirmwareInfo] getFirmwareInfo(projectOrProductUID, opts)

List firmware

List the host firmware uploaded to the project and the Notecard firmware available to it. Text filters match substrings, and unpublished Notecard builds are left out unless `unpublished` is `true`. Not paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  product: "product_example", // String | Only firmware whose product contains this text.
  firmwareType: "firmwareType_example", // String | Only list `host` or `notecard` firmware. Omit for both.
  version: "version_example", // String | Only firmware whose version contains this text.
  target: "target_example", // String | Only firmware whose target contains this text.
  filename: "notecard-7.2.2.16518$20240410043100.bin", // String | Only firmware whose stored filename contains this text.
  md5: "md5_example", // String | Only firmware whose MD5 hash contains this text.
  unpublished: true, // Boolean | If `true`, also list unpublished Notecard firmware.
  sortBy: "'created'", // String | Field to sort by
  sortOrder: "'desc'", // String | Sort order (asc for ascending, desc for descending)
};
apiInstance.getFirmwareInfo(projectOrProductUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
productStringOnly firmware whose product contains this text.[optional]
firmwareTypeStringOnly list `host` or `notecard` firmware. Omit for both.[optional]
versionStringOnly firmware whose version contains this text.[optional]
targetStringOnly firmware whose target contains this text.[optional]
filenameStringOnly firmware whose stored filename contains this text.[optional]
md5StringOnly firmware whose MD5 hash contains this text.[optional]
unpublishedBooleanIf `true`, also list unpublished Notecard firmware.[optional]
sortByStringField to sort by[optional] [default to 'created']
sortOrderStringSort order (asc for ascending, desc for descending)[optional] [default to 'desc']
Return type

[FirmwareInfo]

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getFleet

Fleet getFleet(projectOrProductUID, fleetUID)

Get a fleet

Get one fleet's label, smart rule, watchdog and environment variables. Doesn't include `smart_rule_enabled`. Returns 404 if the fleet doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleet(projectOrProductUID, fleetUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
Return type

Fleet

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getFleetEnvironmentHierarchy

EnvTreeJsonNode getFleetEnvironmentHierarchy(projectOrProductUID, fleetUID)

Get a fleet's environment hierarchy

Get a fleet's environment variables and the project variables it inherits, as a tree. Each variable has its precedence and whether it is used or overridden. Returns 500 if the fleet doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleetEnvironmentHierarchy(projectOrProductUID, fleetUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
Return type

EnvTreeJsonNode

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getFleetEnvironmentVariables

EnvironmentVariables getFleetEnvironmentVariables(projectOrProductUID, fleetUID)

Get fleet environment variables

Get the environment variables set on a fleet, with their notes. They override project variables, and device variables override them. Returns 404 if the fleet doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleetEnvironmentVariables(projectOrProductUID, fleetUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getFleets

GetDeviceFleets200Response getFleets(projectOrProductUID)

List fleets

List the project's fleets with each one's label, smart rule, watchdog and environment variables. Doesn't include `smart_rule_enabled`. Not paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getFleets(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

GetDeviceFleets200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getNotefileSchemas

[NotefileSchema] getNotefileSchemas(projectOrProductUID)

List Notefile schemas

List the project's Notefiles, each with the event `body` fields Notehub has seen in it and their JSON types. Inferred from received events.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getNotefileSchemas(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

[NotefileSchema]

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProducts

GetProducts200Response getProducts(projectOrProductUID)

List a project's products

List the project's ProductUIDs, each with its label, auto-provision fleets, and whether new devices start disabled. UIDs here include the `product:` prefix; `CreateProduct` returns them without it. Not paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProducts(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

GetProducts200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProject

Project getProject(projectOrProductUID)

Get a project

Get a project's label, creation time, contacts, and the caller's `role` in it. Accepts a ProductUID in place of the ProjectUID.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProject(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

Project

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProjectByProduct

Project getProjectByProduct(productUID)

Get the project for a ProductUID

Get the project that a ProductUID belongs to. Returns the same object as `GetProject`, which also accepts a ProductUID in place of a ProjectUID.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let productUID = com.blues.airnote; // String | ProductUID, e.g. `com.blues.airnote`, with or without the `product:` prefix.
apiInstance.getProjectByProduct(productUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
productUIDStringProductUID, e.g. `com.blues.airnote`, with or without the `product:` prefix.
Return type

Project

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProjectEnvironmentHierarchy

EnvTreeJsonNode getProjectEnvironmentHierarchy(projectOrProductUID)

Get the project environment hierarchy

Get the project's environment variables as a one-node environment hierarchy tree. The fleet and device hierarchy operations use the same format; for plain key/value pairs, use `GetProjectEnvironmentVariables`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectEnvironmentHierarchy(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

EnvTreeJsonNode

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProjectEnvironmentVariables

EnvironmentVariables getProjectEnvironmentVariables(projectOrProductUID)

Get project environment variables

Get the environment variables set on the project, with their notes. Fleet and device variables override these; for what a device actually sees, use `GetDeviceEnvironmentVariables`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectEnvironmentVariables(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProjectMembers

GetProjectMembers200Response getProjectMembers(projectOrProductUID)

List project members

List the project's members with each one's name and role. Emails are filled in only when the caller is an Owner. Not paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectMembers(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

GetProjectMembers200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProjectSecrets

GetProjectSecretsResponse getProjectSecrets(projectOrProductUID)

List project secrets

List the project's secrets by name, with who created and last changed each one and when. Values are never returned.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectSecrets(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

GetProjectSecretsResponse

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getProjects

GetProjects200Response getProjects()

List projects

List every project the caller is a member of, with the caller's `role` in each. Not paginated.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
apiInstance.getProjects().then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters

This endpoint does not need any parameter.

Return type

GetProjects200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

performDfuAction

performDfuAction(projectOrProductUID, firmwareType, action, opts)

Start or cancel firmware updates

Start or cancel a host or Notecard firmware update on every device matching the filters. With no filters, that is every device in the project. `update` sets each device's `_fw` or `_fwc` variable to `filename`. Requires the Owner or Developer role. `update` returns 404 if the file isn't found, and can return 400 if a matching device already has an update in progress.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let action = "action_example"; // String | - `update`: start updating to the firmware in `filename` - `cancel`: cancel any update in progress
let opts = {
  deviceUID: ["null"], // [String] | A DeviceUID.
  tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
  serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  fleetUID: "fleetUID_example", // String |
  notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
  dfuActionRequest: new NotehubJs.DfuActionRequest(), // DfuActionRequest | Which firmware in the case of an update action
};
apiInstance
  .performDfuAction(projectOrProductUID, firmwareType, action, opts)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
firmwareTypeStringWhich firmware: `host` (the host microcontroller's) or `notecard`.
actionString- `update`: start updating to the firmware in `filename` - `cancel`: cancel any update in progress
deviceUID[String]A DeviceUID.[optional]
tag[String]Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`.[optional]
serialNumber[String]Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
fleetUIDString[optional]
notecardFirmware[String]Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
location[String]Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
hostFirmware[String]Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
productUID[String]ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
sku[String]SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally.[optional]
dfuActionRequestDfuActionRequestWhich firmware in the case of an update action[optional]
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

setFleetEnvironmentVariables

EnvironmentVariables setFleetEnvironmentVariables(projectOrProductUID, fleetUID, environmentVariables)

Set fleet environment variables

Add or change a fleet's environment variables; variables you don't send keep their values. A value of `""` or `-` deletes that variable. Setting `_fw`, `_fwc` or `_fwm` starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 404 if the fleet doesn't exist, and 400 if a note's key isn't a variable.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let environmentVariables = new NotehubJs.EnvironmentVariables(); // EnvironmentVariables | The variables to add or change, and optional notes.
apiInstance
  .setFleetEnvironmentVariables(
    projectOrProductUID,
    fleetUID,
    environmentVariables
  )
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
environmentVariablesEnvironmentVariablesThe variables to add or change, and optional notes.
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

setGlobalEventTransformation

setGlobalEventTransformation(projectOrProductUID, body)

Set the global event transformation

Set the project's JSONata expression that rewrites each new event before it's stored and routed. It can change `body`, `payload`, `details`, `file` and `note`, or drop the event with `$doNotRoute()`; an event it fails on is kept with `error` set. Doesn't enable or disable it. Requires the Owner or Developer role. Returns 400 if it doesn't compile, or for a sub-project, which uses its parent's.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let body = "body_example"; // String | JSONata expression as plain text. An empty body clears the transformation.
apiInstance.setGlobalEventTransformation(projectOrProductUID, body).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
bodyStringJSONata expression as plain text. An empty body clears the transformation.
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: text/plain
  • Accept: application/json

setProjectEnvironmentVariables

EnvironmentVariables setProjectEnvironmentVariables(projectOrProductUID, opts)

Set project environment variables

Add or change project environment variables; variables you don't send keep their values. A value of `""` or `-` deletes that variable. Setting `_fw`, `_fwc` or `_fwm` starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 400 if a note's key isn't a variable.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  environmentVariables: new NotehubJs.EnvironmentVariables(), // EnvironmentVariables |
};
apiInstance.setProjectEnvironmentVariables(projectOrProductUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
environmentVariablesEnvironmentVariables[optional]
Return type

EnvironmentVariables

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

updateFirmware

FirmwareInfo updateFirmware(projectOrProductUID, firmwareType, filename, updateHostFirmwareRequest)

Update host firmware metadata

Change a host firmware file's `version`, `notes` or `info`; fields you leave out or send empty keep their values. Use the stored filename, including its `$` timestamp suffix. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent manages host firmware, and 404 if the file doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String |
let filename = "filename_example"; // String |
let updateHostFirmwareRequest = new NotehubJs.UpdateHostFirmwareRequest(); // UpdateHostFirmwareRequest | Firmware metadata fields to update. All fields are optional; only provided fields will be updated.
apiInstance
  .updateFirmware(
    projectOrProductUID,
    firmwareType,
    filename,
    updateHostFirmwareRequest
  )
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
firmwareTypeString
filenameString
updateHostFirmwareRequestUpdateHostFirmwareRequestFirmware metadata fields to update. All fields are optional; only provided fields will be updated.
Return type

FirmwareInfo

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

updateFleet

Fleet updateFleet(projectOrProductUID, fleetUID, updateFleetRequest)

Update a fleet

Change a fleet's label, smart rule, watchdog or connectivity assurance, or add and remove devices. Always send `smart_rule_enabled`; leaving it out turns the smart rule off. Empty `label` or `smart_rule` keeps the current value; `-` clears `smart_rule`. Requires the Owner or Developer role. Returns 400 for an unknown fleet or `label` of `-`, and for a bad DeviceUID after saving the other changes.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let updateFleetRequest = new NotehubJs.UpdateFleetRequest(); // UpdateFleetRequest | The fields to change. Fields left out keep their values, except `smart_rule_enabled`.
apiInstance.updateFleet(projectOrProductUID, fleetUID, updateFleetRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
fleetUIDString
updateFleetRequestUpdateFleetRequestThe fields to change. Fields left out keep their values, except `smart_rule_enabled`.
Return type

Fleet

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

updateProjectSecret

ProjectSecret updateProjectSecret(projectOrProductUID, secretName, updateProjectSecretRequest)

Update a project secret

Replace the value of an existing project secret. Routes and alerts that reference it use the new value from then on. Requires the Owner or Developer role. Returns 404 if the secret doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let secretName = "secretName_example"; // String | Name of the secret, as listed by `GetProjectSecrets`.
let updateProjectSecretRequest = new NotehubJs.UpdateProjectSecretRequest(); // UpdateProjectSecretRequest |
apiInstance
  .updateProjectSecret(
    projectOrProductUID,
    secretName,
    updateProjectSecretRequest
  )
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
secretNameStringName of the secret, as listed by `GetProjectSecrets`.
updateProjectSecretRequestUpdateProjectSecretRequest
Return type

ProjectSecret

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

uploadFirmware

FirmwareInfo uploadFirmware(projectOrProductUID, firmwareType, filename, body, opts)

Upload firmware

Upload a host or Notecard firmware binary. Notehub usually adds a timestamp to `filename`; use the returned `filename` from then on. Requires the Owner or Developer role. Returns 400 for host firmware on a sub-project, whose parent manages it, and 500 for a wrong file type or a file over the limit: 1.5 MB for host firmware, 2 MB for `notecard-s3-*` and 1 MB for other Notecard firmware.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let filename = "filename_example"; // String | Name to store the file under. Notehub adds `$` and a timestamp before the extension, except for a Notecard firmware name that already contains `$`.
let body = "/path/to/file"; // File | contents of the firmware binary
let opts = {
  version: "version_example", // String | Firmware version (optional). If not provided, the version will be extracted from firmware binary if available, otherwise left empty
  notes: "notes_example", // String | Optional notes describing what's different about this firmware version
};
apiInstance
  .uploadFirmware(projectOrProductUID, firmwareType, filename, body, opts)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
firmwareTypeStringWhich firmware: `host` (the host microcontroller's) or `notecard`.
filenameStringName to store the file under. Notehub adds `$` and a timestamp before the extension, except for a Notecard firmware name that already contains `$`.
bodyFilecontents of the firmware binary
versionStringFirmware version (optional). If not provided, the version will be extracted from firmware binary if available, otherwise left empty[optional]
notesStringOptional notes describing what's different about this firmware version[optional]
Return type

FirmwareInfo

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/octet-stream
  • Accept: application/json

Route API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
createRoutePOST /v1/projects/{projectOrProductUID}/routesCreate a route
deleteRouteDELETE /v1/projects/{projectOrProductUID}/routes/{routeUID}Delete a route
getRouteGET /v1/projects/{projectOrProductUID}/routes/{routeUID}Get a route
getRouteLogsByRouteGET /v1/projects/{projectOrProductUID}/routes/{routeUID}/route-logsList a route's logs
getRoutesGET /v1/projects/{projectOrProductUID}/routesList routes
updateRoutePUT /v1/projects/{projectOrProductUID}/routes/{routeUID}Update a route

createRoute

NotehubRoute createRoute(projectOrProductUID, notehubRoute)

Create a route

Create a route that sends a project's events to a destination such as a URL, an MQTT broker or a cloud service. Set `type` and fill in the object it names. Omit `fleets` to send every fleet's events. Unknown FleetUIDs are ignored, so `fleets: []` or a list of only unknown UIDs gives a route that sends nothing. Requires the Owner or Developer role. Returns 400 for invalid settings.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let notehubRoute = {
  http: {
    disable_http_headers: false,
    filter: {},
    fleets: ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
    http_headers: { "X-My-Header": "value" },
    throttle_ms: 100,
    timeout: 5000,
    transform: {},
    url: "https://example.com/ingest",
  },
  label: "Route Label",
}; // NotehubRoute | Route to be created
apiInstance.createRoute(projectOrProductUID, notehubRoute).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
notehubRouteNotehubRouteRoute to be created
Return type

NotehubRoute

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

deleteRoute

deleteRoute(projectOrProductUID, routeUID)

Delete a route

Delete a route so it stops sending events. To pause it instead, set `disabled` with `UpdateRoute`. Requires the Owner or Developer role.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
apiInstance.deleteRoute(projectOrProductUID, routeUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
routeUIDStringRouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
Return type

null (empty response body)

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getRoute

NotehubRoute getRoute(projectOrProductUID, routeUID)

Get a route

Get one route's full settings: destination, filter, transform and fleets. Secrets such as passwords and keys come back as `(omitted)`. Requires the Owner or Developer role. Viewers can use `GetRoutes`. Returns 404 if the route doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
apiInstance.getRoute(projectOrProductUID, routeUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
routeUIDStringRouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
Return type

NotehubRoute

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getRouteLogsByRoute

[RouteLog] getRouteLogsByRoute(projectOrProductUID, routeUID, opts)

List a route's logs

List a route's attempts to send events, newest first, with each one's event, response status, body and duration. Filter by device, notefile, date, success or HTTP status. For one event, use `GetRouteLogsByEvent`. Paginated. Returns 404 if the route doesn't exist.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
let opts = {
  pageSize: 1000, // Number |
  pageNum: 1, // Number |
  cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
  deviceUID: ["null"], // [String] | A DeviceUID.
  sortBy: "'date'", // String | Field to sort by. - `date`: when the attempt was made - `event`: the order the events arrived in, then the attempt time
  sortOrder: "'desc'", // String | Sort direction. - `asc`: oldest first - `desc`: newest first
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  systemFilesOnly: true, // Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.
  mostRecentOnly: true, // Boolean | If true, return only the latest attempt for each event.
  files: "_health.qo, data.qo", // String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.
  routingStatus: failure, // [String] | Return only attempts with this outcome. - `success`: the destination accepted the event - `failure`: the attempt failed
  responseStatus: 500, // [String] | Response status codes to include, e.g. `500`.
};
apiInstance.getRouteLogsByRoute(projectOrProductUID, routeUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
routeUIDStringRouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
pageSizeNumber[optional] [default to 1000]
pageNumNumber[optional] [default to 1]
cursorStringIf supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.[optional]
deviceUID[String]A DeviceUID.[optional]
sortByStringField to sort by. - `date`: when the attempt was made - `event`: the order the events arrived in, then the attempt time[optional] [default to 'date']
sortOrderStringSort direction. - `asc`: oldest first - `desc`: newest first[optional] [default to 'desc']
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
systemFilesOnlyBooleanIf true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.[optional]
mostRecentOnlyBooleanIf true, return only the latest attempt for each event.[optional]
filesStringComma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.[optional]
routingStatus[String]Return only attempts with this outcome. - `success`: the destination accepted the event - `failure`: the attempt failed[optional]
responseStatus[String]Response status codes to include, e.g. `500`.[optional]
Return type

[RouteLog]

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getRoutes

[NotehubRouteSummary] getRoutes(projectOrProductUID)

List routes

List a project's routes with their type and label and whether they're disabled, without their settings. For a route's settings, use `GetRoute`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getRoutes(projectOrProductUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
Return type

[NotehubRouteSummary]

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

updateRoute

NotehubRoute updateRoute(projectOrProductUID, routeUID, notehubRoute)

Update a route

Change a route's settings. Fields you leave out keep their values, and a secret sent back as `(omitted)` is kept, but leaving out `notes` clears it. Requires the Owner or Developer role. Returns 404 if the route doesn't exist, and 400 for invalid settings.

Example
import * as NotehubJs from '@blues-inc/notehub-js';
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications['personalAccessToken'];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
let notehubRoute = {
  "http" {
    "filter": {
      "type": "include",
      "system_notefiles": true,
      "files": ["somefile.qo"],
    },
    "throttle_ms": 50,
    "url": "http://new-route.url",
  },
}
; // NotehubRoute | Route settings to be updated
apiInstance.updateRoute(projectOrProductUID, routeUID, notehubRoute).then((data) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
routeUIDStringRouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
notehubRouteNotehubRouteRoute settings to be updated
Return type

NotehubRoute

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: application/json
  • Accept: application/json

Usage API

All URIs are relative to https://api.notefile.net

MethodHTTP requestDescription
getApiUsageGET /v1/projects/{projectOrProductUID}/usage/apiGet billable API usage
getDataUsageGET /v1/projects/{projectOrProductUID}/usage/dataGet cellular and satellite data usage
getEventsUsageGET /v1/projects/{projectOrProductUID}/usage/eventsGet event usage
getRouteLogsUsageGET /v1/projects/{projectOrProductUID}/usage/route-logsGet route log usage
getSessionsUsageGET /v1/projects/{projectOrProductUID}/usage/sessionsGet session usage

getApiUsage

GetApiUsage200Response getApiUsage(projectOrProductUID, period, opts)

Get billable API usage

Count a project's billable Notehub API requests per day, week or month, by endpoint. Only requests billed against the project's plan are counted. Returns 400 if `startDate` is after `endDate`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
};
apiInstance.getApiUsage(projectOrProductUID, period, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
periodStringThe length of time each data point covers.
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
limitNumberThe most data points to return. If there are more, `truncated` is true.[optional] [default to 200000]
Return type

GetApiUsage200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getDataUsage

GetDataUsage200Response getDataUsage(projectOrProductUID, period, opts)

Get cellular and satellite data usage

Get the cellular and satellite data a project's devices used, in bytes. It's counted per day, week or month, by device, fleet or the whole project. If there are more data points than `limit`, the rest are dropped and `truncated` is true. Returns 400 for an unknown device, or if `endDate` is before `startDate`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  deviceUID: ["null"], // [String] | A DeviceUID.
  fleetUID: ["null"], // [String] | Filter by FleetUID
  limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
  aggregate: "'device'", // String | How to group the counts, such as per device or one total for the project.
};
apiInstance.getDataUsage(projectOrProductUID, period, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
periodStringThe length of time each data point covers.
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
deviceUID[String]A DeviceUID.[optional]
fleetUID[String]Filter by FleetUID[optional]
limitNumberThe most data points to return. If there are more, `truncated` is true.[optional] [default to 200000]
aggregateStringHow to group the counts, such as per device or one total for the project.[optional] [default to 'device']
Return type

GetDataUsage200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getEventsUsage

UsageEventsResponse getEventsUsage(projectOrProductUID, period, opts)

Get event usage

Count a project's events per day, week or month, by device, fleet or the whole project, optionally per notefile. Summaries lag; with `period=day` and no `endDate`, the latest day is filled in from recent events unless `skipRecentData` is true. Returns 400 if `startDate` is after `endDate`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  deviceUID: ["null"], // [String] | A DeviceUID.
  fleetUID: ["null"], // [String] | Filter by FleetUID
  limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
  aggregate: "'device'", // String | How to group the counts, such as per device or one total for the project.
  notefile: ["null"], // [String] | Count only events from these notefiles.
  skipRecentData: false, // Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects.
  includeNotefiles: false, // Boolean | If true, include event counts for each notefile.
};
apiInstance.getEventsUsage(projectOrProductUID, period, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
periodStringThe length of time each data point covers.
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
deviceUID[String]A DeviceUID.[optional]
fleetUID[String]Filter by FleetUID[optional]
limitNumberThe most data points to return. If there are more, `truncated` is true.[optional] [default to 200000]
aggregateStringHow to group the counts, such as per device or one total for the project.[optional] [default to 'device']
notefile[String]Count only events from these notefiles.[optional]
skipRecentDataBooleanIf true, return only summarized data, without filling in the latest day. Faster for large projects.[optional] [default to false]
includeNotefilesBooleanIf true, include event counts for each notefile.[optional] [default to false]
Return type

UsageEventsResponse

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getRouteLogsUsage

GetRouteLogsUsage200Response getRouteLogsUsage(projectOrProductUID, period, opts)

Get route log usage

Count a project's attempts to send events to routes per day, week or month, by route or for the whole project. If there are more data points than `limit`, the rest are dropped and `truncated` is true.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  routeUID: ["null"], // [String] | A RouteUID.
  limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
  aggregate: "'route'", // String | How to group the counts, per route or one total for the project.
  skipRecentData: false, // Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects.
};
apiInstance.getRouteLogsUsage(projectOrProductUID, period, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
periodStringThe length of time each data point covers.
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
routeUID[String]A RouteUID.[optional]
limitNumberThe most data points to return. If there are more, `truncated` is true.[optional] [default to 200000]
aggregateStringHow to group the counts, per route or one total for the project.[optional] [default to 'route']
skipRecentDataBooleanIf true, return only summarized data, without filling in the latest day. Faster for large projects.[optional] [default to false]
Return type

GetRouteLogsUsage200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json

getSessionsUsage

GetSessionsUsage200Response getSessionsUsage(projectOrProductUID, period, opts)

Get session usage

Count a project's device sessions per day, week or month, by device, fleet or the whole project. If there are more data points than `limit`, the rest are dropped and `truncated` is true. Returns 400 if `startDate` is after `endDate`.

Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";

let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
  startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
  endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
  deviceUID: ["null"], // [String] | A DeviceUID.
  fleetUID: ["null"], // [String] | Filter by FleetUID
  limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
  aggregate: "'device'", // String | How to group the counts, such as per device or one total for the project.
  skipRecentData: false, // Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects.
};
apiInstance.getSessionsUsage(projectOrProductUID, period, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
Parameters
NameTypeDescriptionNotes
projectOrProductUIDString
periodStringThe length of time each data point covers.
startDateNumberStart date for filtering results, specified as a Unix timestamp[optional]
endDateNumberEnd date for filtering results, specified as a Unix timestamp[optional]
deviceUID[String]A DeviceUID.[optional]
fleetUID[String]Filter by FleetUID[optional]
limitNumberThe most data points to return. If there are more, `truncated` is true.[optional] [default to 200000]
aggregateStringHow to group the counts, such as per device or one total for the project.[optional] [default to 'device']
skipRecentDataBooleanIf true, return only summarized data, without filling in the latest day. Faster for large projects.[optional] [default to false]
Return type

GetSessionsUsage200Response

Authorization

personalAccessToken

HTTP request headers
  • Content-Type: Not defined
  • Accept: application/json
Can we improve this page? Send us feedback
© 2026 Blues Inc.
© 2026 Blues Inc.
AboutDocsAPI ReferenceTermsPrivacy