---
title: Device API - Notehub API Reference
description: The Notehub device API provides RESTful methods that can be used to GET, POST, and DELETE data related to devices.
source_url: https://dev.blues.io/api-reference/notehub-api/device-api/
canonical_url: https://dev.blues.io/api-reference/notehub-api/device-api/
markdown_url: https://dev.blues.io/api-reference/notehub-api/device-api.md
---

# Device API

The Notehub device API provides RESTful methods that can be used to `GET`, `POST`, and `DELETE` data related to [devices](https://dev.blues.io/api-reference/glossary.md#device) and [fleets](https://dev.blues.io/api-reference/glossary.md#fleet).

| Name                                                                         | HTTP Request                                                                                    |
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [Get Project Devices](#get-project-devices)                                  | **GET** `/v1/projects/{projectOrProductUID}/devices`                                            |
| [Get Device](#get-device)                                                    | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}`                                |
| [Delete Device](#delete-device)                                              | **DELETE** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}`                             |
| [Disable Device](#disable-device)                                            | **POST** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/disable`                       |
| [Enable Device](#enable-device)                                              | **POST** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/enable`                        |
| [Get Device Environment Hierarchy](#get-device-environment-hierarchy)        | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_hierarchy`          |
| [Delete Device Environment Variable](#delete-device-environment-variable)    | **DELETE** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables/{key}` |
| [Get Device Environment Variables](#get-device-environment-variables)        | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables`          |
| [Set Device Environment Variables](#set-device-environment-variables)        | **PUT** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables`          |
| [Get Device Health Log](#get-device-health-log)                              | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/health-log`                     |
| [Get Device Plans](#get-device-plans)                                        | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/plans`                          |
| [Get Device Latest Events](#get-device-latest-events)                        | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/latest`                         |
| [Get Device Sessions](#get-device-sessions)                                  | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/sessions`                       |
| [Get Device Journeys](#get-device-journeys)                                  | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys`                       |
| [Get Device Journey](#get-device-journey)                                    | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys/{journeyID}`           |
| [Get Fleet Devices](#get-fleet-devices)                                      | **GET** `/v1/projects/{projectOrProductUID}/fleets/{fleetUID}/devices`                          |
| [Get DB Note](#get-db-note)                                                  | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}`    |
| [Get Notefile Changes](#get-notefile-changes)                                | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/changes`     |
| [Add DB Note](#add-db-note)                                                  | **POST** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}`   |
| [Add QI Note](#add-qi-note)                                                  | **POST** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}`            |
| [Update DB Note](#update-db-note)                                            | **PUT** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}`    |
| [Delete Note](#delete-note)                                                  | **DELETE** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}` |
| [Send Signal](#send-signal)                                                  | **POST** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/signal`                        |
| [List Notefiles](#list-notefiles)                                            | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files`                          |
| [List Notefiles (Legacy)](#list-notefiles-legacy) (Deprecated)               | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files/changes`                  |
| [List Pending Notefile Changes](#list-pending-notefile-changes) (Deprecated) | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files/changes/pending`          |
| [Create Notefile](#create-notefile)                                          | **POST** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notefiles/{notefileID}`        |
| [Delete Notefile](#delete-notefile)                                          | **DELETE** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files`                       |
| [Provision Device](#provision-device)                                        | **POST** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/provision`                     |
| [Get Device Public Key](#get-device-public-key)                              | **GET** `/v1/projects/{projectOrProductUID}/devices/{deviceUID}/public-key`                     |
| [Get Device Public Keys](#get-public-keys)                                   | **GET** `/v1/projects/{projectOrProductUID}/devices/public-keys`                                |

## Get Project Devices (Notehub)

Get an array of [devices](https://dev.blues.io/api-reference/glossary.md#device) associated with a Notehub [project](https://dev.blues.io/api-reference/glossary.md#project).

|                                                                                                               |                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                  |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices`                                                                                                                                   |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                 |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                  |

Arguments

### `pageSize`

*integer (optional)*

Specifies the number of devices to be returned by a request (default 50).

### `pageNum`

*integer (optional)*

Specifies the page number of the results returned (useful when the `pageSize` is less than the total number of devices that could be returned). When provided, the `pageNum` must be >= `1`.

### `deviceUID`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of DeviceUIDs of Notehub [devices](https://dev.blues.io/api-reference/glossary.md#device).

### `tag`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more tags to filter the devices by.

### `serialNumber`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of device [serial numbers](https://dev.blues.io/api-reference/glossary.md#serial-number) to filter by.

### `fleetUID`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of [FleetUIDs](https://dev.blues.io/api-reference/glossary.md#fleetuid) to filter by.

### `notecardFirmware`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more Notecard firmware versions to filter the devices by. Any numeric portion of the firmware name like "7.4.2.16888" or "7.4" is acceptable.

### `location`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more locations to filter the devices by. Provide city, state, or country code like "Boston, MA", "Boston", "MA", or "Guildford, ENG, GB" (this field supports partial/case insensitive matches).

### `hostFirmware`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more host firmware versions to filter the devices by. Any string of host firmware like "foo-3.4" or "8.7.6" or "baz-bar-01" is acceptable.

### `productUID`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more [ProductUIDs](https://dev.blues.io/api-reference/glossary.md#productuid) to filter the devices by.

### `sku`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more Notecard SKUs to filter the devices by.

**Basic**

**Bash**

```bash
curl -X GET
   -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices'
   -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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: 50, // Number |
  pageNum: 1, // Number |
  deviceUID: ["null"], // [String] | A Device UID.
  tag: ["null"], // [String] | Tag filter
  serialNumber: ["null"], // [String] | Serial number filter
  fleetUID: ["null"], // [String] |
  notecardFirmware: ["null"], // [String] | Firmware version filter
  location: ["null"], // [String] | Location filter
  hostFirmware: ["null"], // [String] | Host firmware filter
  productUID: ["null"], // [String] |
  sku: ["null"] // [String] | SKU filter
};
apiInstance.getDevices(projectOrProductUID, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.get_devices200_response import GetDevices200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    page_size = 50 # int |  (optional) (default to 50)
    page_num = 1 # int |  (optional) (default to 1)
    device_uid = ["device_uid_example"] # List[str] | A Device UID. (optional)
    tag = ["tag_example"] # List[str] | Tag filter (optional)
    serial_number = ["serial_number_example"] # List[str] | Serial number filter (optional)
    fleet_uid = ["fleet_uid_example"] # List[str] |  (optional)
    notecard_firmware = ["notecard_firmware_example"] # List[str] | Firmware version filter (optional)
    location = ["location_example"] # List[str] | Location filter (optional)
    host_firmware = ["host_firmware_example"] # List[str] | Host firmware filter (optional)
    product_uid = ["product_uid_example"] # List[str] |  (optional)
    sku = ["sku_example"] # List[str] | SKU filter (optional)

    try:
        api_response = api_instance.get_devices(project_or_product_uid, page_size=page_size, page_num=page_num)
        print("The response of DeviceApi->get_devices:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_devices: %s\n" % e)
```

**Optional Params**

**Bash**

```bash
curl -X GET
   -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices?pageSize=<pageSize>&pageNum=<pageNum>&deviceUID=<deviceUID>&tag=<tag>&serialNumber=<serialNumber>&fleetUID=<fleetUID>&notecardFirmware=<notecardFirmware>&location=<location>&hostFirmware=<hostFirmware>&productUID=<productUID>&sku=<sku>'
   -H 'Authorization: Bearer <access_token>'
```

**Response Members**

### `uid`

*string*

The globally-unique identifier of the device.

### `serial_number`

*string*

The user-defined [serial number](https://dev.blues.io/api-reference/glossary.md#product-sn) of the device.

### `provisioned`

*string*

The date and time this device was first provisioned, or put into use.

### `last_activity`

*string*

The date and time this device was last seen by Notehub.

### `contact`

*object*

Contact information for this device, specified via environment variables.

### `product_uid`

*string*

The ProductUID this device is associated with.

### `fleet_uids`

*array*

An array of globally-unique identifiers for the fleet(s) this device is associated with.

### `tower_info`

*object*

An object containing data about the cellular tower last accessed by this device.

### `tower_info.mcc`

*integer*

The mobile country code of the cell tower.

### `tower_info.mnc`

*integer*

The mobile network code of the cell tower, which identifies the mobile operator.

### `tower_info.lac`

*integer*

The location area code of the cell tower, which is a unique identifier of the current location area.

### `tower_info.cell_id`

*integer*

The Cell ID or CID of the cell tower. This is a unique number used to identify each Base Transceiver Station (BTS) or sector of a BTS within a location area code.

### `tower_location`

*object*

An object containing information about the physical location of the cell tower.

### `gps_location`

*object*

An object containing information about the physical location of the device, based on GPS coordinates.

### `triangulated_location`

*object*

An object containing information about the physical location of the device based on triangulated data calculated by multiple cell towers.

### `voltage`

*decimal*

The most recent measure of the voltage from the onboard voltage monitor.

### `temperature`

*decimal*

The most recent temperature measure in celsius from the onboard temperature sensor.

### `has_more`

*boolean*

Defines whether or not there are additional devices beyond this list.

### `dfu`

*object*

Information about the device firmware update status for the Notecard `"type":"card"` or the host MCU `"type":"user"`. The `mode` will be one of:

`"idle"` - nothing downloading or downloaded\
`"error"` - halted and in the error state\
`"downloading"` - transferring data from cloud to module\
`"sideloading"` - transferring data via request to module\
`"ready"` - DFU data is ready/verified and waiting on external storage\
`"ready-retry"` - DFU data is ready/verified and retrying\
`"updating"` - currently updating\
`"completed"` - DFU is done successfully

### `sku`

*string*

The SKU of the Notecard in use. See the [Notecard datasheet dropdown menu](https://dev.blues.io/datasheets/notecard-datasheet.md) for example SKUs.

### `firmware_notecard`

*string*

The firmware version of the Notecard in use.

### `firmware_host`

*string*

The firmware version of the host MCU in use (if any).

### `disabled`

*boolean*

Whether or not the device is disabled.

### `cellular_usage.iccid`

*string (optional)*

The ICCID of the SIM card in use by the device.

### `cellular_usage.used`

*integer (optional)*

The total number of bytes used on the SIM's current data plan.

### `cellular_usage.limit`

*integer (optional)*

The limit in bytes of the SIM's current data plan.

### `cellular_usage.lifetime_used`

*integer (optional)*

The total number of bytes used by the SIM since it was first activated.

### `cellular_usage.last_updated`

*integer (optional)*

The time this usage information was last updated, in seconds since the epoch.

Example Response

```json
{
   "devices":[
      {
         "uid":"dev:000000000000000",
         "serial_number":"",
         "sku": "NOTE-NBGL",
         "provisioned":"2021-02-11T02:37:16Z",
         "last_activity":"2021-05-11T19:37:08Z",
         "firmware_notecard": "{\"org\":\"Blues Wireless\",\"product\":\"Notecard\",\"version\":\"notecard-1.2.3-v11\",\"ver_major\":1,\"ver_minor\":2,\"ver_patch\":3,\"ver_build\":9380,\"built\":\"Apr 16 2020 16:22:56\"}",
         "firmware_host": "{\"org\":\"\",\"product\":\"Product\",\"description\":\"\",\"firmware\":\"airnote-v1\",\"version\":\"1.1.1\",\"built\":\"Dec  7 2019 21:53:07\",\"ver_ma",
         "contact":null,
         "product_uid":"product:com.your-company.your-name:project",
         "fleet_uids":"[fleet:00000000-0000-0000-0000-000000000000]",
         "tower_info":{
            "mcc":310,
            "mnc":410,
            "lac":12345,
            "cell_id":12345678
         },
         "tower_location":{
            "when":"2021-05-11T19:34:23Z",
            "name":"Cassville MO",
            "country":"US",
            "timezone":"America/Chicago",
            "latitude":36.665537500000006,
            "longitude":-93.850109375
         },
         "gps_location":{
            "same properties as tower_location"
         },
         "triangulated_location":{
            "same properties as tower_location"
         },
         "voltage":5.15,
         "temperature":23.75,
         "dfu":{
            "card":{
               "type":"card",
               "mode":"idle",
               "updated":1632938485,
               "version":"{\"org\":\"Blues Wireless\",\"product\":\"Notecard\",\"version\":\"notecard-1.5.6\",\"ver_major\":1,\"ver_minor\":5,\"ver_patch\":6,\"ver_build\":13695,\"built\":\"Sep 13 2021 15:37:30\"}"
            },
            "user":{
               "type":"user",
               "mode":"idle",
               "updated":1632938486
            }
         },
         "cellular_usage":{
            "iccid":"89014103211118510720",
            "used":123456,
            "limit":1048576,
            "lifetime_used":987654321,
            "last_updated":1632938486
         }
      }
   ],
   "has_more":false
}
```

## Get Device (Notehub)

Get information about a single [device](https://dev.blues.io/api-reference/glossary.md#device) by its [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}`                                                                                                                                                                                                                                                                                                                                                              |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.getDevice(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.models.device import Device
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_response = api_instance.get_device(project_or_product_uid, device_uid)
        print("The response of DeviceApi->get_device:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device: %s\n" % e)
```

**Response Members**

### `uid`

*string*

The globally-unique identifier of the device.

### `serial_number`

*string*

The user-defined [serial number](https://dev.blues.io/api-reference/glossary.md#product-sn) of the device.

### `best_id`

*string*

The best identifier for the device — the device's serial number if set, otherwise its [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

### `provisioned`

*string*

The date and time this device was first provisioned, or put into use.

### `last_activity`

*string*

The date and time this device was last seen by Notehub.

### `contact`

*object*

Contact information for this device, specified via environment variables.

### `product_uid`

*string*

The ProductUID this device is associated with.

### `fleet_uids`

*array*

An array of globally-unique identifiers for the fleet(s) this device is associated with.

### `tower_info`

*object*

An object containing data about the cellular tower last accessed by this device.

### `tower_info.mcc`

*integer*

The mobile country code of the cell tower.

### `tower_info.mnc`

*integer*

The mobile network code of the cell tower, which identifies the mobile operator.

### `tower_info.lac`

*integer*

The location area code of the cell tower, which is a unique identifier of the current location area.

### `tower_info.cell_id`

*integer*

The Cell ID or CID of the cell tower. This is a unique number used to identify each Base Transceiver Station (BTS) or sector of a BTS within a location area code.

### `tower_location`

*object*

An object containing information about the physical location of the cell tower.

### `gps_location`

*object*

An object containing information about the physical location of the device, based on GPS coordinates.

### `triangulated_location`

*object*

An object containing information about the physical location of the device, based on triangulated data calculated by multiple cell towers.

### `voltage`

*decimal*

The most recent measure of the voltage from the onboard voltage monitor.

### `temperature`

*decimal*

The most recent temperature measure in celsius from the onboard temperature sensor.

### `dfu`

*object*

Information about the device firmware update status for the Notecard `"type":"card"` or the host MCU `"type":"user"`. The `mode` will be one of:

`"idle"` - nothing downloading or downloaded\
`"error"` - halted and in the error state\
`"downloading"` - transferring data from cloud to module\
`"sideloading"` - transferring data via request to module\
`"ready"` - DFU data is ready/verified and waiting on external storage\
`"ready-retry"` - DFU data is ready/verified and retrying\
`"updating"` - currently updating\
`"completed"` - DFU is done successfully

### `sku`

*string*

The SKU of the Notecard in use. See the [Notecard datasheet dropdown menu](https://dev.blues.io/datasheets/notecard-datasheet.md) for example SKUs.

### `firmware_notecard`

*string*

The firmware version of the Notecard in use.

### `firmware_host`

*string*

The firmware version of the host MCU in use (if any).

### `disabled`

*boolean*

Whether or not the device is disabled.

### `cellular_usage.iccid`

*string (optional)*

The ICCID of the SIM card in use by the device.

### `cellular_usage.used`

*integer (optional)*

The total number of bytes used on the SIM's current data plan.

### `cellular_usage.limit`

*integer (optional)*

The limit in bytes of the SIM's current data plan.

### `cellular_usage.lifetime_used`

*integer (optional)*

The total number of bytes used by the SIM since it was first activated.

### `cellular_usage.last_updated`

*integer (optional)*

The time this usage information was last updated, in seconds since the epoch.

Example Response

```json
{
    "uid":"dev:000000000000000",
    "serial_number":"",
    "best_id":"dev:000000000000000",
    "sku": "NOTE-NBGL",
    "provisioned":"2021-02-11T02:37:16Z",
    "last_activity":"2021-05-11T19:37:08Z",
    "firmware_notecard": "{\"org\":\"Blues Wireless\",\"product\":\"Notecard\",\"version\":\"notecard-4.4.1\",\"ver_major\":4,\"ver_minor\":4,\"ver_patch\":1,\"ver_build\":4015700,\"built\":\"May  5 2023 12:20:37\"}",
    "firmware_host": "{\"org\":\"\",\"product\":\"Product\",\"description\":\"\",\"firmware\":\"airnote-v1\",\"version\":\"1.1.1\",\"built\":\"Dec  7 2019 21:53:07\",\"ver_ma",
    "contact":null,
    "product_uid":"product:com.your-company.your-name:project",
    "fleet_uids":["fleet:00000000-0000-0000-0000-000000000000"],
    "tower_info":{
      "mcc":310,
      "mnc":410,
      "lac":12345,
      "cell_id":12345678
    },
    "tower_location":{
      "when":"2021-05-11T19:34:23Z",
      "name":"Cassville MO",
      "country":"US",
      "timezone":"America/Chicago",
      "latitude":36.665537500000006,
      "longitude":-93.850109375
    },
    "gps_location":{
      "same properties as tower_location"
    },
    "triangulated_location":{
      "same properties as tower_location"
    },
    "voltage":5.15,
    "temperature":23.75,
    "dfu":{
      "card":{
          "type":"card",
          "mode":"idle",
          "updated":1632938485,
          "version":"{\"org\":\"Blues Wireless\",\"product\":\"Notecard\",\"version\":\"notecard-1.5.6\",\"ver_major\":1,\"ver_minor\":5,\"ver_patch\":6,\"ver_build\":13695,\"built\":\"Sep 13 2021 15:37:30\"}"
      },
      "user":{
          "type":"user",
          "mode":"idle",
          "updated":1632938486
      }
    },
    "cellular_usage": {
      "iccid": "89014103211118510621",
      "used": 123456789,
      "limit": 1000000000,
      "lifetime_used": 987654321,
      "last_updated": 1632938486
    }
}
```

## Delete Device (Notehub)

Delete a single [device](https://dev.blues.io/api-reference/glossary.md#device) by its [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `DELETE`                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}`                                                                                                                                                                                                                                                                                                                                                              |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X DELETE
     -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>'
     -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.deleteDevice(projectOrProductUID, deviceUID).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_instance.delete_device(project_or_product_uid, device_uid)
    except Exception as e:
        print("Exception when calling DeviceApi->delete_device: %s\n" % e)
```

## Disable Device (Notehub)

Disable a [device](https://dev.blues.io/api-reference/glossary.md#device) by its [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid). Notehub blocks disabled devices from connecting to your Notehub project.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `POST`                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/disable`                                                                                                                                                                                                                                                                                                                                                      |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X POST
     -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/disable'
     -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.disableDevice(projectOrProductUID, deviceUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_instance.disable_device(project_or_product_uid, device_uid)
    except Exception as e:
        print("Exception when calling DeviceApi->disable_device: %s\n" % e)
```

## Enable Device (Notehub)

Enable a [device](https://dev.blues.io/api-reference/glossary.md#device) by its [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid). Enabling a disabled device allows it to reconnect to your Notehub project.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `POST`                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/enable`                                                                                                                                                                                                                                                                                                                                                       |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X POST
     -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/enable'
     -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.enableDevice(projectOrProductUID, deviceUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_instance.enable_device(project_or_product_uid, device_uid)
    except Exception as e:
        print("Exception when calling DeviceApi->enable_device: %s\n" % e)
```

## Get Device Environment Hierarchy (Notehub)

Get environment variable hierarchy for a device by [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) and [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

The environment variable hierarchy lets you view all variables available to your device—including those set at the device, fleet, and project levels—and shows you exactly which value is applied when multiple levels define the same variable.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_hierarchy`                                                                                                                                                                                                                                                                                                                                        |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/environment_hierarchy'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.env_tree_json_node import EnvTreeJsonNode
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
    device_uid = "dev:000000000000000" # str |

    try:
        # Get environment variable hierarchy for a device
        api_response = api_instance.get_device_environment_hierarchy(project_or_product_uid, device_uid)
        print("The response of DeviceApi->get_device_environment_hierarchy:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_environment_hierarchy: %s\n" % e)
```

**Response Members**

### `var_count`

*integer*

Total number of environment variables in the hierarchy.

### `inherited_var_count`

*integer*

Total number of inherited environment variables in the hierarchy.

### `type`

*string*

Type of the environment variable.

### `variables`

*array*

JSON array containing environment variables with the following properties:

`"key"` - *string* - The name of the environment variable.

`"value"` - *string* - The value of the environment variable.

`"used"` - *boolean* - Indicates if the variable is currently active on the device.

`"precedence"` - *number* - The precedence of the variable in the hierarchy.

`"note"` - *string* - An optional free-form annotation for the variable.

### `children`

*array*

JSON array of child nodes in the hierarchy, each represented by a nested object with details.

### `device_uid`

*string (optional)*

The unique identifier of the Notehub [device](https://dev.blues.io/api-reference/glossary.md#device).

### `fleet_label`

*string (optional)*

The label of the fleet the Notehub device belongs to.

### `fleet_uid`

*string (optional)*

The unique identifier of the [fleet](https://dev.blues.io/api-reference/glossary.md#fleetuid) the device belongs to.

### `app_uid`

*string (optional)*

The globally-unique [AppUID](https://dev.blues.io/api-reference/glossary.md#appuid) for the device's current Notehub application.

### `app_label`

*string (optional)*

The label of the application the Notehub device is associated with.

### `url`

*string (optional)*

The URL to access the device's environment hierarchy.

Example Response

```json
{
  "var_count": 5,
  "inherited_var_count": 2,
  "type": "device",
  "variables": [
    {
      "key": "VAR1",
      "value": "value1",
      "used": true,
      "precedence": 1,
      "note": "Calibrated 2026-06-01"
    },
    {
      "key": "VAR2",
      "value": "value2",
      "used": false,
      "precedence": 2
    }
  ],
  "children": [],
  "device_uid": "dev:000000000000000",
  "fleet_label": "Fleet 1",
  "fleet_uid": "fleet:000000000000000",
  "app_uid": "app:000000000000000",
  "app_label": "App 1",
  "url": "https://api.notefile.net/v1/projects/app:2606f411-dea6-44a0-9743-1130f57d77d8/devices/dev:000000000000000/environment_hierarchy"
}
```

## Delete Device Environment Variable (Notehub)

Delete an environment variable by [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid), and environment variable key.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `DELETE`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables/{key}`                                                                                                                                                                                                                                                                                                                                                                                 |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `key` - The key of the environment variable. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                        |

Arguments

None

**Example**

**Bash**

```bash
curl -X DELETE
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/environment_variables/<key>'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // 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);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    key = "key_example" # str | The environment variable key to delete.

    try:
        api_response = api_instance.delete_device_environment_variable(project_or_product_uid, device_uid, key)
        print("The response of DeviceApi->delete_device_environment_variable:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->delete_device_environment_variable: %s\n" % e)
```

**Response Members**

### `environment_variables`

*object*

JSON object containing environment variables in `"key":"value"` format.

### `environment_variable_notes`

*object*

JSON object containing optional per-variable annotations, keyed by variable name.

Example Response

```json
{
  "environment_variables": {
    "_tags": "",
    "device_humidity": "55.9",
    "device_temp": "79.0"
  },
  "environment_variable_notes": {
    "device_humidity": "Calibrated 2026-06-01"
  }
}
```

## Get Device Environment Variables (Notehub)

Get all device-level environment variables by [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables`                                                                                                                                                                                                                                                                                                                                        |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/environment_variables'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.getDeviceEnvironmentVariables(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.models.get_device_environment_variables200_response import GetDeviceEnvironmentVariables200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_response = api_instance.get_device_environment_variables(project_or_product_uid, device_uid)
        print("The response of DeviceApi->get_device_environment_variables:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_environment_variables: %s\n" % e)
```

**Response Members**

### `environment_variables`

*object*

JSON object containing device-level environment variables in `"key":"value"` format.

### `environment_variable_notes`

*object*

JSON object containing optional per-variable annotations for device-level environment variables, keyed by variable name.

### `environment_variables_env_default`

*object*

JSON object containing any default environment variables in `"key":"value"` format.

### `environment_variables_effective`

*object*

JSON object containing environment variables as they will be seen by the device, fully resolved with project/fleet/device prioritization rules in `"key":"value"` format.

Example Response

```json
{
  "environment_variables": {
    "_tags": "",
    "device_humidity": "55.9",
    "device_temp": "79.0"
  },
  "environment_variable_notes": {
    "device_humidity": "Calibrated 2026-06-01"
  },
  "environment_variables_env_default": {},
  "environment_variables_effective": {
    "_tags": "",
    "device_humidity": "55.9",
    "device_temp": "79.0",
    "fleet_pressure": "1000.0",
  }
}
```

## Set Device Environment Variables (Notehub)

Set device-level environment variables by [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `PUT`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables`                                                                                                                                                                                                                                                                                                                                        |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `environment_variables`

*object*

A JSON object containing the key-value pair(s) of environment variable(s) to be added. For example: `{"key1":"value1","key2":"value2"}`.

### `environment_variable_notes`

*object (optional)*

A JSON object of optional per-variable annotations, keyed by variable name. Setting a key to an empty string removes its note. A `400` error is returned for any key that does not already exist as a stored variable and is not included in `environment_variables` in the same request. For example: `{"key1":"A note about key1","key2":"A note about key2"}`.

**Example**

**Bash**

```bash
curl -X PUT
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/environment_variables'
    -H 'Authorization: Bearer <access_token>'
    -d '{"environment_variables":<environment_variables>}'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String} |
let environmentVariables = new NotehubJs.EnvironmentVariables(envVars); // EnvironmentVariables | Environment variables to be added to the device
apiInstance.setDeviceEnvironmentVariables(projectOrProductUID, deviceUID, environmentVariables).then((data) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    env_vars = {"key": "value"} # Dict[str, str] | 
    environment_variables = notehub_py.EnvironmentVariables(env_vars) # EnvironmentVariables | Environment variables to be added to the device

    try:
        api_response = api_instance.set_device_environment_variables(project_or_product_uid, device_uid, environment_variables)
        print("The response of DeviceApi->set_device_environment_variables:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->set_device_environment_variables: %s\n" % e)
```

**Response Members**

### `environment_variables`

*object*

JSON object containing environment variables in `"key":"value"` format.

### `environment_variable_notes`

*object*

JSON object containing optional per-variable annotations, keyed by variable name.

Example Response

```json
{
  "environment_variables": {
    "_tags": "",
    "device_humidity": "55.9",
    "device_temp": "79.0"
  },
  "environment_variable_notes": {
    "device_humidity": "Calibrated 2026-06-01"
  }
}
```

## Get Device Health Log (Notehub)

Get an array of health log events by [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) and [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/health-log`                                                                                                                                                                                                                                                                                                                                                   |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `startDate`

*integer (optional)*

Start date for filtering results, specified as a Unix timestamp.

### `endDate`

*integer (optional)*

End date for filtering results, specified as a Unix timestamp.

### `logType`

*array of strings (optional)*

Return only specified log types in the response. Valid options include `boot` or `dfu_completed`.

**Basic**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/health-log'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // 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": ["boot"] // [String] | Return only specified log types
};
apiInstance.getDeviceHealthLog(projectOrProductUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.models.get_device_health_log200_response import GetDeviceHealthLog200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
    end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
    log_type = ['dfu_completed'] # List[str] | Return only specified log types (optional)

    try:
        api_response = api_instance.get_device_health_log(project_or_product_uid, device_uid, start_date=start_date, end_date=end_date, log_type=log_type)
        print("The response of DeviceApi->get_device_health_log:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_health_log: %s\n" % e)
```

**Optional Params**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/health-log?startDate=1628631763&endDate=1657894210&logType=boot'
    -H 'Authorization: Bearer <access_token>'
```

**Response Members**

### `when`

*string*

The date and time this event was received by Notehub.

### `alert`

*boolean*

The date and time this event was received by Notehub.

### `text`

*string*

Descriptive information about the health log event.

Example Response

```json
{
  "health_log": [
    {
      "when": "2021-04-27T15:37:47Z",
      "alert": false,
      "text": "boot (brown-out \u0026 hard reset [12460])"
    }
  ]
}
```

## Get Device Plans (Notehub)

Get data plans associated with a device, which will include the primary SIM, any external SIM, as well as any satellite connections, by [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) and [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/plans`                                                                                                                                                                                                                                                                                                                                                        |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/plans'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.get_device_plans200_response import GetDevicePlans200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
# See configuration.py for a list of all supported configuration parameters.
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
    device_uid = "dev:000000000000000" # str |

    try:
        api_response = api_instance.get_device_plans(project_or_product_uid, device_uid)
        print("The response of DeviceApi->get_device_plans:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_plans: %s\n" % e)
```

**Response Members**

### `activated`

*integer (optional)*

Unix timestamp of when the SIM was activated.

### `dataUsage.kb_remaining`

*integer (optional)*

Kilobytes remaining in the plan.

### `dataUsage.kb_total`

*integer (optional)*

Total Kilobytes included in the plan.

### `dataUsage.kb_used`

*integer (optional)*

Kilobytes used to date.

### `expires_at`

*integer (optional)*

Unix timestamp of when the SIM plan expires.

### `iccid`

*string (optional)*

The Integrated Circuit Card Identifier of the SIM card.

### `imsi`

*string (optional)*

IMSI of the SIM card.

### `last_updated`

*integer (optional)*

Time this plan information was last updated.

### `lifetime_used`

*integer (optional)*

Total bytes used by this SIM.

### `plan_type`

*string (optional)*

Description of the SIM plan type including data allowance, region, and validity period.

Example Response

```json
{
  "cellular_plans": [
    {
      "iccid": "89014103211118510720",
      "imsi": "310260000000000",
      "plan_type": "blues - 500MB 12yr Prepaid PPU",
      "activated": 1628631763,
      "expires_at": 1657894210,
      "data_usage": {
        "kb_total": 5120,
        "kb_used": 2048,
        "kb_remaining": 3072
      },
      "lifetime_used": 4096000,
      "last_updated": 1655302210
    }
  ]
}
```

## Get Device Latest Events (Notehub)

Get the most recent health log, session, and events by [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) (updated at the end of every session). If a device is in `continuous` mode, the latest events are updated every 15 minutes.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/latest`                                                                                                                                                                                                                                                                                                                                                       |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

> **Note:**
>
> This API reference displays all possible fields that can be present in an event response. However, certain fields will only be present for certain types of events (e.g. Note added event, Note updated event, .dbs update event, Notehub session event, etc).

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/latest'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.getDeviceLatestEvents(projectOrProductUID, deviceUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.get_device_latest_events200_response import GetDeviceLatestEvents200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_response = api_instance.get_device_latest_events(project_or_product_uid, device_uid)
        print("The response of DeviceApi->get_device_latest_events:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_latest_events: %s\n" % e)
```

**Response Members**

### `latest_events`

*array*

An array of the latest events captured by the device (see the [Get Project Events](https://dev.blues.io/api-reference/notehub-api/event-api.md#get-project-events) response for a full description of the data elements returned).

Example Response

```json
{
  "latest_events": [
    {
      "event": "916d4c81-06ae-4263-9b55-7a3a0f73cb5a",
      "platform": true,
      "when": 1643991794,
      "file": "_session_.qo",
      "body": {
        "opened": true,
        "why": "periodic inbound sync due, periodic outbound sync due"
      },
      "session": "28cdc39f-9f62-4789-b0a3-2f35f9448ced",
      "transport": "hub",
      "best_id": "tj-1",
      "device": "dev:864475040523995",
      "sn": "tj-1",
      "product": "product:com.blues.app:myapp",
      "app": "app:3733f429-9335-6756-3456-c397c0000000",
      "received": 1643991803.316966,
      "req": "session.begin",
      "best_location_type": "tower",
      "best_location_when": 1643991727,
      "best_lat": 43.769062500000004,
      "best_lon": -83.657359375,
      "best_location": "Waverly MI",
      "best_country": "US",
      "best_timezone": "America/Detroit",
      "tower_when": 1643991727,
      "tower_lat": 43.769062500000004,
      "tower_lon": -83.657359375,
      "tower_country": "US",
      "tower_location": "Waverly MI",
      "tower_timezone": "America/Detroit",
      "tower_id": "310,410,20483,184692495",
      "fleets": [
        "fleet:f9045782-6ad1-483c-a4d2-ab859f4adc04"
      ],
      "bearer": "unknown",
      "cellid": "310,410,11298,187681040",
      "rssi": -66,
      "sinr": 12,
      "rsrp": -88,
      "rsrq": -12,
      "rat": "emtc",
      "bars": 3,
      "voltage": 3.478,
      "temp": 5.187,
      "moved": 1739702187,
      "orientation": "landscape-right"
    },
    {
      "event": "e98c2c3b-edbe-4fe7-af57-2196cc843eb7",
      "session": "7211392c-6895-43f8-9256-790655348be5",
      "device": "dev:864475040523995",
      "product": "product:com.blues.app:myapp",
      "received": 1663343137.75288,
      "req": "note.add",
      "when": 1663343125,
      "file": "sensors.qo",
      "body": {
        "humidity": 69.88647200683693,
        "pressure": 993.6294496104914,
        "temp": 21.273027181770885
      },
      "tower_when": 1663343102,
      "tower_lat": 43.747037500000005,
      "tower_lon": -83.665859375,
      "tower_country": "US",
      "tower_location": "Waverly MI",
      "tower_timezone": "America/Detroit",
      "tower_id": "310,410,20483,184692496"
    }
  ]
}
```

## Get Device Sessions (Notehub)

Get all session events by [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/sessions`                                                                                                                                                                                                                                                                                                                                                     |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `pageSize`

*integer (optional)*

Specifies the number of sessions to be returned by a request (default 50).

### `pageNum`

*integer (optional)*

Specifies the page number of the results returned (useful when the `pageSize` is less than the total number of sessions that could be returned). When provided, the `pageNum` must be >= `1`.

### `startDate`

*integer (optional)*

Specifies the start date for filtering results, specified as a Unix timestamp.

### `endDate`

*integer (optional)*

Specifies the end date for filtering results, specified as a Unix timestamp.

### `firstSync`

*boolean (optional)*

When true, filters results to only show “first sync” sessions, aka sessions that begin when a device syncs with Notehub for the first time after being provisioned or factory-reset.

**Basic**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/sessions'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  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.getDeviceSessions(projectOrProductUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.models.get_device_sessions200_response import GetDeviceSessions200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    page_size = 50 # int |  (optional) (default to 50)
    page_num = 1 # int |  (optional) (default to 1)
    start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
    end_date = 1657894210 # int | End date for filtering results, specified

    try:
        api_response = api_instance.get_device_sessions(project_or_product_uid, device_uid, page_size=page_size, page_num=page_num)
        print("The response of DeviceApi->get_device_sessions:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_sessions: %s\n" % e)
```

**Optional Params**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/sessions?pageSize=<pageSize>&pageNum=<pageNum>&startDate=<startDate>&endDate=<endDate>'
    -H 'Authorization: Bearer <access_token>'
```

**Response Members**

### `session`

*string*

The globally-unique [SessionUID](https://dev.blues.io/api-reference/glossary.md#sessionuid) for the device's current Notehub session.

### `device`

*string*

The device's globally-unique [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid).

### `product`

*string*

The globally-unique [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid).

### `fleets`

*array*

An array of device fleets to which this Notecard belongs.

### `cell`

*string*

A combination of the `mcc`, `mnc`, `lac`, and `cid` values, denoting the cell tower where the session originated.

### `rssi`

*integer*

The "Received Signal Strength Indicator" value (`0` being the best possible signal strength).

### `sinr`

*integer*

The "Signal to Interference and Noise Ratio" value (the higher the value the better the signal strength).

### `rsrp`

*integer*

The "Reference Signal Received Power" value (the higher the value the stronger the power).

### `rsrq`

*integer*

The "Reference Signal Received Quality" value (the higher the value the better the signal quality).

### `bars`

*integer*

A general measure of the quality and strength of the cellular connection (with `4` being the highest quality).

### `rat`

*string*

The "Radio Access Technology" (i.e. the underlying connection method for the cellular network).

### `bearer`

*string*

The tunnel used to connect the device to Packet Data Networks (PDNs).

### `ip`

*string*

The IP address of the Notehub.io handler.

### `iccid`

*string*

The "Integrated Circuit Card Identifier" of the SIM on the device.

### `apn`

*string*

The "Access Point Name" for Notehub.

### `tower`

*object*

Information about the cell tower used for this Notehub session.

### `tri`

*object*

Information about the triangulation method(s) used for this Notehub session (only if triangulation was utilized).

### `when`

*UNIX Epoch time*

Last known capture time of a Note routed through this session.

### `voltage`

*decimal*

The voltage of the attached power source.

### `temp`

*decimal*

The temperature (in Celsius) as reported by the onboard temperature sensor.

### `continuous`

*boolean*

Whether or not the Notecard is in the `continuous` connectivity mode.

### `tls`

*boolean*

Whether or not TLS was used to secure this session.

### `work`

*UNIX Epoch time*

The last time an update was made (e.g. a Notefile was added/updated) or other "work" was performed for this session.

### `events`

*integer*

The number of events routed in this session.

### `moved`

*UNIX Epoch time*

The last time motion was detected for this session.

### `orientation`

*string*

The physical orientation of the Notecard.

### `trigger`

*string*

The reason this session was initiated.

### `hp_*`

*integer*

The `hp_*` values report "high power" statistics about when the modem was powered on. One cycle is one power on/off of the modem.

### `period`

*object*

Information denoting the approximate data usage, TCP sessions, and Notes sent in this session.

### `has_more`

*boolean*

Whether or not there are additional sessions to display.

Example Response

```json
{
  "sessions": [
    {
      "session": "d76689be-37cd-423c-b695-7e0c19a2a264",
      "device": "dev:000000000000000",
      "product": "product:com.blues.demo:project",
      "fleets": ["fleet:46be9834-5te6-42c1-0000-b5ea05e248d7"],
      "cell": "310,410,17169,77315594",
      "rssi": -61,
      "sinr": 17,
      "rsrp": -91,
      "rsrq": -13,
      "bars": 2,
      "rat": "lte",
      "bearer": "LTE FDD",
      "ip": "10.68.56.193",
      "iccid": "89011704278500000000",
      "apn": "a-notehub.com.attz",
      "tower": {
        "time": 1667250835,
        "n": "Shorewood Hills WI",
        "c": "US",
        "lat": 43.0742625,
        "lon": -89.44239062499999,
        "zone": "America/Chicago",
        "mcc": 310,
        "mnc": 410,
        "lac": 17169,
        "cid": 77315594,
        "l": "86MG3HF5+P25",
        "count": 7,
        "towers": 1
      },
      "tri": {},
      "when": 1667251044,
      "voltage": 4.174,
      "temp": 24.437,
      "continuous": true,
      "tls": true,
      "work": 1667251046,
      "events": 14,
      "moved": 1667250807,
      "orientation": "face-up",
      "trigger": "first sync; continuous connection mode",
      "hp_secs_total": 7659,
      "hp_secs_data": 7659,
      "hp_cycles_total": 3,
      "hp_cycles_data": 3,
      "period": {
        "since": 1667250832,
        "duration": 215,
        "bytes_rcvd": 2501,
        "bytes_sent": 4138,
        "sessions_tls": 1,
        "notes_sent": 12
      }
    }
  ],
  "has_more": true
}
```

## Get Device Journeys (Notehub)

Get the list of journeys for a device, derived from events whose body contains `journey` and `jcount` fields. Returns journey metadata only (no event payloads). Capped at 100 most recent journeys; `has_more` is `true` when the cap is hit.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys`                                                                                                                                                                                                                                                                                                                                                     |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `startDate`

*integer (optional)*

Specifies the start date for filtering results, specified as a Unix timestamp.

### `endDate`

*integer (optional)*

Specifies the end date for filtering results, specified as a Unix timestamp.

**Basic**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/journeys'
    -H 'Authorization: Bearer <access_token>'
```

**Response Members**

### `journeys`

*array*

An array of journey metadata objects.

### `journeys[].journey_id`

*integer*

Identifier of the journey, taken from the numeric `journey` field in the event body. This value is itself a Unix timestamp marking the start of the journey.

### `journeys[].start_date`

*string (date-time)*

Earliest event time within the journey.

### `journeys[].end_date`

*string (date-time)*

Latest event time within the journey.

### `journeys[].total_events`

*integer*

The number of events in the journey.

### `has_more`

*boolean*

Whether the result was capped at 100 journeys. When `true`, use `startDate` and `endDate` to narrow the query and retrieve additional journeys.

Example Response

```json
{
  "journeys": [
    {
      "journey_id": 1700000000,
      "start_date": "2026-05-14T17:20:00Z",
      "end_date": "2026-05-14T18:45:32Z",
      "total_events": 12
    },
    {
      "journey_id": 1699900000,
      "start_date": "2026-05-13T09:05:14Z",
      "end_date": "2026-05-13T10:22:47Z",
      "total_events": 8
    }
  ],
  "has_more": false
}
```

## Get Device Journey (Notehub)

Get a single journey for a device along with its events.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys/{journeyID}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `journeyID` - The identifier of a device journey, taken from the `journey` field on `_track.qo` events (a Unix timestamp marking the start of the journey). |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

Arguments

### `pageSize`

*integer (optional)*

Specifies the number of events to be returned by a request (default 50).

### `pageNum`

*integer (optional)*

Specifies the page number of the results returned (useful when the `pageSize` is less than the total number of events that could be returned). When provided, the `pageNum` must be >= `1`.

**Basic**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/journeys/<journeyID>'
    -H 'Authorization: Bearer <access_token>'
```

**Response Members**

### `journey_id`

*integer*

Identifier of the journey.

### `start_date`

*string (date-time)*

Earliest event time within the journey.

### `end_date`

*string (date-time)*

Latest event time within the journey.

### `journey`

*object*

Paginated events for the journey.

### `journey.events`

*array*

An array of events belonging to this journey (see the [Get Project Events](https://dev.blues.io/api-reference/notehub-api/event-api.md#get-project-events) response for a full description of the data elements returned).

### `journey.has_more`

*boolean*

Whether or not there are additional events to display on subsequent pages.

Example Response

```json
{
  "journey_id": 1700000000,
  "start_date": "2026-06-14T17:20:00Z",
  "end_date": "2026-06-14T18:45:32Z",
  "journey": {
    "events": [
      {
        "event": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "session": "28cdc39f-9f62-4789-b0a3-2f35f9448ced",
        "device": "dev:864475040523995",
        "product": "product:com.blues.app:myapp",
        "received": 1700000060.123456,
        "req": "note.add",
        "when": 1700000055,
        "file": "_track.qo",
        "body": {
          "journey": 1700000000,
          "lat": 43.769062500000004,
          "lon": -83.657359375,
          "speed": 42.5
        }
      }
    ],
    "has_more": false
  }
}
```

## Get Fleet Devices (Notehub)

Get an array of [devices](https://dev.blues.io/api-reference/glossary.md#device) associated with a [fleet](https://dev.blues.io/api-reference/glossary.md#fleet).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                             |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/fleets/{fleetUID}/devices`                                                                                                                                                                                                                            |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `fleetUID` - The [FleetUID](https://dev.blues.io/api-reference/glossary.md#fleetuid) of a Notehub fleet. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                            |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                             |

Arguments

### `pageSize`

*integer (optional)*

Specifies the number of devices to be returned by a request (default 50).

### `pageNum`

*integer (optional)*

Specifies the page number of the results returned (useful when the `pageSize` is less than the total number of devices that could be returned). When provided, the `pageNum` must be >= `1`.

### `deviceUID`

*array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of DeviceUIDs of Notehub [devices](https://dev.blues.io/api-reference/glossary.md#device).

### `tag`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more tags to filter the devices by.

### `serialNumber`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of device [serial numbers](https://dev.blues.io/api-reference/glossary.md#serial-number) to filter by.

### `notecardFirmware`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more Notecard firmware versions to filter the devices by. Any numeric portion of the firmware name like "7.4.2.16888" or "7.4" is acceptable.

### `location`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more locations to filter the devices by. Provide city, state, or country code like "Boston, MA", "Boston", "MA", or "Guildford, ENG, GB" (this field supports partial/case insensitive matches).

### `hostFirmware`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more host firmware versions to filter the devices by. Any string of host firmware like "foo-3.4" or "8.7.6" or "baz-bar-01" is acceptable.

### `productUID`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more [ProductUIDs](https://dev.blues.io/api-reference/glossary.md#productuid) to filter the devices by.

### `sku`

*Array (optional)*

An [array](https://dev.blues.io/api-reference/notehub-api.md#using-array-arguments) of one or more Notecard SKUs to filter the devices by.

**Example**

**Bash**

```bash
curl -X GET
   -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/fleets/<fleetUID>/devices'
   -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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: 50, // Number |
  pageNum: 1, // Number |
  deviceUID: ["null"], // [String] | A Device UID.
  tag: ["null"], // [String] | Tag filter
  serialNumber: ["null"], // [String] | Serial number filter
  notecardFirmware: ["null"], // [String] | Firmware version filter
  location: ["null"], // [String] | Location filter
  hostFirmware: ["null"], // [String] | Host firmware filter
  productUID: ["null"], // [String] |
  sku: ["null"] // [String] | SKU filter
};
apiInstance.getFleetDevices(projectOrProductUID, fleetUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.models.get_devices200_response import GetDevices200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    fleet_uid = "fleet_uid_example" # str | 
    page_size = 50 # int |  (optional) (default to 50)
    page_num = 1 # int |  (optional) (default to 1)
    device_uid = ["device_uid_example"] # List[str] | A Device UID. (optional)
    tag = ["tag_example"] # List[str] | Tag filter (optional)
    serial_number = ["serial_number_example"] # List[str] | Serial number filter (optional)
    notecard_firmware = ["notecard_firmware_example"] # List[str] | Firmware version filter (optional)
    location = ["location_example"] # List[str] | Location filter (optional)
    host_firmware = ["host_firmware_example"] # List[str] | Host firmware filter (optional)
    product_uid = ["product_uid_example"] # List[str] |  (optional)
    sku = ["sku_example"] # List[str] | SKU filter (optional)

    try:
        api_response = api_instance.get_fleet_devices(project_or_product_uid, fleet_uid, page_size=page_size, page_num=page_num)
        print("The response of DeviceApi->get_fleet_devices:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_fleet_devices: %s\n" % e)
```

**Response Members**

### `uid`

*string*

The globally-unique identifier of the device.

### `serial_number`

*string*

The user-defined [serial number](https://dev.blues.io/api-reference/glossary.md#product-sn) of the device.

### `provisioned`

*string*

The date and time this device was first provisioned, or put into use.

### `last_activity`

*string*

The date and time this device was last seen by Notehub.

### `contact`

*object*

Contact information for this device, specified via environment variables.

### `product_uid`

*string*

The ProductUID this device is associated with.

### `fleet_uids`

*array*

An array of globally-unique identifiers for the fleet(s) this device is associated with.

### `tower_info`

*object*

An object containing data about the cellular tower last accessed by this device.

### `tower_info.mcc`

*integer*

The mobile country code of the cell tower.

### `tower_info.mnc`

*integer*

The mobile network code of the cell tower, which identifies the mobile operator.

### `tower_info.lac`

*integer*

The location area code of the cell tower, which is a unique identifier of the current location area.

### `tower_info.cell_id`

*integer*

The Cell ID or CID of the cell tower. This is a unique number used to identify each Base Transceiver Station (BTS) or sector of a BTS within a location area code.

### `tower_location`

*object*

An object containing information about the physical location of the cell tower.

### `gps_location`

*object*

An object containing information about the physical location of the device, based on GPS coordinates.

### `triangulated_location`

*object*

An object containing information about the physical location of the device based on triangulated data calculated by multiple cell towers.

### `voltage`

*decimal*

The most recent measure of the voltage from the onboard voltage monitor.

### `temperature`

*decimal*

The most recent temperature measure in celsius from the onboard temperature sensor.

### `has_more`

*boolean*

Defines whether or not there are additional devices beyond this list.

Example Response

```json
{
   "devices":[
      {
         "uid":"dev:000000000000000",
         "serial_number":"",
         "provisioned":"2021-02-11T02:37:16Z",
         "last_activity":"2021-05-11T19:37:08Z",
         "contact":null,
         "product_uid":"product:com.your-company.your-name:project",
         "fleet_uids":"[fleet:00000000-0000-0000-0000-000000000000]",
         "tower_info":{
            "mcc":310,
            "mnc":410,
            "lac":12345,
            "cell_id":12345678
         },
         "tower_location":{
            "when":"2021-05-11T19:34:23Z",
            "name":"Cassville MO",
            "country":"US",
            "timezone":"America/Chicago",
            "latitude":36.665537500000006,
            "longitude":-93.850109375
         },
         "gps_location":{
            "same properties as tower_location"
         },
         "triangulated_location":{
            "same properties as tower_location"
         },
         "voltage":5.15,
         "temperature":23.75
      }
   ],
   "has_more":false
}
```

## Get DB Note (Notehub)

Retrieves a Note from a **DB Notefile**. `.qo`/`.qos` Notes must be read from the Notehub event table using the [Event API](https://dev.blues.io/api-reference/notehub-api/event-api.md).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `notefileID` - The filename of the [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile).
- `noteID` - The unique Note ID. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                                                    |

Arguments

### `delete`

*boolean (optional)*

`true` to delete the Note after retrieving it.

### `deleted`

*boolean (optional)*

`true` to allow retrieval of a deleted Note.

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notes/<file>/<note>'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
let opts = {
  _delete: true, // Boolean | Whether to delete the note from the DB notefile
  deleted: true, // Boolean | Whether to return deleted notes
};
apiInstance.getDbNote(projectOrProductUID, deviceUID, notefileID, noteID, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.get_db_note200_response import GetDbNote200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    notefile_id = "notefile_id_example" # str | 
    note_id = "note_id_example" # str | 
    delete = True # bool | Whether to delete the note from the DB notefile (optional)
    deleted = True # bool | Whether to return deleted notes (optional)

    try:
        api_response = api_instance.get_db_note(project_or_product_uid, device_uid, notefile_id, note_id, delete=delete, deleted=deleted)
        print("The response of DeviceApi->get_db_note:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_db_note: %s\n" % e)
```

**Response Members**

### `note`

*string*

The Note ID.

### `body`

*JSON object*

The JSON body, if contained in the Note.

### `payload`

*base64 string*

The payload, if contained in the Note.

### `time`

*UNIX Epoch time*

The time the Note was added to the Notecard or Notehub.

Example Response

```json
{
  "note": "note-id",
  "body": {
    "api-key1": "api-val1"
  },
  "time": 1598909219
}
```

## Get Notefile Changes (Notehub)

The Get Notefile Changes API is used to incrementally retrieve changes within a specific Notefile.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/changes`                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `notefileID` - The filename of the [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile). |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                   |

Arguments

### `max`

*integer (optional)*

The maximum number of Notes to return in the request.

### `deleted`

*boolean (optional)*

`true` to return deleted Notes with this request. Deleted notes are only persisted in a database Notefile (`.db/.dbs`) between the time of Note deletion on the Notecard and the time that a sync with Notehub takes place. As such, this boolean will have no effect after a sync or on queue notefiles (`.q*`).

### `delete`

*boolean (optional)*

`true` to delete the Notes returned by the request.

**Example Peek**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notes/<file>/changes'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let opts = {
  max: 56, // Number | The maximum number of Notes to return in the request.
  deleted: true, // Boolean | true to return deleted notes.
  _delete: true, // Boolean | true to delete the notes returned by the request.
};
apiInstance.getNotefile(projectOrProductUID, deviceUID, notefileID, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.get_notefile200_response import GetNotefile200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    notefile_id = "notefile_id_example" # str | 
    max = 56 # int | The maximum number of Notes to return in the request. (optional)
    deleted = True # bool | true to return deleted notes. (optional)
    delete = True # bool | true to delete the notes returned by the request. (optional)

    try:
        api_response = api_instance.get_notefile(project_or_product_uid, device_uid, notefile_id, max=max, deleted=deleted, delete=delete)
        print("The response of DeviceApi->get_notefile:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_notefile: %s\n" % e)
```

**Example Pop**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notes/<file>/changes?delete=<delete>&max=<max>'
    -H 'Authorization: Bearer <access_token>'
```

**Response Members**

### `total`

*integer*

The total number of Notes in the Notefile.

### `changes`

*integer*

The number of pending changes in the Notefile.

### `notes`

*JSON object*

An object with a key for each Note (for instance, the Note ID in a DB Notefile; For `.qo` and `.qi` Notes, these IDs are generated for internal management) and value object with the `body` of each Note and the Time the Note was added.

Example Response

```json
{
  "changes": 4,
  "total": 4,
  "notes": {
    "setting-one": { "body": { "foo": "bar" }, "time": 1598918235 },
    "setting-two": { "body": { "foo": "bat" }, "time": 1598918245 },
    "setting-three": { "body": { "foo": "baz" }, "time": 1598918225 },
    "setting-four": { "body": { "foo": "foo" }, "time": 1598910532 }
  }
}
```

Related Articles

- [Using Change Trackers With Inbound Data](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data.md#using-change-trackers-with-inbound-data)

## Add DB Note (Notehub)

Adds a Note to a `.db` or `.dbs` Notefile, creating the Notefile if it doesn't yet exist.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `POST`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `notefileID` - The filename of the [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile). The Notefile name must end in one of the following:
  - `.db` for a bidirectionally synchronized database with plaintext transport.
  - `.dbs` for a bidirectionally synchronized database with encrypted transport.
- `noteID` - The unique Note ID. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

Arguments

### `body`

*JSON object (optional)*

A JSON object to be enqueued. A Note must have either a `body` or a `payload`, and can have both.

### `payload`

*base64 string (optional)*

A base64-encoded binary payload. A Note must have either a `body` or a `payload`, and can have both. Payloads are limited to 256 bytes.

**Example**

**Bash**

```bash
curl -X POST
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notes/<notefileID>/<noteID>'
    -H 'Authorization: Bearer <access_token>'
    -d '{"body": {"temp": 72.22 }}'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
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);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.note import Note
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    notefile_id = "notefile_id_example" # str | 
    note_id = "note_id_example" # str | 
    note_input = notehub_py.NoteInput() # NoteInput | Body or payload of note to be added to the device

    try:
        api_instance.add_db_note(project_or_product_uid, device_uid, notefile_id, note_id, note_input)
    except Exception as e:
        print("Exception when calling DeviceApi->add_db_note: %s\n" % e)
```

**Response Members**

None: an empty object `{}` means success.

Related Articles

- [Inbound Requests and Shared Data](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data.md)

## Add QI Note (Notehub)

Adds a Note to a `.qi` or `.qis` Notefile, creating the Notefile if it doesn't yet exist.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `POST`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `notefileID` - The filename of the [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile). The Notefile name must end in one of the following:
  - `.qi` for an incoming queue (Notehub to Notecard) with plaintext transport.
  - `.qis` for an incoming queue (Notehub to Notecard) with encrypted transport. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

Arguments

### `body`

*JSON object (optional)*

A JSON object to be enqueued. A Note must have either a `body` or a `payload`, and can have both.

### `payload`

*base64 string (optional)*

A base64-encoded binary payload. A Note must have either a `body` or a `payload`, and can have both. Payloads are limited to 256 bytes.

**Example**

**Bash**

```bash
curl -X POST
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notes/<notefileID>'
    -H 'Authorization: Bearer <access_token>'
    -d '{"body": {"temp": 72.22 }}'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
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);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.note import Note
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    notefile_id = "notefile_id_example" # str | 
    note_input = notehub_py.NoteInput() # NoteInput | Body or payload of note to be added to the device

    try:
        api_instance.add_qi_note(project_or_product_uid, device_uid, notefile_id, note_input)
    except Exception as e:
        print("Exception when calling DeviceApi->add_qi_note: %s\n" % e)
```

**Response Members**

None: an empty object `{}` means success.

Related Articles

- [Inbound Requests and Shared Data](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data.md)

## Update DB Note (Notehub)

Updates a `.db` or `.dbs` Notefile by its ID, replacing the existing `body` and/or `payload`. **Inbound Notefiles may not be updated.**

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `PUT`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `notefileID` - The filename of the [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile). The Notefile name must end in one of the following:
  - `.db` for a bidirectionally synchronized database with plaintext transport.
  - `.dbs` for a bidirectionally synchronized database with encrypted transport.
- `noteID` - The unique Note ID. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

Arguments

### `file`

*string*

The name of the DB Notefile that contains the Note to update.

### `note`

*string*

The unique Note ID.

### `body`

*JSON object*

A JSON object to add to the Note. A Note must have either a `body` or `payload`, and can have both.

### `payload`

*base64 string*

A base64-encoded binary payload. A Note must have either a `body` or `payload`, and can have both.

### `access_token`

*string*

A Notehub API [bearer token](https://dev.blues.io/api-reference/notehub-api.md).

### `projectUID`

*string*

The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) of a Notehub project.

### `deviceUID`

*string*

The globally-unique [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a device that currently exists within the specified ProjectUID.

You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.

**Example**

**Bash**

```bash
curl -X PUT
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notes/<file>/<note>'
    -H 'Authorization: Bearer <access_token>'
    -d '{"body": {"interval": 60 }}'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
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);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.note import Note
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    notefile_id = "notefile_id_example" # str | 
    note_id = "note_id_example" # str | 
    note_input = notehub_py.NoteInput() # NoteInput | Body or payload of note to be added to the device

    try:
        api_instance.update_db_note(project_or_product_uid, device_uid, notefile_id, note_id, note_input)
    except Exception as e:
        print("Exception when calling DeviceApi->update_db_note: %s\n" % e)
```

**Response Members**

None: an empty object `{}` means success.

## Delete Note (Notehub)

Delete Notes from a DB or QI Notefile by its Note ID.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `DELETE`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `notefileID` - The filename of the [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile).
- `noteID` - The unique Note ID. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                                                    |

Arguments

None

**Example**

**Bash**

```bash
curl -X DELETE
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notes/<file>/<note>'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
apiInstance.deleteNote(projectOrProductUID, deviceUID, notefileID, noteID).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    notefile_id = "notefile_id_example" # str | 
    note_id = "note_id_example" # str | 

    try:
        api_instance.delete_note(project_or_product_uid, device_uid, notefile_id, note_id)
    except Exception as e:
        print("Exception when calling DeviceApi->delete_note: %s\n" % e)
```

**Response Members**

None: an empty object `{}` means success.

## Send Signal (Notehub)

Send a [signal](https://dev.blues.io/guides-and-tutorials/notecard-guides/minimizing-latency.md#using-inbound-signals) from Notehub to a Notecard [device](https://dev.blues.io/api-reference/glossary.md#device).

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `POST`                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/signal`                                                                                                                                                                                                                                                                                                                                                       |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

> **Note:**
>
> A Notecard can receive a signal with the [`hub.signal` request](https://dev.blues.io/api-reference/notecard-api/hub-requests.md#hub-signal).

Arguments

### `body`

*JSON object*

The JSON object to send.

**Example**

**Bash**

```bash
curl -X POST
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/signal'
    -H 'Authorization: Bearer <access_token>'
    -d '{"body":<body>}'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let body = new NotehubJs.Body(); // Body | Body or payload of signal to be sent to the device
apiInstance.signalDevice(projectOrProductUID, deviceUID, body).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.body import Body
from notehub_py.models.signal_device200_response import SignalDevice200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    body = notehub_py.Body() # Body | Body or payload of signal to be sent to the device

    try:
        api_response = api_instance.signal_device(project_or_product_uid, device_uid, body)
        print("The response of DeviceApi->signal_device:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->signal_device: %s\n" % e)
```

**Response Members**

### `connected`

*boolean*

`true` if the Notecard is connected to Notehub.

Example Response

```json
{
  "connected": true
}
```

## List Notefiles (Notehub)

List all Notefiles for a device.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files`                                                                                                                                                                                                                                                                                                                                                        |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `files`

*array of strings (optional)*

One or more files to obtain change information from. Omit to return changes for all Notefiles.

### `pending`

*boolean (optional)*

Set to `true` to include a `pending` flag on Notes that have not yet been synced to a Notecard.

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/files?files=[<files>]&pending=<pending>'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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] | One or more files to obtain change information from.
  "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);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.notefile import Notefile
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
# See configuration.py for a list of all supported configuration parameters.
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
    device_uid = "dev:000000000000000" # str |
    files = ["files_example"] # List[str] | One or more files to obtain change information from. (optional)
    pending = True # bool | show only files that are pending sync to the Notecard (optional)

    try:
        api_response = api_instance.list_notefiles(project_or_product_uid, device_uid, files=files, pending=pending)
        print("The response of DeviceApi->list_notefiles:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->list_notefiles: %s\n" % e)
```

**Response Members**

### `<notefile.id>`

*string*

The Notefile name, e.g. `data.qo`.

### `<notefile.notes>`

*array*

All of the Notes on the Notefile.

### `<notefile.template>`

*string*

The template defined on the Notefile, if any.

Example Response

```json
[
  {
    "id": "_health.qo",
    "notes": [],
    "template": "{\"text\":\"1\",\"alert\":true,\"voltage\":12.1,\"milliamp_hours\":14.1,\"method\":\"1\"}"
  },
  {
    "id": "data.qo",
    "notes": []
  },
  {
    "id": "data.qi",
    "notes": [
      {
        "id": "1:362",
        "body": {
          "test": "value"
        },
        "time": 1765219275
      }
    ]
  }
]
```

Related Articles

- [Handling Inbound Notes](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data.md#handling-inbound-notes)

- [Using a Change Tracker Across Notefiles](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data.md#using-change-trackers-across-multiple-notefiles)

## List Notefiles (Legacy) (Notehub) (Deprecated)

Used to perform queries on a single or multiple files to determine if new Notes are available to read.

Lists `.qi` and `.db` files for the device.

> **Deprecated:**
>
> This request is deprecated. Use the updated [List Notefiles](#list-notefiles) request instead, which returns a more robust set of Notefile data.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files/changes`                                                                                                                                                                                                                                                                                                                                                |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `files`

*array of strings (optional)*

One or more files to obtain change information from. Omit to return changes for all Notefiles.

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/files/changes?files=[<files>]'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let opts = {
  files: ["null"], // [String] | One or more files to obtain change information from.
};
apiInstance.listNotefiles(projectOrProductUID, deviceUID, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.list_notefiles200_response import ListNotefiles200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    files = ["file_1", "file_2"] # List[str] | One or more files to obtain change information from. (optional)
    
    try:
        api_response = api_instance.list_notefiles(project_or_product_uid, device_uid, files=files)
        print("The response of DeviceApi->list_notefiles:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->list_notefiles: %s\n" % e)
```

**Response Members**

### `total`

*integer*

The total of local Notes across all Notefiles. This includes Inbound Notes that have not been deleted, as well as outbound Notes that have yet to sync.

### `changes`

*integer*

If a change tracker is used, the number of changes across all files.

### `info`

*JSON object*

An object with a key for each Notefile that matched the request parameters, and value object with the `changes` and `total` for each file.

Example Response

```json
{
  "changes": 5,
  "total": 5,
  "info": {
    "my-settings.db": { "changes": 3, "total": 3 },
    "other-settings.db": { "changes": 2, "total": 2 }
  }
}
```

Related Articles

- [Handling Inbound Notes](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data.md#handling-inbound-notes)

- [Using a Change Tracker Across Notefiles](https://dev.blues.io/notecard/notecard-walkthrough/inbound-requests-and-shared-data.md#using-change-trackers-across-multiple-notefiles)

## List Pending Notefile Changes (Notehub) (Deprecated)

Lists `.qi` and `.db` files that are pending sync to the Notecard.

> **Deprecated:**
>
> This request is deprecated. Use the [List Notefiles API](#list-notefiles) with the `pending` argument instead.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files/changes/pending`                                                                                                                                                                                                                                                                                                                                        |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | viewer                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/files/changes/pending'
    -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.listPendingNotefiles(projectOrProductUID, deviceUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.list_pending_notefiles200_response import ListPendingNotefiles200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_response = api_instance.list_pending_notefiles(project_or_product_uid, device_uid)
        print("The response of DeviceApi->list_pending_notefiles:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->list_pending_notefiles: %s\n" % e)
```

**Response Members**

### `total`

*integer*

The total of unsynced notes across all Notefiles.

### `changes`

*integer*

The number of changes across all files.

### `pending`

*boolean*

`true` if there are pending changes.

### `info`

*JSON object*

An object with a key for each Notefile and value object with the `changes` and `total` for each file.

Example Response

```json
{
  "total": 3,
  "changes": 3,
  "pending": true,
  "info": {
    "sensors.qo": { "changes": 3, "total": 3 }
  }
}
```

## Create Notefile (Notehub)

Creates an empty [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile) on the device.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `POST`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/notefiles/{notefileID}`                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`.
- `notefileID` - The filename of the [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile). |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                                                                                                                                   |

Arguments

None

**Example**

**Bash**

```bash
curl -X POST
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/notefiles/<notefileID>'
    -H 'Authorization: Bearer <access_token>'
```

**Response Members**

None: an empty object `{}` means success.

## Delete Notefile (Notehub)

Deletes Notefiles and the Notes they contain.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `DELETE`                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/files`                                                                                                                                                                                                                                                                                                                                                        |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `files`

*array of strings*

One or more files to delete.

**Example**

**Bash**

```bash
curl -X DELETE
    -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/files'
    -H 'Authorization: Bearer <access_token>'
    -d '{"files": [<files>]}'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let deleteNotefilesRequest = new NotehubJs.DeleteNotefilesRequest(); // DeleteNotefilesRequest |
apiInstance.deleteNotefiles(projectOrProductUID, deviceUID, deleteNotefilesRequest).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.handle_notefile_delete_request import HandleNotefileDeleteRequest
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    files = ["file_1", "file_2", "file_3"] # List[str] |
    delete_notefiles_request = notehub_py.DeleteNotefilesRequest(files) # DeleteNotefilesRequest | 

    try:
        api_instance.delete_notefiles(project_or_product_uid, device_uid, delete_notefiles_request)
    except Exception as e:
        print("Exception when calling DeviceApi->delete_notefiles: %s\n" % e)
```

**Response Members**

None: an empty object `{}` means success.

## Provision Device (Notehub)

Provision a [device](https://dev.blues.io/api-reference/glossary.md#device) to a specific [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid), and optionally preassign a serial number and fleet associations. Once set, a device's provisioned configuration will be applied upon its first connection to your Notehub project.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `POST`                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/provision`                                                                                                                                                                                                                                                                                                                                                    |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

### `product_uid`

*string*

The [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) from a Notehub project.

### `device_sn`

*string (optional)*

The user-defined [serial number](https://dev.blues.io/api-reference/glossary.md#product-sn) of the device.

### `fleet_uids`

*array of strings (optional)*

An array of [FleetUIDs](https://dev.blues.io/api-reference/glossary.md#fleetuid) to associate with the device.

**Basic**

**Bash**

```bash
curl -X POST
     -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/provision'
     -H 'Authorization: Bearer <access_token>'
     -d '{"product_uid":"<product_uid>"}'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
let postProvisionProjectDeviceRequest = new NotehubJs.PostProvisionProjectDeviceRequest(); // PostProvisionProjectDeviceRequest | Provision a device to a specific ProductUID
apiInstance.provisionDevice(projectOrProductUID, deviceUID, provisionDeviceRequest).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.provision_device_request import ProvisionDeviceRequest
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 
    project_device_props = {
        "product_uid": "com.blues.example_product_uid",
        "device_sn": "device_uid_1",
        "fleet_uids": ["fleet_uid_1", "fleet_uid_2"]
    }
    provision_device_request = notehub_py.ProvisionDeviceRequest(project_device_props) # ProvisionDeviceRequest | Provision a device to a specific ProductUID, device serial number, or fleetUIDs

    try:
        api_response = api_instance.provision_device(project_or_product_uid, device_uid, provision_device_request)
        print("The response of DeviceApi->provision_device:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->provision_device: %s\n" % e)
```

**Optional Params**

**Bash**

```bash
curl -X POST
     -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/provision'
     -H 'Authorization: Bearer <access_token>'
     -d '{"product_uid":"<product_uid>", "device_sn":"<serial_number>", "fleet_uids":["<fleet_uid>"]}'
```

## Get Device Public Key (Notehub)

Get the static public encryption key associated with a specific Notecard device.

|                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/{deviceUID}/public-key`                                                                                                                                                                                                                                                                                                                                                   |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project.
- `deviceUID` - The [DeviceUID](https://dev.blues.io/api-reference/glossary.md#deviceuid) of a Notehub device. You may alternatively provide a device serial number by prefixing this argument with `sn:`, for example `sn:my-device`. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                                                                                                                                                                                                                                                         |

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
     -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/<deviceUID>/public-key'
     -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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 = "deviceUID_example"; // String |
apiInstance.getDevicePublicKey(projectOrProductUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);
```

**Python**

```python
import notehub_py
from notehub_py.models.get_device_public_key200_response import GetDevicePublicKey200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    device_uid = "device_uid_example" # str | 

    try:
        api_response = api_instance.get_device_public_key(project_or_product_uid, device_uid)
        print("The response of DeviceApi->get_device_public_key:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_public_key: %s\n" % e)
```

**Response Members**

### `uid`

*string*

The unique DeviceUID for the selected Notecard device.

### `key`

*string*

The static public encryption key for the selected Notecard device.

Example Response

```json
{
  "uid":"dev:864622087654321",
  "key":"-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYAEMU422hb6pAYvcG3dXf7TgKNdjlldh5t1ozxd0FmSq53Y0+OZik4/LivDJPpbWmobdxqOlLZ2rQqfzKjku\nlhs+xgkpXQEyu+3ljl2352kl323kwBq\n-----END PUBLIC KEY-----\n"
}
```

Related Articles

- [Encrypting and Decrypting Data with the Notecard](https://dev.blues.io/guides-and-tutorials/notecard-guides/encrypting-and-decrypting-data-with-the-notecard.md)

## Get Public Keys (Notehub)

Get the static public encryption keys stored on all Notecard devices associated with a specific [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid).

|                                                                                                               |                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| HTTP Method:                                                                                                  | `GET`                                                                                                                                                                                                  |
| URL:                                                                                                          | `https://api.notefile.net/v1/projects/{projectOrProductUID}/devices/public-keys`                                                                                                                       |
| Path Parameters:                                                                                              | - `projectOrProductUID` - The [ProjectUID](https://dev.blues.io/api-reference/glossary.md#projectuid) or [ProductUID](https://dev.blues.io/api-reference/glossary.md#productuid) of a Notehub project. |
| Minimum Notehub [project-level role:](https://dev.blues.io/notehub/notehub-walkthrough.md#collaborator-roles) | developer                                                                                                                                                                                              |
| Required HTTP Headers:                                                                                        | `Authorization: Bearer <token>`, where the token is a valid [authentication token](https://dev.blues.io/api-reference/notehub-api.md#authentication).                                                  |

Arguments

None

**Example**

**Bash**

```bash
curl -X GET
     -L 'https://api.notefile.net/v1/projects/<projectOrProductUID>/devices/public-keys'
     -H 'Authorization: Bearer <access_token>'
```

**JS**

```javascript
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure Bearer access token for authorization: personalAccessToken
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: 50, // Number |
  pageNum: 1, // Number |
};
apiInstance.getDevicePublicKeys(projectOrProductUID, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});
```

**Python**

```python
import notehub_py
from notehub_py.models.get_project_device_public_keys200_response import GetProjectDevicePublicKeys200Response
from notehub_py.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
    host = "https://api.notefile.net"
)

# Configure Bearer authorization: personalAccessToken
configuration = notehub_py.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = notehub_py.DeviceApi(api_client)
    project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str | 
    page_size = 50 # int |  (optional) (default to 50)
    page_num = 1 # int |  (optional) (default to 1)

    try:
        api_response = api_instance.get_device_public_keys(project_or_product_uid, page_size=page_size, page_num=page_num)
        print("The response of DeviceApi->get_device_public_keys:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DeviceApi->get_device_public_keys: %s\n" % e)
```

**Response Members**

### `device_public_keys`

*array*

An array of unique DeviceUIDs and public keys stored on each Notecard associated with the specified Notehub project.

Example Response

```json
{
   "device_public_keys":[
      {
         "uid":"dev:864475012345678",
         "key":"-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4GqlEk/RNoX8DUkCnP7C0moL8Y\ncxGyTkALQY6v669Gviic0g0p1jhL7GpEQAUkWg8Ah+bB04V+5aTV2/scClz\nv0g/VanrLz8UH6HIRWgiSJvXZBid05d9\n-----END PUBLIC KEY-----\n"
      },
      {
         "uid":"dev:864622087654321",
         "key":"-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYAEMU422hb6pAYvcG3dXf7TgKNdjlldh5t1ozxd0FmSq53Y0+OZik4/LivDJPpbWmobdxqOlLZ2rQqfzKjku\nlhs+xgkpXQEyu+3ljl2352kl323kwBq\n-----END PUBLIC KEY-----\n"
      },
   ],
   "has_more":false
}
```

Related Articles

- [Encrypting and Decrypting Data with the Notecard](https://dev.blues.io/guides-and-tutorials/notecard-guides/encrypting-and-decrypting-data-with-the-notecard.md)

[Billing Account API](https://dev.blues.io/api-reference/notehub-api/billing-account-api.md "Billing Account API") [Event API](https://dev.blues.io/api-reference/notehub-api/event-api.md "Event API")
