> This is part 1 of 2 of the full documentation (pages 1–100 of 196).
> The content is paginated: fetch every part to see all of it.
> Next part: https://docs.akenza.io/llms-full.txt/1
> Page index: https://docs.akenza.io/llms.txt

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
This site has an agentic ask interface you may use to query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.akenza.io/index.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

---

# Overview

akenza is the IoT application enablement platform that connects, controls, and manages devices, data, and applications, all in one place.

[akenza](https://akenza.io/) is a self-service **IoT application enablement platform**. It covers everything between a sensor in the field and the decision you want to make from its data: connecting devices, decoding their payloads, processing and storing the results, triggering actions, and visualizing it all, without building and operating your own IoT infrastructure.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-bb3b067bbf1f0e51b6cc51bd6a6806df946ec821%2Fakenza-overview.jpg?alt=media" alt="High-level overview of the akenza platform"><figcaption><p>High-level overview of the akenza platform</p></figcaption></figure>

## Start here

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-rocket">:rocket:</i></td><td><strong>Getting Started</strong></td><td>Create your organization and workspace, your working environment on akenza.</td><td><a href="https://docs.akenza.io/how-to-create-a-working-environment">Getting Started</a></td></tr><tr><td><i class="fa-plug">:plug:</i></td><td><strong>Connect a Device</strong></td><td>Bring your first device online and see its data arrive.</td><td><a href="https://docs.akenza.io/how-to-create-a-working-environment/how-to-connect-a-device">Connect a Device</a></td></tr><tr><td><i class="fa-diagram-project">:diagram-project:</i></td><td><strong>Data Flows</strong></td><td>Configure how device data is decoded, processed, and forwarded.</td><td><a href="https://docs.akenza.io/device-management/your-data-flow">Data Flows</a></td></tr><tr><td><i class="fa-code">:code:</i></td><td><strong>REST API</strong></td><td>Automate akenza and integrate it with your own applications.</td><td><a href="https://docs.akenza.io/reference/api-documentation">REST API</a></td></tr></tbody></table>

{% hint style="success" %}
No hardware at hand? The [Device Simulator](https://docs.akenza.io/device-management/create-new-device/device-simulator) lets you send realistic uplinks and build a complete setup before your devices arrive.
{% endhint %}

## How akenza works

The akenza data processing pipeline is structured as follows:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-c4402c00f52e55c18dc6934248323c6dcc0a400d%2Fakenza-data-processing-pipeline.png?alt=media" alt="The akenza data processing pipeline"><figcaption><p>The akenza data processing pipeline</p></figcaption></figure>

1. **Connect.** A device sends an **uplink** over its connectivity (LoRaWAN, HTTP, MQTT, CoAP, NB-IoT, mioty) or through a connected third-party cloud. The [device connector](https://docs.akenza.io/device-management/your-data-flow/device-connector) authenticates the message.
2. **Decode.** The [device type](https://docs.akenza.io/device-management/your-data-flow/device-type) parses the raw payload into structured, human-readable JSON.
3. **Process & store.** [Output connectors](https://docs.akenza.io/device-management/your-data-flow/connectors) write the result to akenza DB or forward it to your own database, streaming service, or webhook.
4. **Act.** The [rule engine](https://docs.akenza.io/device-management/rule-engine) evaluates the data and triggers notifications, downlinks, or aggregations.
5. **Visualize.** The [Dashboard Builder](https://docs.akenza.io/dashboard-builder/dashboard-builder) turns stored data into dashboards, signage screens, and shareable links.

## Applications

The platform is made up of four interlinked applications. You can access all of them regardless of your subscription, though some functionality is restricted to specific tiers. See [Applications](https://docs.akenza.io/general/applications) for details.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-microchip">:microchip:</i></td><td><strong>Device Management</strong></td><td>Manage connectivity, devices, data flows, business logic, and users.</td><td><a href="https://docs.akenza.io/device-management/create-new-device">Devices</a></td></tr><tr><td><i class="fa-chart-line">:chart-line:</i></td><td><strong>Dashboard Builder</strong></td><td>Build data-driven dashboards, share them via public links, and run signage screens.</td><td><a href="https://docs.akenza.io/dashboard-builder/dashboard-builder">Overview</a></td></tr><tr><td><i class="fa-comments">:comments:</i></td><td><strong>Genio</strong></td><td>Ask questions about your IoT data in natural language and get contextual answers.</td><td><a href="https://docs.akenza.io/genio/genio">Overview</a></td></tr><tr><td><i class="fa-qrcode">:qrcode:</i></td><td><strong>Device Setup Assistant</strong></td><td>Roll out devices at scale with QR-code scanning and guided, on-site configuration.</td><td><a href="https://docs.akenza.io/device-setup-assistant/device-setup-assistant">Overview</a></td></tr></tbody></table>

## Platform capabilities

### Device Management

Full control over all your assets at any time. Device management supports every phase of the device lifecycle and offers a comprehensive set of features to manage your fleet at scale: an [asset inventory](https://docs.akenza.io/device-management/create-new-device) with [custom fields](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields) and [tags](https://docs.akenza.io/device-management/managing-a-workspace/tags), [bulk import and bulk actions](https://docs.akenza.io/device-management/create-new-device/asset-bulk-import), per-device message history, signal quality and battery monitoring, and [device lifecycle reports](https://docs.akenza.io/device-management/managing-a-workspace/general-settings/device-lifecycle-reports).

### Connectivity Management

[Connectivity integrations](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan/your-integration) let you integrate and manage devices from different connectivity providers, such as Swisscom LPN, Loriot, Actility, ChirpStack, or The Things Network, so that existing deployments can be operated alongside new ones from a single point.

The [**Connectivity-as-a-Service**](https://akenza.io/features/connectivity-as-a-service) offering additionally lets you onboard devices without establishing a contract with a network provider.

### Data Processing <a href="#systemoverview-datagateway" id="systemoverview-datagateway"></a>

[Data flows](https://docs.akenza.io/device-management/your-data-flow) let you configure a complete data processing pipeline once and then apply it to any device in your fleet. akenza makes sure data is reliably decoded, processed, and forwarded or stored. Payload decoding and encoding can use a [device type from the library](https://docs.akenza.io/device-management/your-data-flow/device-type/library) or your own [custom scripts](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type/scripting).

### Connectors & Storage <a href="#systemoverview-storage" id="systemoverview-storage"></a>

[Output connectors](https://docs.akenza.io/device-management/your-data-flow/connectors) specify the destination of your data and store it for future use: akenza DB, [InfluxDB](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/influxdb), [SQL databases](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/sql-databases), and [Snowflake](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/snowflake), or streaming targets such as [webhooks](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/webhook), [Azure IoT Hub](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/azure-iot-hub), [AWS Kinesis](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/aws-kinesis), [Google Cloud Pub/Sub](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/google-cloud-pub-sub), and [Apache Kafka](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/apache-kafka).

### Rule Engine <a href="#systemoverview-ruleengine" id="systemoverview-ruleengine"></a>

With the [rule engine](https://docs.akenza.io/device-management/rule-engine) you can analyze and process data from multiple devices simultaneously and trigger actions when needed. Actions include sending SMS or email notifications, posting to Slack or Microsoft Teams, sending downlinks, and aggregating your data.

### Data Fusion Layer

The [Data Fusion Layer](https://docs.akenza.io/data-fusion-layer/data-fusion-layer) normalizes telemetry from multi-vendor devices into a standardized digital twin based on a tailored subset of the Brick Schema ontology, so that data is available in its spatial context of sites, floors, zones, and assets, rather than as isolated device silos.

### Akenza Building Edge

[Akenza Building Edge](https://docs.akenza.io/akenza-building-edge/akenza-building-edge) connects building management systems directly to akenza, bringing existing BMS data into the same pipeline as your IoT devices.

## Key concepts

<details>

<summary>Device</summary>

A device (a "thing") represents deployed hardware in the field, capable of connecting to the internet via a supported **connectivity**. Devices send data via **uplinks** and optionally receive commands via **downlinks**. They are managed in the [asset inventory](https://docs.akenza.io/device-management/create-new-device).

</details>

<details>

<summary>Data, topics, and samples</summary>

All data is sent from devices to the cloud, usually telemetry and state, such as environment measurements. Devices typically send data either interval- or event-based. Each uplink triggers the data processing pipeline specified by a data flow.

Data can be partitioned into **topics** based on its purpose or schema, which helps retain the structure of the data. A single data point is called a **sample** and is uniquely identified by device ID, topic, and timestamp.

</details>

<details>

<summary>Connectivity</summary>

The communication protocol a device uses to reach akenza: [**LoRaWAN**](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan), [**HTTP**](https://docs.akenza.io/device-management/your-data-flow/device-connector/http), [**MQTT**](https://docs.akenza.io/device-management/your-data-flow/device-connector/mqtt), [**CoAP**](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap), [**NB-IoT**](https://docs.akenza.io/device-management/your-data-flow/device-connector/nb-iot), or [**mioty**](https://docs.akenza.io/device-management/your-data-flow/device-connector/mioty). Devices living in a vendor cloud, such as Disruptive Technologies, VergeSense, Spaceti, or Haltian, are connected through their respective [device connectors](https://docs.akenza.io/device-management/your-data-flow/device-connector).

</details>

<details>

<summary>Integrations</summary>

[Integrations](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan/your-integration) allow managing devices of connectivity providers (for example Swisscom LPN, Loriot, Actility, or The Things Network). This lets you integrate with existing IoT deployments and manage all assets from a single point.

</details>

<details>

<summary>Data flow</summary>

A [data flow](https://docs.akenza.io/device-management/your-data-flow) defines the data processing pipeline:

* [**Device connector**](https://docs.akenza.io/device-management/your-data-flow/device-connector) specifies the connectivity used to connect a device
* [**Device type**](https://docs.akenza.io/device-management/your-data-flow/device-type) specifies the type of device and implements payload decoding and encoding
* [**Output connectors**](https://docs.akenza.io/device-management/your-data-flow/connectors) specify one or multiple data destinations

</details>

<details>

<summary>Downlink</summary>

[Downlinks](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type/downlink) are commands sent to a physical device (actuator or sensor) to either configure it, for example its sending interval, or trigger an action, such as turning on the lights or closing the blinds. Downlinks are supported for **LoRaWAN**, **NB-IoT**, and **MQTT** devices.

</details>

<details>

<summary>Rules</summary>

[Rules](https://docs.akenza.io/device-management/rule-engine) apply business logic to incoming data in order to trigger actions or alarm notifications.

</details>

<details>

<summary>Output connectors &#x26; rule actions</summary>

[Output connectors](https://docs.akenza.io/device-management/your-data-flow/connectors) specify the data destination for a data flow, while [rule actions](https://docs.akenza.io/device-management/rule-engine/rule-actions) are the response to a triggered rule. Examples include storing data with the akenza DB connector and sending notifications by email.

</details>

<details>

<summary>Organizations &#x26; workspaces</summary>

An [organization](https://docs.akenza.io/device-management/managing-an-organization) is the account under which a business collaborates across many workspaces. A [workspace](https://docs.akenza.io/device-management/managing-a-workspace) is where the actual work happens: adding data flows and rules, and managing devices.

</details>

## Keep going

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-graduation-cap">:graduation-cap:</i></td><td><strong>Tutorials</strong></td><td>Step-by-step guides for specific devices, notifications, and enterprise integrations.</td><td><a href="https://docs.akenza.io/tutorials/add-devices">Devices</a></td></tr><tr><td><i class="fa-clock-rotate-left">:clock-rotate-left:</i></td><td><strong>Changelog</strong></td><td>What's new in akenza, release by release.</td><td><a href="https://docs.akenza.io/changelog">Changelog</a></td></tr><tr><td><i class="fa-life-ring">:life-ring:</i></td><td><strong>Support Center</strong></td><td>FAQ, status page, service desk, and feature requests.</td><td><a href="https://docs.akenza.io/faq/support-center">FAQ</a></td></tr></tbody></table>


# Getting Started

Set up your akenza working environment, then connect your first device and see its data arrive.

Everything in akenza lives inside a **working environment**: an organization that represents your account, and at least one workspace inside it where the actual work happens. You create both during registration, in a single dialog.

{% hint style="info" %}
No account yet? Sign up at [app.akenza.io](https://app.akenza.io). No hardware yet? The [Device Simulator](https://docs.akenza.io/device-management/create-new-device/device-simulator) lets you complete this whole guide without a physical device.
{% endhint %}

## Organizations and workspaces

<table><thead><tr><th width="180">Level</th><th>What it is</th><th>What you manage here</th></tr></thead><tbody><tr><td><strong>Organization</strong></td><td>The account under which a business collaborates across many workspaces at once. Usually named after your company.</td><td><a href="https://docs.akenza.io/device-management/managing-an-organization/subscription">Billing and subscription</a>, <a href="https://docs.akenza.io/device-management/managing-an-organization/api-keys">API keys</a>, <a href="https://docs.akenza.io/device-management/managing-an-organization/organization-users">users</a>, <a href="https://docs.akenza.io/device-management/managing-an-organization/audit-logs">audit logs</a>, <a href="https://docs.akenza.io/device-management/managing-an-organization/general-settings/white-labeling">white labeling</a></td></tr><tr><td><strong>Workspace</strong></td><td>A container inside an organization, typically one per project or site.</td><td><a href="https://docs.akenza.io/device-management/create-new-device">Devices</a>, <a href="https://docs.akenza.io/device-management/your-data-flow">data flows</a>, <a href="https://docs.akenza.io/device-management/rule-engine">rules</a>, <a href="https://docs.akenza.io/device-management/managing-a-workspace/custom-fields">custom fields</a>, <a href="https://docs.akenza.io/device-management/managing-a-workspace/tags">tags</a></td></tr></tbody></table>

An organization can hold as many workspaces as you need, and you can switch between them at any time. Above the organization sits the [tenant](https://docs.akenza.io/general/tenants), the akenza deployment itself. On the public cloud every organization shares the same tenant; an Enterprise deployment is a tenant of its own.

## Create your working environment

{% stepper %}
{% step %}

### Create an organization

During registration you are asked to create an organization. Give it a name, which is most likely your company name, and optionally a description and a logo. Select *Next* to continue.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-093d4f8ac6a82d1e5dab2d6d78813cf0a7c41fce%2Fcreate-organization.png?alt=media" alt="The Create new Organization dialog, showing the Organization step and the Workspace step that follows"><figcaption><p>Creating an organization</p></figcaption></figure>

To add further organizations later, select *Switch Organization* at the top of the sidebar, then *New Organization*.
{% endstep %}

{% step %}

### Create a workspace

The same dialog continues with the **Workspace** step, so a new organization never ends up empty. Workspaces are where the actual work happens: adding data flows, rules, and managing devices. A suitable workspace name is, for example, the name of your project or the site you are equipping.

Select *Create Workspace* to finish. You land on the organization overview, from where you can enter your new workspace.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-3b7950b3f36a4b06ad0a224f0383b2f092ab5a61%2Forganization-overview.png?alt=media" alt="The organization overview"><figcaption><p>The organization overview</p></figcaption></figure>
{% endstep %}

{% step %}

### Connect your first device

With a workspace in place, you are ready to create a data flow and a device, and to watch the first uplink arrive.

{% content-ref url="/pages/-MUICr3a0-fo8AuI\_EKB" %}
[Connect a Device](https://docs.akenza.io/how-to-create-a-working-environment/how-to-connect-a-device)
{% endcontent-ref %}
{% endstep %}
{% endstepper %}

## What to do next

akenza tracks your progress through a **Quick start** checklist on the organization home: data flow created, device created, data received, and rule set up. The guide above plus [Connect a Device](https://docs.akenza.io/how-to-create-a-working-environment/how-to-connect-a-device) covers the first three. From there:

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-bell">:bell:</i></td><td><strong>Set up a rule</strong></td><td>Trigger notifications, downlinks, or aggregations from incoming data.</td><td><a href="https://docs.akenza.io/device-management/rule-engine">Rules</a></td></tr><tr><td><i class="fa-chart-line">:chart-line:</i></td><td><strong>Build a dashboard</strong></td><td>Visualize your data and share it with a public link.</td><td><a href="https://docs.akenza.io/dashboard-builder/dashboard-builder">Overview</a></td></tr><tr><td><i class="fa-layer-group">:layer-group:</i></td><td><strong>Add devices in bulk</strong></td><td>Onboard a whole fleet from a CSV file instead of one device at a time.</td><td><a href="https://docs.akenza.io/device-management/create-new-device/asset-bulk-import">Bulk actions</a></td></tr><tr><td><i class="fa-user-plus">:user-plus:</i></td><td><strong>Invite your team</strong></td><td>Add co-workers to your organization and assign their roles.</td><td><a href="https://docs.akenza.io/general/users">Users</a></td></tr></tbody></table>

{% hint style="info" %}
Learn more about managing your working environment in [Managing an organization](https://docs.akenza.io/device-management/managing-an-organization) and [Managing a workspace](https://docs.akenza.io/device-management/managing-a-workspace).
{% endhint %}


# Connect a Device

Create a data flow, add your first device, and confirm that its data arrives in akenza.

Connecting a device to akenza requires a **data flow**, which describes how data is authenticated, decoded, and stored, and a **device**, which represents the hardware itself and points at that data flow.

You create the data flow first. It is reusable, so every further device of the same model can point at the same data flow without you configuring anything twice.

{% hint style="info" %}
If you do not have a physical device at hand, you can use the [Device Simulator](https://docs.akenza.io/device-management/create-new-device/device-simulator) and complete this guide exactly as written.
{% endhint %}

{% stepper %}
{% step %}

### Create a data flow

Select *Create Data Flow* on the **Data Flow** menu tab. A data flow is assembled from three parts, which you configure in order.
{% endstep %}

{% step %}

### Choose a device connector

The device connector holds the information on how a device communicates with akenza, and defines the secret used to authenticate its data.

**Direct connectivity**

* [LoRaWAN](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan)
* [HTTP](https://docs.akenza.io/device-management/your-data-flow/device-connector/http)
* [MQTT](https://docs.akenza.io/device-management/your-data-flow/device-connector/mqtt)
* [CoAP](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap)
* [NB-IoT](https://docs.akenza.io/device-management/your-data-flow/device-connector/nb-iot)
* [mioty](https://docs.akenza.io/device-management/your-data-flow/device-connector/mioty)

**Cloud-to-cloud connectors**, for devices that already live in a vendor platform:

* [Disruptive Technologies](https://docs.akenza.io/device-management/your-data-flow/device-connector/disruptive-technologies)
* [VergeSense](https://docs.akenza.io/device-management/your-data-flow/device-connector/vergesense)
* [Spaceti](https://docs.akenza.io/device-management/your-data-flow/device-connector/spaceti)
* [Haltian](https://docs.akenza.io/device-management/your-data-flow/device-connector/haltian)

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-c60d936a0ee9fe1ad25e5ae07e2036e297b337a1%2Fdata-flow-device-connector.png?alt=media" alt="Selecting a device connector"><figcaption><p>Selecting a device connector</p></figcaption></figure>

{% hint style="info" %}
If you already run a LoRaWAN network through a provider such as Swisscom, Loriot, Actility, or The Things Network, set up a [connectivity integration](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan/your-integration) instead. The device connector is then created for you, and the provider platform is configured to forward data to akenza.
{% endhint %}
{% endstep %}

{% step %}

### Choose a device type

The device type extracts, transforms, and normalizes the data sent by the device. akenza provides an extensive [device type library](https://akenza.io/features/device-type-library) with more than 300 ready-to-use device types from manufacturers around the globe, maintained openly on [GitHub](https://github.com/akenza-io/device-type-library).

If no suitable device type exists, create a [custom device type](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type) and write your own decoder. Select *Passthrough* if no parsing is required at all, in which case the payload is forwarded unchanged.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-0b95c62b4f4db8a4ee6fa912e7441bdbfba228c3%2Fdata-flow-device-type.png?alt=media" alt="Selecting a device type"><figcaption><p>Selecting a device type</p></figcaption></figure>
{% endstep %}

{% step %}

### Choose one or more output connectors

Output connectors define where the decoded data goes. You can add several to one data flow.

**Databases**

* [akenza DB](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/akenza-db)
* [InfluxDB](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/influxdb)
* [SQL databases](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/sql-databases)
* [Snowflake](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/snowflake)

**Streaming**

* [Webhook](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/webhook)
* [Azure IoT Hub](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/azure-iot-hub)
* [AWS Kinesis](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/aws-kinesis)
* [Google Cloud Pub/Sub](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/google-cloud-pub-sub)
* [Apache Kafka](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/apache-kafka)

**Notifications**

* [E-Mail](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/email)
* [SMS](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/sms)
* [Microsoft Teams](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/microsoft-teams)
* [Slack](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/slack)

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-3851cef96e5ad67e8ddf3b39cce18e4e16f0d86f%2Fdata-flow-output-connectors.png?alt=media" alt="Selecting output connectors"><figcaption><p>Selecting output connectors</p></figcaption></figure>

{% hint style="warning" %}
Add the **akenza DB** output connector unless you have a reason not to. It is what stores the data passing through this data flow, and therefore what makes it available to dashboards, rules, the API, and [Genio](https://docs.akenza.io/genio/genio). A data flow that only forwards data elsewhere keeps no history in akenza.
{% endhint %}
{% endstep %}

{% step %}

### Create a device

Select *Create Device* in the **Asset Inventory**.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e49130c7fa3ac3bdc929ca0397adf40641590c87%2Fasset-inventory.png?alt=media" alt="The Asset Inventory"><figcaption><p>The Asset Inventory</p></figcaption></figure>

Add a device name and, optionally, a description, a [tag](https://docs.akenza.io/device-management/managing-a-workspace/tags), or a [custom field](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields). Naming and tagging consistently from the start pays off once the fleet grows, because tags drive filtering, dashboard data sources, and rule inputs. Select *Next*.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-d04a23d56b4f2861d915958082bc2afec4c20f7d%2Fcreate-device-basic-information.png?alt=media" alt="Basic device information"><figcaption><p>Basic device information</p></figcaption></figure>

Choose the data flow you just created and set an **offline timeout**, which is how long akenza waits without an uplink before flagging the device as offline. Pick a value that suits the device's sending interval. Select *Next*.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e79573c89aa7204aa2a84a60364af6c535a21ef3%2Fcreate-device-data-flow.png?alt=media" alt="Assigning the data flow"><figcaption><p>Assigning the data flow</p></figcaption></figure>
{% endstep %}

{% step %}

### Fill in the connectivity parameters

What is required here depends on the device connector you chose:

* **LoRaWAN:** the device identifiers and keys from your network provider. See [LoRaWAN](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan).
* **HTTP and MQTT:** an alphanumeric secret between 8 and 64 characters.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2112c56e1966da38598f6e7304162a70d68f9eaa%2Fcreate-device-connectivity.png?alt=media" alt="Connectivity parameters"><figcaption><p>Connectivity parameters</p></figcaption></figure>

Finish with *Create device*.
{% endstep %}

{% step %}

### Confirm that data arrives

Select your device from the Asset Inventory and open the **device detail page**. Once the device sends its first uplink you see the last message time, the decoded values, and, depending on the connectivity, signal quality and battery level.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-d9ec25ea76c346bc846d03272f28c410e36f29fc%2Fdevice-detail-page.png?alt=media" alt="The device detail page"><figcaption><p>The device detail page</p></figcaption></figure>

**Congratulations, you have connected your first device.**
{% endstep %}
{% endstepper %}

## If no data arrives

Work down the pipeline in the same order the data travels:

1. **Is the device sending?** Check the device itself, and for LoRaWAN check that the uplink is visible on the network provider's platform.
2. **Is akenza receiving it?** The [Data Processing Logs](https://docs.akenza.io/device-management/data-processing-logs) show what reached the platform and what happened to it, including authentication failures and decoder errors.
3. **Is the payload decoded?** A mismatch between the device type and the actual device is the most common cause of an uplink that arrives but produces no readable values. Verify the device type, or test your decoder in [Scripting](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type/scripting).
4. **Is it stored?** Without the akenza DB output connector, data passes through without being kept.

{% hint style="info" %}
Still stuck? Reach out through the In-App Chat Support or the [Service Desk](https://docs.akenza.io/faq/service-desk).
{% endhint %}

## What to do next

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-layer-group">:layer-group:</i></td><td><strong>Add the rest of your fleet</strong></td><td>Import devices from a CSV file instead of creating them one by one.</td><td><a href="https://docs.akenza.io/device-management/create-new-device/asset-bulk-import">Bulk actions</a></td></tr><tr><td><i class="fa-qrcode">:qrcode:</i></td><td><strong>Deploy on site</strong></td><td>Use the Device Setup Assistant to configure devices by scanning a QR code.</td><td><a href="https://docs.akenza.io/device-setup-assistant/device-setup-assistant">Overview</a></td></tr><tr><td><i class="fa-bell">:bell:</i></td><td><strong>React to your data</strong></td><td>Set up rules to trigger notifications, downlinks, or aggregations.</td><td><a href="https://docs.akenza.io/device-management/rule-engine">Rules</a></td></tr><tr><td><i class="fa-chart-line">:chart-line:</i></td><td><strong>Visualize it</strong></td><td>Build a dashboard from the data your device is now sending.</td><td><a href="https://docs.akenza.io/dashboard-builder/dashboard-builder">Overview</a></td></tr></tbody></table>


# Changelog

This page informs about new features and improvements

## 2026-11-02 - v2.62.0

#### 🚀 New Features

* **Device Management**
  * **DTLS Pre-Shared Keys for CoAP:** CoAP devices can authenticate with a [DTLS pre-shared key](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/dtls-pre-shared-keys) per device. You can generate a key or bring your own.
  * **Data Processing Success Rate:** The Health page shows how many data processing runs succeeded.
  * **Snowflake Output:** Adds support for [customer-managed keys](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/snowflake#byok) (BYOK) for authenticating with Snowflake.

#### 🛠️ Improvements

* **Dashboards**
  * **Redesigned Tag Selector:** Finding and picking tags as a data source is now easier.
  * **Floorplan Time Machine Stepping:** Stepping through history one interval at a time is now more flexible with the new previous/next buttons.
  * **Time Range in Text Components:** Text components can show the dashboard's selected time range as a variable.
  * **More Accurate Time in Range:** Time in range across several devices is now calculated per device first, then aggregated.
  * **Long Floorplan History:** Floorplans with raw data sources no longer fail on ranges longer than a month.
* **Device Management**
  * **Rule Results in Logs:** Logs with mixed rule outcomes show separate Passed and Failed tags, and each tag lists its rules.
* **General**
  * **Visual Refresh:** Buttons, alerts, popovers, switches, empty states and confirmation dialogs have a cleaner, more consistent look across the apps.

## 2026-10-09 - v2.61.0

#### 🚀 New Features

* **Dashboards**
  * **Device Metadata in Tables:** Device metadata can now be selected as a data point and shown as table columns. Metadata columns can be sorted.
  * **Wide Tables:** Tables now support up to ten columns and scroll horizontally. The name column stays pinned.
* **Device Management**
  * **Invoke Target Data Flow:** The akenza DB rule action has a new [Invoke target data flow](https://docs.akenza.io/device-management/rule-engine/rule-actions#invoke-target-data-flow) option. It also sends the stored message to the outputs of the target device's data flow. It is available when **Invoke Rule engine** is enabled and the target device is set to **Select device** or **Dynamic**.
  * **Rich Text for Output Connectors:** Mail, Slack, MS Teams and SMS outputs now support inserting variables and have a rich text editor with an HTML preview. The data output mail now renders rich text.

#### 🛠️ Improvements

* **Dashboards**
  * **Simpler Aggregation Picker:** Aggregation type and interval are now chosen in a single dropdown, matching the device details chart.

## 2026-09-14 - v2.60.0

#### 🚀 New Features

* **Dashboards**
  * **Time in Condition:** Charts, KPIs, gauges, status, tables, images and floorplans can now show how long a data point spent in a defined condition. The "time in condition" can be visualized as an absolute duration or as a share of the selected period.
  * **Rich Text Variables**: Chart, table, image, floorplan, map and group components now also support inserting variables into headings and descriptions and provide support for rich text to underline, make text bold or italic, and insert links.
* **Device Management**
  * **New Organization & Workspace Home:** The redesigned organization and workspace home now provide new metrics and controls to better manage your IoT fleet at scale:
    * New health score to monitor the status of a workspace.
    * Improved metrics to monitor the uptime of an IoT deployment.
    * Get help from Genio to manage, troubleshoot and improve the condition of an IoT deployment.
  * **Organization Creation (Enterprise):** Tenant administrators can now prevent tenant members from creating their own organizations.

#### 🛠️ Improvements

* **Dashboards**
  * **Shareable Device Selection:** The selected context variable is now part of the dashboard URL, so sharing a link opens the dashboard on the same device.
  * **Bug Fixes:** Boolean value mappings on floorplans now render correctly, and desk positions are no longer dropped while the floor is still loading.
* **Device Management**
  * **Script Error Feedback:** Custom logic blocks and device type decoders now show the exact validation error when a script cannot be parsed, and newer JavaScript syntax is accepted.

## 2026-08-28 - v2.59.0

#### 🚀 New Features

* **Dashboards**
  * **Table Search & Sort**: Tables can now be searched directly, and rows can be sorted by value across all pages, not just the current one.
  * **Rich Text Variables**: Text components support inserting variables into headings and descriptions, useful to dynamically display text with values of context variables or time ranges. The description field now supports rich text to underline, make text bold or italic, and insert links. Useful to add external content or link other Dashboards.
* **Device Management**
  * **CoAP Downlinks:** Devices using the CoAP connectivity now [support downlinks](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap).
  * **VergeSense:** VergeSense integrations now also support mapping gateways.
  * **Breadcrumbs:** Every page now shows a breadcrumb trail for easier navigation back to parent pages and orientation especially with a collapsed navigation sidebar.
  * **Workspace Health**: The workspace list now shows a health score and device metrics for each workspace.

#### 🛠️ Improvements

* **Dashboards**
  * **Map Auto-Zoom**: The map component now automatically centers and zooms to show all devices.
  * **Overview Page Redesign**: The dashboards overview page has a refreshed card layout with more compact Dashboard cards and redesigned group sections with per-group search & sorting.
  * **Calendar Grouping**: Charts using the calendar grouping feature have a new aggregation option to better control grouping data by calendar period.
* **Device Management**
  * **Subscription Status**: Subscription status now lives in the main navigation and turns red based on subscription state.

## 2026-07-31 - v2.58.0

#### 🚀 New Features

* **Dashboards**
  * **Context Variable**: Dashboards now support context variables - add a\
    device selector to the dashboard header and all connected widgets will\
    display data for the selected device, without reconfiguring each widget\
    individually. Available on Expert plans.
  * **Sidebar Search**: A new search panel in the dashboard navigation lets you\
    find dashboards by name, browse grouped results, and collapse sections.\
    Press ⌘⇧S to open search from the keyboard.

#### 🛠️ Improvements

* **Dashboards**
  * **Dashboard Header**: Header controls are now grouped behind a shared\
    actions menu with a responsive layout that wraps on narrower screens.
  * **Manual Data Point Entry**: When configuring a widget's data source, you\
    can now type a custom data key and topic directly, rather than\
    selecting only from the available list.
  * **Unit Selector**: All data source configuration panels now share a\
    consistent, scrollable unit picker.
* **Device Management**
  * **Bug Fixes**: Fixed rule autocomplete dropdown opening automatically on\
    page load, missing error for unsupported device type image formats.
* **General**
  * **Dark Mode**: Sticky table column hover color is now consistent in both\
    light and dark themes.
  * **Bug Fixes**: Resolved issues with aggregation headings in cascader\
    dropdowns, tooltip alignment, modal layout, and spacing across badges,\
    filter dropdowns, tables, and the time range selector.

## 2026-07-23 - v2.57.0

#### 🚀 New Features

* **Dashboards**
  * **Floorplan Icons & Posters**: Static icons and posters on floorplans are now available to everyone.
* **Device Management**
  * **DTLS CoAP Connector**: Added [CoAP DTLS](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap#secure-transport-dtls) support, to allow for secure communication over unencrypted UDP networks.

#### 🛠️ Improvements

* **Dashboards**
  * **Lookup & Drilldown**: More consistent dropdown open direction and refreshed, tidier option styling.
  * **Smoother Org Switching**: The dashboard overview now shows a loading state and keeps its title while you switch organizations.
  * **Custom Field Hints**: Custom field descriptions now appear as input hints on the form.
* **General**
  * **Dark Mode**: Refreshed dark theme with a cleaner neutral gray scale and matching shadows.

## 2026-06-26 - v2.56.0

#### :rocket: New Features

* **Dashboards**
  * **Raw Data Option**: Charts now support a "Raw data" aggregation mode, letting you plot unaggregated data points directly without applying any accumulator.
  * **New Occupancy Aggregations**: The aggregation selector gains new occupancy-specific aggregations, making it easier to build occupancy analytics on your dashboards.

#### 🛠️ **Improvements**

* **Device Management**
  * **Bug Fixes:** Resolved display issues and polished the device message logs table layout.
* **Dashboards**
  * **Bug Fixes:** Fixed an issue where the working-hours filter was not applied correctly on chart, table, image, and floorplan components.
* **General**
  * **E-Mail Templates**: Improved the styling of system mails.

## 2026-06-10 - v2.55.0

#### **🚀 New Features**

* **Device Management**
  * **Flexible Filtering**: You can now combine filters with an AND/OR toggle in the filter bank.

#### 🛠️ Improvements

* **Dashboards**
  * **Bug Fixes:** Fixed table columns that were not sorting correctly; corrected the coloring of SVG image layers in the image widget; Resolved a memory leak affecting the floorplan component.
* **Device Management**
  * **Bug Fixes**: Fixed dropdown spacing and a custom logic block layout issue; fixes custom field return format to only include fields for relevant types and strip trailing zeros.
* **General**
  * **Bug Fixes:** Fixed mobile menu item permissions, links, and active-page highlighting; Fixed KPI map coordinate parsing so locations display correctly.

## 2026-05-20 - v2.54.0

#### **🚀 New Features**

* **Dashboards**
  * **New Device Selector & Data Point Picker:** A redesigned device selector and data point picker make it faster and clearer to configure data sources across all dashboard components.
  * **Floorplan Static Icons & Posters:** Floorplan layers now support static icons and poster images, giving you more control over how your floor plans are decorated and annotated.
* **Device Management**
  * **VergeSense Physical Device Support:** Synchronization of physical devices can now be enabled directly within a VergeSense integration setup.

#### 🛠️ Improvements

* **Dashboards**
  * **Bug Fixes:** Resolved issues with component controls opacity in the editor, dashboard table clicking and label wrapping, and missing "no results" translations.
* **Device Management**
  * **Bug Fixes:** Resolved a loading state issue during bulk custom field removal, and removed incorrect autocomplete suggestions on password fields. Message Log Stability: Column layout no longer shifts when switching between topics in the message log and object fields are now rendered as formatted JSON instead of raw text, making payloads much easier to read.

## 2026-04-29 - v2.51.0-v2.53.0

#### **🚀 New Features**

* **Dashboards**
  * **Tag Mapping on Dashboard Import**: Map source tags to target tags during dashboard import so imported dashboards align with the destination workspace.
* **Device Management**
  * **Revamped Asset Message Logs**: New design for the device message log view with columnar-layout and an improved filter bank.
  * **Integration Edit Modal**: Edit existing integrations directly from a new modal; update integration credentials and support for migrating Actility integrations from the DX to the OSS API.
  * **Efento CoAP integration:** Add support for [Efento](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/efento) protobuf uplink format.

#### 🛠️ Improvements

* **Dashboards**
  * **Faster Overview**: Dashboard overview pages with many groups load noticeably faster, and switching dashboard groups now refreshes the overview correctly.
  * **Persistent Time Range**: Time range selection now persists when toggling between edit and view modes.
  * **Workspace-aware Tag Names**: When a dashboard's scope spans multiple workspaces, tag data sources now show the workspace name alongside the tag for disambiguation.
  * **Visible Chart Errors**: Chart components surface API errors instead of failing silently, and image uploads now display the underlying error message when they fail.
  * **Floorplan Camera Fix**: Floorplans render reliably when zooming with the 'showUpToLevel' camera option.
* **General**
  * **Refreshed Icons**: Icons across navigation, audit logs, mobile headers and components are updated for a more consistent product-wide look.

## 2026-04-07 - v2.50.0

#### **🚀 New Features**

* **Dashboards**
  * **Working Hours Filter:** Adds an option to "only include working hours" in the aggregation selector for chart data.
* **Device Management**
  * **HTTP Connector:** Allows parsing of device ID from uplink body [using a template](https://docs.akenza.io/device-management/your-data-flow/device-connector/http#deviceid-templating).

#### 🛠️ Improvements

* **Dashboards**
  * **Bug Fixes:** Resolved issues with dashboard response schema import and missing translations.

## 2026-03-13 - v2.49.0

#### **🚀 New Features**

* **Device Management**
  * **Snowflake Output**: Adds a new [Snowflake](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/snowflake) output connector to directly ingest data into the Snowflake Cloud Data Platform for large-scale analytics and cloud-native data warehousing.

#### 🛠️ **Improvements**

* **Dashboards**
  * **Chart Series Reordering**: Allows users to reorder series within the chart component.
  * **Export**: Adds support for CSV and XLSX export in calendar grouping.

## 2026-02-06 - v2.47.0

#### **🚀 New Features**

* **Dashboards**
  * **Calendar grouping:** Adds new chart mode to group data based on calendar attributes, allowing to analyse occupancy patterns and identify peak hours/days or weeks **(alpha release).**

#### 🛠️ **Improvements**

* **Dashboards**
  * **Bug Fixes:** Wrong formatting of strings that contain a date, improved display of corner radius of stacked bar charts.
* **General**
  * **Bug Fixes:** Resolved issues with table headings, output connector templating suggestions, and setup assistant QR code resolution.

## 2026-01-29 - v2.46.0

#### **🚀** New Features

* **Dashboards**
  * **Unifies KPI quick view** on image, map, and floorplan components
  * Adds visualization option 'fill' to image component

## 2025-12-19 - v2.45.0

#### **🚀** New Features

* **Dashboards**
  * **Enhanced Image & Floorplan Components:** Adds support for additional value mapping settings, collapsible legends, and coloring for smplrspace icon layers.
  * **Component Text Styles:** Introduces new customizable text styles for dashboard components and charts to improve visual hierarchy.
  * **Editor Improvements:** Refreshs the editor user experience with support of keyboards shortcuts and an improved user experience
* **Device Management**
  * **New Time Range Selector**: Adds the new time range selector component.

#### 🛠️ **Improvements**

* **Dashboards**
  * **Performance & UI:** Optimizes legend displays for discrete value mappings, improves KPI card style centralization, and adds a maximum limit of 20 series for chart components.
* **Device Management**
  * **UI/UX Refinement:** Improves spacing for the uploader component, updated design for active plans, and added a "no results" state to the column picker.
* **General**
  * **Dark Mode:** Extensive improvements and general availability of dark mode
  * **Bug Fixes:** Resolved issues with margin calculations, billing status displays, dashboard padding, and asset detail tab selection from URLs.

## 2025-12-04 - v2.44.0

#### **🚀** New Features

* **Dashboards**
  * Adds time-series support for boolean values
  * Adds automatic dark/light theme selection for *Public dashboards* based on system settings
  * Adds possibility to set *your location* in the *Image Component* and *Floorplan Component*
* **Device Management**
  * Adds the possibility to switch the theme
  * Adds "*Resend Mail*" option for already invited members in the members list
  * Adds *Domain Restriction* to the *Actility Integration* creation

## 2025-10-08 - v2.42.0

#### **🚀** New Features

* **Color picker:** The new color picker now allows to use system colors, more predefined colors and other custom colors
* **Device Management**
  * Adds 15 minute aggregation support in output connector

## 2025-09-22 - v2.39.0-v2.41.0

#### **🚀** New Features

* **Dashboards**
  * Adds support for Multi-Axis Charts in the *Chart Component*
  * Adds the functionality to Export and Import Dashboards
* **All Apps**
  * Adds keyboard support for opening the *Context Switcher,* use *q* to open the context switcher

#### 🛠️ **Improvements**

* **Device Management**
  * Changes the behaviour of *Processing Logs* to only store logs that were not successful and adds a control to enable debugging for 24 hours on the *Logs Page*
* **Dashboards**
  * Updates performance when loading Dashboards overview with many *Dashboard Groups* and *Dashboards*
  * Updates performance of *Image Component* with a large number of POIs

## 2025-07-25 - v2.38.0

#### **🚀** New Features

* **Device Management**
  * Adds possibility to generate [**Shared Access Signature (SAS) Tokens**](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security#shared-access-signatures) from Device Connector card or from device *API-Configuration* tab on *Device Details Page*

#### 🛠️ **Improvements**

* **Device Management**
  * Adds possibility to display Custom Fields of all Organizations on the *Organization: Devices* page and enables sorting by the field, and merges Custom Fields with the same name from different workspaces
  * Various smaller bug fixes
* **Dashboards**
  * Updates the component selector UI
  * Adds descriptions to table and group components
  * Fixes bug with selection of metric type on Performance component

## 2025-07-18 - v2.37.0

#### **🚀** New Features

* **Device Management**
  * Adds [**Shared Access Signature (SAS) Tokens**](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security#shared-access-signatures) as a new device authentication option. SAS tokens use a signing key per device connector that is used to generate time-bound tokens per device or gateway.

#### 🛠️ Improvements

* **Dashboards**
  * Various smaller UI improvements (Charts, allow to click dashboard cards, etc.)

## 2025-07-03 - v2.36.0

#### **🚀** New Features

* **Device Management**
  * Adds **AirThings** cloud-to-cloud integration

#### 🛠️ Improvements

* **Dashboards**
  * Signage screen type scaling update: Type scaling is now optimized to counteract visual downscaling on high density screens and the the optimal display of Signage Screen with many components
  * Dashboards Overview cards: You can now see what the type of each Dashboard is on the overview cards
  * Group side padding update: Group content of plain groups now visually aligns with non-grouped components on Classic Dashboards
  * Image component markers: Updated to differentiate Label type coloring modes and optimize Dot type UX
  * Various smaller UI improvements (Charts, Data Flow templates, Status component, etc.)

## 2025-06-20 -v2.35.0

#### **🚀 New Features**

* **Dashboards**
  * A new Image component is introduced that allows data visualization on vector (svg) and pixel (png/jpeg) graphics
  * Charts now support a summation accumulator, making data aggregation even more powerful

#### 🛠️ Improvements

* **Dashboards**
  * Threshold Styling: We've updated the threshold styles for colored components
  * Mobile Optimizations: We've implemented several mobile-specific changes for a smoother experience on the go.
  * Status Component: Improves handling for larger components for better layout.
  * Gauge Component: Adds option to hide device values (for a minimal view)
* **E-Mails**
  * Improves E-Mail UI and layout

#### 🐛 Bug Fixes

* **Dashboards**
  * Threshold Calculations: Fixes some pesky threshold calculation issues.
  * Time Range Selector: Resolves an issue preventing the disabling of the next date for non-relative ranges.

## 2025-05-16 - v2.32.0

#### **🚀 New Features**

* **Device Management**
  * Introduces **audit logs**, organization admins can now see all the changes made to their organization and by whom
  * Adds **Netmore, Disruptive Technologies** and **VergeSense** connectivity integrations
  * Updates **welcome flow** to offer enabling **2FA** to newly created users and show welcome screen to invited users

#### 🛠️ Improvements

* **Dashboards**
  * Adds **dynamic font sizing** for status components
  * Adjusts **floorplan controls** and table re-rendering

#### 🐛 Bug Fixes

* Resolves dropdown scrolling issues in device type library
* Addresses multiple visual glitches in dashboard components (alignment, spacing, metadata rendering)
* Several UI/UX improvements and bugfixes

## 2025-05-09 - v2.31.0

#### 🛠️ Improvements

* **Auth:** adds home identity provider discovery

## 2025-04-04 - v2.30.0

* **Dashboards**
  * Migrates to a different grid engine
  * Added group component
  * Several UI and UX improvements and bugfixes

## 2025-03-26 - v2.29.0

* **Device Management**
  * Several UI and UX improvements and bugfixes

## 2025-03-13 - v2.28.0

* **Device Management**
  * Several improvements around permission management
  * Changes the default locale for charts to 'en'
  * Introduces the x-uplink-secret and x-device-id headers for HTTP uplinks

## 2025-03-04 - v2.27.0

* **Device Management**
  * Improves look and feel of the API keys page
  * Fixes an issue with MQTT user topic validation (if the topic name is invalid, data will be stored under the default topic instead)

## 2025-02-21 - v2.26.0

**New Features**

* **Dashboards**:
  * Introduces a new dashboard layout type intended for building signage screens
    * Currently restricted to users with alpha features enabled
  * Introduces new appearance settings applicable to all components
  * Introduces the ability to customize the header's appearance
* **Device Management**
  * Better 404 handling

**Bug Fixes**

* **All Apps**
  * Fixes double occurrence of unsaved changes modal
* **Dashboards**:
  * Fixes the issue preventing closure of the marker modal within the map component
  * Enhancements and corrections to threshold calculations for all components
* **Device Management**
  * Fixes workspace description field validation
  * Fixes an issue where the chart failed to display for certain assets under specific conditions
  * Fixes some typos

## 2025-02-05 - v2.25.0

**New Features**

* Introduces a new authentication service for improved account security, incl.:
  * 2FA authentication
  * Additional SSO provider: Microsoft & Github
  * An improved user profile to manage access credentials and active sessions

## 2025-01-14 - v2.23.0

**Improvements**

* **All Apps:**
  * Various styling improvements
* **Dashboards:**
  * Adds summation accumulator to the Dashboard KPI Components for tag mode
  * Aligns the Dashboard Trend component form to other KPI components’ forms

## 2024-12-20 - v2.22.0

**Improvements**

* **Device Management:**
  * Adds mioty as a connectivity to the device type form
  * Adds connectivity as a separate section in Device Type Library, and Data Flow creation
  * Fixes wrong hidden field on Amazon Kinesis output connector
  * Improved email templates

## 2024-12-13 - v2.21.0

**New Features**

* **Dashboards:**
  * Introduces the performance component for visualizing the value of a metric compared to a maximum value
  * Extends the downlink state component with settings for persisting the state
  * Adds an option to hide furniture in floorplans
  * Introduces the ability to handle camera settings for buildings with a single level

## 2024-12-04 - v2.20.0

**New Features**

* **Dashboards**:
  * Adds table sorting with persistent state
  * Introduces gauge component for visualizing data with customizable styles
  * Updates component selector
  * Enables downlink demo mode, including settings and default values.

**Bug Fixes**

* **Dashboards**:
  * Fixes group names disappearing on public dashboards
  * Removes aggregation interval from the status component

## 2024-11-21 - v2.19.0

**Features**

* **Dashboards**:
  * Adds support for a new layer type floor in floorplan components
  * Adds a new status component to dynamically translate and color values
  * Improves localized number format on component values to enhance readability
* **Device Management**:
  * Adds 404 redirects for missing entities for smoother navigation
  * Enhances custom payload suggestions and removes mode selection for rule output connectors

**Bug Fixes**

* **Dashboards**:
  * Resolves an issue where group names disappeared in the editor header after auto-refresh
  * Improves component order for mobile views
  * Fixes slow loading of dashboards on Safari
* **Device Management**:
  * Resolves issues with SIM card inventory not functioning correctly
  * Sorts data sources alphabetically in rule logic

## 2024-10-24 - v2.18.0

#### Features

* **Device Management:**
  * Enhances downlink rule actions and device details downlink tab
    * Adds templating and input device option for target devices (rule actions)
    * Adds option to use the downlink encoder or sending a raw payload
    * Adds MQTT quality of service (QoS)
    * Adds LoRaWAN clear queue functionality to replace pending downlinks
  * Enhances data flow output connectors to forward hourly aggregations (output event mode: event or aggregation)
* **Dashboards:**
  * Adds 4 new downlink components (button, input, slider, and switch)

#### Fixes

* **Device Management:**
  * Updates the connection history to hide chart for unregistered devices
  * Resolves an issue with no data showing in diff view for audit logs
  * Improves page not found behavior

## 2024-09-20 - v2.17.0

#### Features

* **Device Management:**
  * Adds downlink encoder option
  * Improves page not found behavior.
  * Updates connection history to hide chart for non-registered devices without carrierId.
* **Dashboards:**
  * Adds new downlink dashboard components

#### Fixes

* **Device Management:**
  * Resolves issue with no data showing in diff view for audit logs.

## 2024-09-20 - v2.17.0

**Features**

* **Device Management**:
  * Adds CSV upload for Device Setup Assistant metadata in the workspace settings
* **Setup Assistant**:
  * Improves look of navigation and context switcher

## 2024-09-20 - v2.16.0

**Improvements**

* **Device Management:**
  * Improves pagination on message logs.
* **Setup Assistant:**
  * Enhances camera selection order for QR code setup.

**Fixes**

* **Device Management:**
  * Fixes navigation issues on asset details and back button behavior.
  * Refines user roles display in workspace member assignment.
  * Corrects downlink tab behavior for deregistered devices.
  * Improves handling of asset inventory custom fields display.

## 2024-08-16 - v2.15.0

### New features

* **Device Management:**
  * New look and feel of the mobile context switcher
* **Dashboards:**
  * Introduces public dashboards white labeling
  * Redesigns Overview & Templates page
  * Restyles KPI component thresholds

### Improvements

* Improves white labeling system color gradation

## 2024-08-05 - v2.14.0

### New features

* **Device Management:**
  * Adds filters into groups on asset management for greater traceability
* **Dashboards:**
  * Enhances camera settings in the floor plan

### Improvements

* Fixes filter functionality

## 2024-07-26 - v2.13.0

### Improvements

* **Device Management:**
  * Improves phone number inputs
  * Fixes an issue with multiple tabs reloading after a session timeout

## 2024-07-16 - v2.12.0

### New features

* **Device Management:**
  * Allows to customize SMS sender name for white labelled organizations
* **Dashboards:**
  * Improves context switcher

### Improvements

* Fixes dataflow links
* Fixes floor plan legend and history slider visibility issues

## 2024-07-02 - v2.11.0

### New features

* **Device Management**:
  * Adds sorting by active and timer in rules table.
  * Adds loading state to filters

### Improvements

* Fixes various style and spacing issues.

## 2024-06-24 - v2.10.0

### New features

* **Dashboard Improvements**: Adds a new template page, saved camera positions in the 3D floorplan, and improved component error states.
* **Device Management**: Adds parameters to asset history pages, sorted measurement types alphabetically, and added search and stickiness in tag lists.

### Improvements

* **General**: Improves translations, responsiveness, and overall user experience.
* Fixes issues with measurement type icons, create data route field, and bulk operations in Device Management.
* Fixes time series chunking in Dashboards.

## 2024-05-25 - v2.9.0

### Improvements

* Enhances logo upload options for **white labeling**
* Introduces tag data sources for chart components in **Dashboard Builder**
* Introduces templating for target devices for custom logic blocks (akenza DB output connector)
* Various improvements for number formatting, chart settings and display, general look & feel and stability

## 2024-05-14 - v2.8.0

### New features

* Introduces **white labeling**: Change the look and feel of your organization in the organization settings

### Improvements

* Improves look and feel of various tables
* Adds filters to custom fields table, and rules table

## 2024-04-26 - v2.7.0

### New features

* Introduces **Mioty device connector**

### Improvements

* Improves look and feel of various tables

## 2024-04-09 - v2.6.1

### Improvements

* New look of the user profile page

## 2024-04-03 - v2.6.0

### New features

* Introduces **Dashboard grouping**

### Improvements

* Improves table filters and pagination
* Unifies date format over the apps

## 2024-03-15 - v2.5.3

### Improvements

* Adds LoRa 1.0.4 support
* Improves stability on billing and history charts

## 2024-03-06 - v2.5.2

### Improvements

* Adds new subscription plans
* Adds workspace occupancy settings
* Improves data overview charts for different aggregation types
* Several bug fixes

## 2024-02-14 - v2.5.1

### Improvements

* Added new filter bank for the device type library
* Multiple small UI/UX and bug fixes
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

## 2024-01-22 - v2.5.0

### Improvements

* Adds **keyboard support** for filters
* More user-friendly handling of destructive operations
* Multiple small UI/UX fixes and bug fixes
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

## 2023-11-28 - v2.4.0

### New features

* Adds **VergeSense** as a device connector

### Improvements

* **Rework** of the device details page to improve data display
* Improved **scripting experience** (syntax highlighting, arguments can be saved)
* Several bug fixes
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Dashboard Builder v1.2.0

* Introducing **thresholds** for KPI, chart and table component
* Improved component metadata display to show time range and aggregation method
* Several bugfixes

## 2023-10-31 - v2.3.0

### New features

* **Major rework** of the search and filtering on the asset inventory
* Adds support for **Haltian** as new integration type

### Improvements

* Improved bulk import capabilities for [tags and custom fields during device creation](https://docs.akenza.io/device-management/create-new-device/bulk-import-csv-templates#additional-values-custom-fields-and-tags)
* Several bug fixes
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

## 2023-09-20 - v2.2.0

### New features

* **Analytics Data Sink:** store data directly in your SQL database (supported databases: MySQL, PostgreSQL, MariaDB, Oracle DB and MS SQL)
* **Device Type Schema Builder**: manage the data schema of custom device types for improved data governance

### Improvements

* Improved error messages in the platform
* Several bug fixes
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

## 2023-08-30 - v2.1.0

### New features

* **Billing Cockpit (beta):** Gain insights about the current product usage
* **New Java MQTT examples:** [Java example](https://github.com/akenza-io/akenza-java-examples) repository

### Improvements

* **Improved LoRaWAN device creation:** Improved frequency plan selection
* **Improved rule tag input combination**
* Several bug fixes
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

## 2023-05-18 - v2.0.0 - Major Spring Update :tada:

akenza recharged - read the [blog post](https://blog.akenza.io/akenza-recharged).

### New features

* **Dashboard builder:** Initial Release of our dashboard builder to directly create dashboards with akenza
* **Improved LoRaWAN support:** Support for LoRa frequency plans and LoRaWAN 1.1
* **Enhanced LoRaWAN CaaS offering for Swisscom:** Roaming in large parts of Europe and Geolocation
* **Updated pricing:** Read more in [our blog](https://blog.akenza.io/r23-pricing-model)
* **Device setup assistant:** App for pairing devices to a physical location during the installation process
* **iotcreators.com integration:** Adding support for NB-IoT with [iotcreators.com](https://iotcreators.com/)
* **UI update:** akenza recharged UI style

### Improvements

* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)
* Various bug fixes

## 2023-03-03 - V1.36.0

### New features

* **Multi-tag rule inputs:** Build your rule with a combination of multiple tags
* **Geo location data:** Support for displaying geo location data on a map on the device data overview
* **Actility network localization:** Support for Actility network localization (contact us for enabling it for Swisscom connectivity)

### Improvements

* MQTT [user topics](https://docs.akenza.io/device-management/your-data-flow/device-connector/mqtt#mqtt-sub-topics) and payload parsing improvements
* Various bug fixes

## 2022-12-20 - V1.35.0

### New features

* Release of the [akenza Java client](https://github.com/akenza-io/akenza-java-client), a Java SDK for integrating with the akenza API
* Add support for additional payload formats when using MQTT5 (text, xml and csv)
* Add support for geo fence logic blocks in the rule engine (verify that an asset is inside or outside of a geo fence)

### Improvements

* Various bug fixes

## 2022-11-24 - V1.34.0

### New features

* Add support for dynamic [device configuration API](https://docs.api.akenza.io/#330a150e-a7be-476b-90a8-050364477516)
  * add config for MQTT devices
  * automatic configuration push to device when connecting to akenza
  * automatic configuration push when adding a new configuration
* Add support for consecutive rule invocations for the akenza DB output connector

### Improvements

* Add Device Type Library page on the Data Flow overview to browse device types
* Various bug fixes

## 2022-11-11 - V1.33.0

### New features

* JSON properties on Organizations and Workspaces
* Add support for Device Credentials:closed\_lock\_with\_key:
  * Certificate-based authentication for MQTT devices
  * Read more about [Device Security](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security)

### Improvements

* Add search on rule list
* Add validation for custom field names to improve usability during script-based access
* Dataflow create and edit improvements
* Improved rule timer interval logic
* Various bug fixes

## 2022-10-28 - V1.32.0

### New features

* Add support for integrating with [Spaceti](https://www.spaceti.com/)
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Improvements

* Change device ID validation to allow GUIDs and MAC addresses
* Fixes an issue with string custom field inputs
* Various bug fixes

## 2022-10-17 - V1.31.0

### New features

* Bulk actions for registering / deregistering LoRa devices
* Custom Field Management
  * Added a UI for managing custom fields in Workspace Settings
  * CHANGED: Custom field names are now required to be unique
* Tag Management
  * Added a UI for managing tags in Workspace Settings
  * CHANGED: Tag names are now required to be unique
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Improvements

* Major UI/UX rework of the rule engine
* Various bug fixes

## 2022-09-09 - V1.30.0

### New features

* New device connector for ChirpStack
* New Cibicom LoRaWAN integration and Connectivity-as-a-Service (CaaS)
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Improvements

* Adds option to include metadata for device data export
* Various bug fixes

## 2022-09-02 - V1.29.0

### New features

* Visual update for data flows
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Improvements

* Increased email recipient limit of 25 for output connectors and rule actions
* Various bug fixes

## 2022-08-15 - V1.28.0

### New features

* Introduces option to show/hide KPIs on the device detail page.
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Improvements

* Plenty of small UI improvements
* Various bug fixes

## 2022-07-25 - V1.26.0

### New features

* Advanced rule timer functionality (fixed executions on specific weekdays, custom cron expressions)
* New [examples repository](https://github.com/akenza-io/akenza-examples) for the akenza REST API
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Improvements

* Adds custom fields as suggestions for templating in data flows and rules
* Various improvements and bug fixes

## 2022-06-16 - V1.25.0

### New features

* CaaS
  * Everynet - adds Everynet Connectivity as a Service
* Add support for using preinstalled [modules](https://docs.akenza.io/api-reference/scripting#module-imports) in device type scripts (luxon)
* New device types: see [changelog](https://github.com/akenza-io/device-type-library/blob/master/CHANGELOG.md)

### Improvements

* Various improvements and bug fixes for the asset inventory
* Adds the possibility to use templating in custom database output connector topics
* Allows the use of bulk import also if there are no devices created yet
* Fixes a bug where not the current time was used for rule timers

## 2022-05-25 - V1.24.0

### New features

* CaaS
  * ewz - adds ewz Connectivity as a Service

### Improvements

* Various smaller bug fixes and improvement

## 2022-05-11 - V1.23.0

### New features

* Integrations
  * Everynet - adds the possibility to add Everynet integrations
* Assets
  * Introduce an option to exclude devices from the lifecycle report

### Improvements

* Various smaller bug fixes and improvement

## 2022-04-21 - V1.22.0

### New features

* User onboarding process
  * Application setup
  * Onboarding assistant with progress indicator and checklist
* Assets
  * Built-in data generator
* API-key management
  * Workspace scope on the API-key

### Improvements

* UI navigation
  * Top to side navigation
* Data Flow
  * Data Flow templates
* Mobile navigation
* Various smaller bug fixes and improvements

## 2022-03-04 - V1.21.0

### New features

* Extended Device Type library with new Device Types
  * [Abeeway Badge Tracker](https://akenza.io/features/device-type-library/abeeway)
  * [Abeeway Compact Tracker](https://akenza.io/features/device-type-library/abeeway)
  * [Abeeway Micro Tracker](https://akenza.io/features/device-type-library/abeeway)
  * [IMBuildings Comfort sensor](https://akenza.io/features/device-type-library/imbuildings)
  * [IMBuildings Office occupancy counter](https://akenza.io/features/device-type-library/imbuildings)
  * [IMBuildings People counter](https://akenza.io/features/device-type-library/imbuildings)

### Improvements

* Overall workspace metrics
* Routing refactoring
* Various smaller bug fixes and improvements

## 2022-02-04 - V1.20.0

### New features

* Data Flow
  * Device connector [Yanzi](https://yanzi.se/)
* Extended Device Type library with new Device Types
  * [Yanzi Presence Mini](https://akenza.io/features/device-type-library/yanzi)
  * [Yanzi Comfort](https://akenza.io/features/device-type-library/yanzi)
  * [Yanzi Motion+](https://akenza.io/features/device-type-library/yanzi)
  * [Yanzi Plug](https://akenza.io/features/device-type-library/yanzi)
  * [Adeunis Pulse](https://akenza.io/features/device-type-library/adeunis)
  * [Elsys VOC](https://akenza.io/features/device-type-library/elsys)

### Improvements

* Organization overview
  * Resource tile with supportive links
* Data Flow
  * Display of integrations in device connector list
* Code editor
  * Various code editor layout fixes (Applies for custom logic- and custom device type code editor)
* Various smaller bug fixes and improvements

## 2022-01-14 - V1.19.0

### Improvements

* Asset Inventory
  * Message logs
    * Downlinks displayed in *Message log* on the device detail page. Sent downlink messages are stored as device messages. Topic name: `downlink_history`
  * Overview
    * Deregister state of LoRa devices in column *Connectivity status* displayed in yellow
* Various smaller bug fixes and improvements

## 2022-01-06 - V1.18.0

### New features

* Workspace overview metrics
  * Data pipeline
  * Device health overview
* Extended Device Type library with new Device Types
  * [Pipiot PeopleSense](https://akenza.io/features/device-type-library)
  * [Pipiot LevelSense](https://akenza.io/features/device-type-library)

### Improvements

* Organization & Workspace navigation
  * Back button to allow returning to the main navigation sidebar view

## 2021-12-16 - V1.17.0

### New features

* Extended Device Type library with new Device Types
  * [Miromico Insight](https://akenza.io/features/device-type-library/miromico)

### Improvements

* Data Flow
  * Redesign of device- & output connector
* Custom Logic
  * Form refactoring (create & edit)

## 2021-11-29 - V1.16.0

### New features

* Asset Inventory
  * Device data export & delete
* Output connector
  * [Slack](https://docs.akenza.io/tutorials/create-notifications/how-to-send-notifications-to-slack)

### Improvements

* Device Lifecycle notifications
  * Allow sending weekly interval
* Asset Inventory
  * Allow bulk for tags & custom fields
* Output Connector Microsoft Teams
  * Allow "Send message only once"

## 2021-11-22 - V1.15.0

### Improvements

* Asset Inventory
  * Data History Chart improvements
  * Available sensors and connectivity details on Custom Device Type improvements
* Rule
  * Advanced templating for timed rules
  * New event types on custom logic (UPLINK, DOWNLINK, TIMER)
* Mobile support

## 2021-11-05 - V1.14.0

### New features

* Output Connector
  * [Kafka](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-event-hubs-with-apache-kafka)
* Extended Device Type library with new Device Types
  * [Sensative Strips Presence](https://akenza.io/features/device-type-library/sensative)

### Improvements

* Custom payload
  * Show template variable suggestions in custom payloads
* Device Detail Page
  * Linked rules are displayed within *device details*. Includes all rules where the device is directly specified as input or where the device has a matching tag for the input
* Output Connectors
  * Code-map on JSON editor disabled
  * Validation for Azure IoT Hub connection string

## 2021-10-25 - V1.13.0

### New features

* Integration
  * [Helium as HTTP decoding type](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan/helium)
* Output Connector
  * [AWS Kinesis](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-aws-kinesis)
  * [Microsoft Teams](https://docs.akenza.io/tutorials/create-notifications/how-to-send-notifications-to-microsoft-teams)
* Extended Device Type library with new Device Types
  * [Decentlab DL-LP8P](https://akenza.io/features/device-type-library/decentlab)
  * [Plenom Kuando Busylight](https://akenza.io/features/device-type-library/plenom)
  * [DSS Ranos dB2](https://akenza.io/features/device-type-library/dss)

### Improvements

* Tenant asset inventory
  * Display Organization- & Workspace Columns
* Output connector
  * Allow using Custom Payload for the Azure Output Connector

## 2021-10-19 - V1.12.0

### New features

* Output Connector
  * Allow templating of custom payload as array for Webhook output connectors
  * **Breaking Change:** Update templating Syntax. Make sure to change the syntax according to the [Payload Templating reference ](https://docs.akenza.io/reference/message-templating#json-payload-templating)if the custom payload template is edited. The current configuration will still work if not changed or updated. There will be an adaption in the backend coming soon which will help with the transition to the new format until the old format is deprecated.

### Improvements

* Asset Inventory
  * Update default selection of asset inventory columns
  * Add column selector to the organization asset table
* Rules
  * Align rule page header with data flow page header
* Device Detail
  * Update labels for connectivity details
* General
  * Update date time format
  * Change tab switch animation
  * Unify description item spacing in page headers

## 2021-10-12 - V1.11.0

### New features

* Asset Inventory
  * KPI Trend indicator on Device Detail Page
  * Device offline timeout settings during creation, edit & bulk
* Output Connector
  * [InfluxDB](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-influxdb)
  * [Google Cloud Pub/Sub](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-the-google-cloud-pub-sub)
* Extended Device Type library with new Device Types:
  * [Enginko MCF-LW12CO2E](#coming-soon)

### Improvements

* Data Flow
  * *Search* field on Data Flow Overview Page
* Asset Inventory
  * Battery level information on Asset Inventory & Asset Detail Page
* Output Connector
  * Webhook connector allows URL templating
* Mail & SMS Output Connector
  * Send every new incoming data sample or only once after the status has changed (optional field)
* Logs
  * Logs emitted in scripts on processing log

## 2021-09-21 - V1.10.0

### New features

* Asset Lifecycle Message notification
  * Informs user-defined recipients about critical asset lifecycle events on workspace level about device offline, weak signal, low battery
* Extended Device Type library with new Device Types
  * Milesight AM107
  * Milesight AM104
  * Milesight EM300-TH
  * Milesight EM500-CO2

### Improvements

* Asset Detail Page
  * Add units to Device Data KPIs
  * Realtime update with WebSocket API
* Support for editing custom fields during bulk edit
* App navigation
  * API-keys and Subscription as main navigation on organization level

## 2021-09-13 - V1.9.0

### Improvements

* Custom fields and Asset Tags on asset creation form and edit view
* Deregistered devices removed from billed units
* App navigation allows opening nav item in a new tab
* Refactoring
  * Asset Detail Page
  * Sim Card Detail Page

## 2021-09-03 - V1.8.0

### New features

* [Release of Expert Plan](https://akenza.io/pricing)
* [Azure IoT Hub Output Connector](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/azure-iot-hub)
* [WebSocket API](https://docs.akenza.io/reference/websocket-api)
* [Rule Engine - Custom Logic Blocks](https://docs.akenza.io/deprecated/custom-logic-blocks)
* [SIM Card Management](https://docs.akenza.io/deprecated/sim-cards)

### Improvements

* Various smaller bug fixes and improvements

## 2021-08-27 - V1.7.0

### New features

* Integration
  * [Disruptive Technologies](https://www.disruptive-technologies.com/) (DT) as HTTP decoding type
* Extended Device Type library with new Device Types
  * DT Temperature sensor
  * DT Touch sensor
  * DT Proximity sensor
  * DT Water sensor
* Asset Tags
  * Asset tags on Asset Detail Page & Rule Engine for Asset grouping

### Improvements

* Asset Inventory
  * Columns on Asset Overview Page
    * Data Flow
    * Device Type
    * Creation- & modified date
  * *Show logs* tab on the Asset detail page
  * UI improvement on the Asset creation page
* Subscription
  * Stop/ change active subscription

## 2021-08-04 - V1.6.0

### New features

* Integration
  * [Sigfox](https://www.sigfox.com/en) as HTTP decoding type

### Improvements

* Rule Engine
  * Pulse animation on selected input-, logic- and output block to emphasize user to connect blocks
* Asset Detail Page
  * Autoscaling y-axis on data history chart
* General page header UI improvements

## 2021-07-19 - V1.5.0

### New features

* Bulk actions
  * [Bulk edit](https://docs.akenza.io/get-started/create-new-device/asset-bulk-import)
* Integration
  * [CoAP](https://docs.akenza.io/api-reference/coap)
* Feature request function on help header dropdown
* Extended Device Type library with new Device Types
  * Landis+Gyr ULTRAHEAT T550

### Improvements

* Rule Engine
  * Logic block: Cascade dropdown for mapped data source
  * Overview Page: “Actions” tab with rule actions overview
* Register-/ deregister button to switch between two LoRa network carriers
* Automatic user identification for [feature request board](https://akenza.canny.io/akenzaio)
* Asset Inventory
  * Edit HTTP and MQTT devices

## 2021-07-06 - V1.4.0

### New features

* Bulk actions
  * [Bulk import & delete](https://docs.akenza.io/get-started/create-new-device/asset-bulk-import)
* Integration
  * Everynet device connector as http decoding type
  * EWZ LoRaWAN as new integration provider
* Rule Engine
  * Rule activation/ deactivation
  * [Rule Timer](https://docs.akenza.io/get-started/rule-engine)

### Improvements

* Refactoring of Rule Engine
* "Akenza" as the sender of SMS
* Allow GET method in REST API

## 2021-06-11 - V1.3.0

### New features

* Extended Device Type library with new Device Types
  * Aiut ALEVEL 1x5 V1
  * Aiut ALEVEL 1x5 V2
  * AstraLED Mantis CO2, VOC luminaire
  * Digital Matter Oyster
  * GlobalSat LS-113G
  * Talkpool OY1210

### Improvements

* Display account information on Integrations Overview Page
* Template improvement on Mail Output Connector
* Template improvement on Akenza DB Rule action
* API changes: deprecates hex\_payload for LoRa uplinks in device types, instead use hexPayload

## 2021-05-11 - V1.2.0

### New features

* Rule Engine
  * Send [SMS](https://docs.akenza.io/get-started/connectors/sms) as a Rule action
* Data processing
  * Logs for monitoring and debugging of akenza data processing
* Integration
  * [Actility](https://docs.akenza.io/get-started/your-integration/actility) as new integration provider
* Extended Device Type library with new Device Types
  * Talkpool OY1700
  * Universal Fire Extinguisher

### Improvements

* Various UI improvements

## 2021-04-16 - V1.1.0

### New features

* Data visualization
  * [Grafana plugin](https://docs.akenza.io/api-reference/advanced-topics/grafana-data-source-plugin) for simplified data visualization
* Rule Engine
  * Send [Downlink](https://docs.akenza.io/get-started/connectors/downlink) as a Rule action
* Extended Device Type library with new Device Types
  * Elsys ELT-2, ELT-Lite, EMS, EMS Desk, EMS Door, EMS Lite
  * Sensative All Strips
  * Synetica Enlink-T, Enlink-DP

### Improvements

* Various UI improvements
* Unified Mail output connector within Rule and Data Flow

## 2021-03-23 - V1.0.0

**The new akenza is released publicly as version 1.0.0** 🎉

This new product version named as **akenza**, replaces the existing [Akenza Core](https://core.akenza.io/), which will be kept running during customer project migration.

**Price- and feature plan** of the new akenza can be viewed [here](https://akenza.io/pricing).


# Applications

akenza consists of four interlinked applications, each covering a different part of an IoT project.

akenza is made up of four applications. They share the same devices, data, users, and permissions, so moving between them needs no export, no second login, and no duplicate configuration.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-microchip">:microchip:</i></td><td><strong>Device Management</strong></td><td>Where you manage your setup: connectivity, devices, data flows, business logic, and users.</td><td><a href="https://docs.akenza.io/device-management/create-new-device">Devices</a></td></tr><tr><td><i class="fa-chart-line">:chart-line:</i></td><td><strong>Dashboard Builder</strong></td><td>Where you visualize your data. Share dashboards with people who have no akenza account, and run signage screens in your offices.</td><td><a href="https://docs.akenza.io/dashboard-builder/dashboard-builder">Overview</a></td></tr><tr><td><i class="fa-comments">:comments:</i></td><td><strong>Genio</strong></td><td>Where you talk to your IoT setup through a chat interface, in beta.</td><td><a href="https://docs.akenza.io/genio/genio">Overview</a></td></tr><tr><td><i class="fa-qrcode">:qrcode:</i></td><td><strong>Device Setup Assistant</strong></td><td>A specialized app for deploying devices at scale, by scanning a QR code on site.</td><td><a href="https://docs.akenza.io/device-setup-assistant/device-setup-assistant">Overview</a></td></tr></tbody></table>

## Which application to use when

<table><thead><tr><th width="230">If you want to</th><th>Use</th></tr></thead><tbody><tr><td>Connect a device, decode its payload, or decide where its data goes</td><td>Device Management</td></tr><tr><td>Roll out many devices on site and configure them as you install them</td><td>Device Setup Assistant</td></tr><tr><td>Build a view of your data, or share one with someone outside akenza</td><td>Dashboard Builder</td></tr><tr><td>Get an answer without building a view for it first</td><td>Genio</td></tr></tbody></table>

## Application contexts

akenza has two working contexts, and which one you are in determines which applications are available:

* The [organization context](https://docs.akenza.io/general/organization-context) covers everything under your account, across all of its workspaces.
* The [workspace context](https://docs.akenza.io/general/workspace-context) covers a single workspace, typically one project or site.

Device Management and the Device Setup Assistant are available in both contexts. The Dashboard Builder and Genio are organization-level applications, so you open them from the organization context, and a dashboard can draw on devices from any workspace you have access to.

## Access and subscription

You may access all applications regardless of your subscription, but functionality is restricted to specific tiers.

Billing and subscription are handled at organization level, and workspaces inherit access to features from the organization they belong to. See [Billing & Subscription](https://docs.akenza.io/device-management/managing-an-organization/subscription) for the plan your organization is on, and [akenza.io/pricing](https://akenza.io/pricing) for what each tier includes.

{% hint style="info" %}
Some allowances are counted per application. Dashboards and signage screens, for example, have separate allowances in each plan. See [Dashboard Types](https://docs.akenza.io/dashboard-builder/dashboard-types).
{% endhint %}


# Tenants

A tenant is a deployment of akenza. It holds organizations, and offers integrations and device type libraries to all of them.

<div align="left"><figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-9638c740e06138104cdd9099d319d4156251e67d%2Fbadge-enterprise.png?alt=media" alt="" width="103"><figcaption></figcaption></figure></div>

A **tenant** is a deployment of akenza. Every instance of the platform is one tenant: the akenza public cloud is a single tenant shared by everyone who uses it, and every Enterprise deployment is a tenant of its own.

Every organization therefore belongs to exactly one tenant, which makes the tenant the outermost level of the hierarchy:

* **Tenant**
* [Organization](https://docs.akenza.io/general/organization-context)
* [Workspace](https://docs.akenza.io/general/workspace-context)

Running your own tenant is an akenza Enterprise arrangement. It gives you a deployment separate from the public cloud, and the deployment-wide settings described below. Configure your own Connectivity-as-a-Service integrations, connect your custom device type library, brand the whole deployment as your own, and plug in your own identity provider.

{% content-ref url="/pages/MBnzovez3BvULUelZVEB" %}
[Deployment](https://docs.akenza.io/general/tenants/deployment)
{% endcontent-ref %}

## Tenant roles

Two roles can be assigned at tenant level, and both span every organization on the tenant:

<table><thead><tr><th width="190">Role</th><th>Access</th></tr></thead><tbody><tr><td><strong>Tenant admin</strong></td><td>Read-only across all organizations, and may add themselves to any organization in order to work in it.</td></tr><tr><td><strong>Tenant viewer</strong></td><td>Read-only across all organizations.</td></tr></tbody></table>

{% hint style="info" %}
A tenant admin does **not** hold write access to organizations by default. Until they add themselves to an organization, their access is read-only, exactly like a tenant viewer. Adding themselves is the deliberate step that grants working access, and it puts them in that organization's user list like any other member.
{% endhint %}

Reaching every organization is what makes the role useful: a tenant administrator can track metrics across the whole deployment and provide support to any organization on it, without each one having to invite them first.

It also means the tenant level is not a silent master key. Someone with tenant admin rights can see the state of every organization, but has to join one before changing anything in it.

## Tenant integrations

A **tenant integration** is a [connectivity provider account](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan/your-integration) set up once at tenant level and made available to **all organizations and their workspaces** on the tenant. This is how [Connectivity-as-a-Service](https://akenza.io/features/connectivity-as-a-service) is offered: connectivity is arranged once for the deployment, and every user on it can onboard devices without a contract of their own with the network provider.

When a data flow is created in any workspace, a device connector belonging to a tenant integration can be chosen alongside the workspace's own integrations. Nobody has to set up their own account with the provider first.

This is the arrangement to reach for when the same network serves many customers. A network operator or reseller running their own tenant connects their LoRaWAN network once, and every customer organization on that tenant can onboard devices onto it.

Tenant integrations are managed under **Tenant Management Settings**.

{% hint style="warning" %}
Deleting a tenant integration removes it from every organization and workspace that was using it. Check what depends on it before removing one.
{% endhint %}

## Device type libraries

[Device type libraries](https://docs.akenza.io/device-management/your-data-flow/device-type/library) are also managed at tenant level, and likewise apply to all organizations and workspaces on the tenant.

The **akenza default** library is listed here and can be enabled or disabled. Beyond it, custom device type libraries can be added, which makes your own device types available across every organization on the tenant. *Sync all libraries* refreshes them, picking up device types added since the last sync.

This is the place to put decoders you maintain yourself and want available everywhere, rather than creating the same [custom device type](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type) separately in each organization.

## Tenant-wide white labeling

A tenant can be branded as a whole, so that the deployment presents itself as your product rather than akenza's. This covers the **theme** applied across the platform and the **email domain** that notifications and system mails are sent from, among other deployment-wide branding.

Combined with a [custom domain](https://docs.akenza.io/general/tenants/deployment#domains-and-certificates) for the deployment itself, the result carries your name from the address bar through to the mail that lands in someone's inbox.

{% hint style="info" %}
This is the deployment-wide layer of branding. An individual organization on the tenant can additionally brand itself with [white labeling](https://docs.akenza.io/device-management/managing-an-organization/general-settings/white-labeling), which is the right level when one reseller serves customers who each want their own look.
{% endhint %}

## Single sign-on

A custom **SSO integration** with your own identity provider is configured at tenant level and applies across the deployment. Users are routed to it automatically based on the domain of the email address they enter when signing in, so nobody has to know which provider to pick.

{% content-ref url="/pages/2jrXgXOtAj7QPMD4wIMc" %}
[Users](https://docs.akenza.io/general/users)
{% endcontent-ref %}

## What is managed at tenant level

<table><thead><tr><th width="230">Area</th><th>What it covers</th></tr></thead><tbody><tr><td><strong>Organizations</strong></td><td>Every organization on the tenant.</td></tr><tr><td><strong>Workspaces</strong></td><td>Every workspace, across all of those organizations.</td></tr><tr><td><strong>Devices</strong></td><td>Every device on the tenant.</td></tr><tr><td><strong>General settings</strong></td><td>Tenant integrations, device type libraries, white labeling, and single sign-on.</td></tr><tr><td><strong>Users</strong></td><td>Who holds the tenant admin and tenant viewer roles.</td></tr></tbody></table>

{% hint style="info" %}
Tenant administrators can also prevent tenant members from creating organizations of their own.
{% endhint %}


# Deployment

How an akenza Enterprise deployment is hosted: the deployment models, multi-region setups, and domains.

An akenza Enterprise deployment is a [tenant](https://docs.akenza.io/general/tenants) of its own. The platform runs either in an **akenza cloud subscription** or in a **customer cloud subscription**, using several infrastructure components to process and manage IoT data at scale.

## Cloud platforms

akenza deploys on any of the major cloud providers:

* **Amazon Web Services (AWS)**
* **Google Cloud Platform (GCP)**
* **Microsoft Azure**

{% hint style="info" %}
**On-premises** deployment is available **on request only**. If your requirements rule out public cloud, raise it early, because it shapes the rest of the arrangement.
{% endhint %}

Picking the provider you already use keeps the deployment inside the cloud governance, billing, and network your organization has established, which matters most in the customer subscription model below.

## Deployment models

Which model applies decides who holds the cloud subscription, who has access to the infrastructure, and where responsibility sits when something needs changing.

<table><thead><tr><th width="200">Model</th><th>Who operates it</th><th>Infrastructure access</th></tr></thead><tbody><tr><td><strong>Enterprise SaaS</strong></td><td>akenza operates the private cloud deployment in its own cloud subscription.</td><td>No infrastructure access for customers.</td></tr><tr><td><strong>Customer subscription</strong></td><td>akenza deploys and operates the private cloud deployment in the cloud subscription of the customer.</td><td>akenza has full access to deploy infrastructure components and applications.</td></tr><tr><td><strong>Shared responsibility</strong></td><td>A hybrid mode: the customer's DevOps team manages the infrastructure, and akenza manages the application deployed on top of it.</td><td>Split between both parties.</td></tr></tbody></table>

### Enterprise SaaS

The simplest of the three. akenza holds the subscription, runs the deployment, and customers work only with the platform itself. Choose it when a private deployment is wanted without taking on any infrastructure of your own.

### Customer subscription

The deployment lives in your own cloud subscription, so the infrastructure and the data on it sit within your organization's cloud governance, while akenza still deploys and operates it.

{% hint style="info" %}
akenza needs credentials with enough rights to deploy and maintain the infrastructure components and the application.
{% endhint %}

### Shared responsibility

Your DevOps team owns the infrastructure and akenza owns the application running on it. This suits organizations with an established cloud practice that expect to manage infrastructure themselves.

{% hint style="warning" %}
Because the responsibility boundary runs through the middle of the system, this model requires close collaboration and a **custom service level agreement with its own service level objectives**. Agree both before committing to it, since the standard terms do not describe this split.
{% endhint %}

## Multi-region setup

Latency between devices and the platform is a real constraint, so a deployment should be placed in the region it serves. Where worldwide coverage is needed, akenza is deployed once per geographical region, for example in EMEA, APAC, and the US.

{% hint style="warning" %}
Regional deployments are **not synchronized**. Each is a separate tenant, managed separately, with its own organizations, users, devices, and tenant-level configuration. Something set up in one region has to be set up again in the others.
{% endhint %}

Plan for this at the outset. Deciding which region a customer, site, or fleet belongs to is straightforward before onboarding and awkward afterwards, because moving devices between deployments means recreating them.

## Domains and certificates

A deployment is reached either under an akenza domain or under your own:

<table><thead><tr><th width="220">Option</th><th>What it requires</th></tr></thead><tbody><tr><td><strong>akenza domain</strong></td><td>Nothing. The deployment is hosted under <code>*.&#x3C;customer>.akenza.io</code>.</td></tr><tr><td><strong>Custom domain</strong></td><td>A <strong>wildcard certificate</strong> covering all akenza hostnames, and <strong>DNS records</strong> configured accordingly.</td></tr></tbody></table>

A custom domain is what makes a deployment feel like your own product rather than akenza's, and it pairs with [white labeling](https://docs.akenza.io/device-management/managing-an-organization/general-settings/white-labeling), which changes the name, colors, and logo inside the application.

{% hint style="info" %}
The certificate has to cover **every** akenza hostname on the deployment, not just the main one. Certificate renewal stays your responsibility for the life of the deployment, so it is worth putting the expiry in the same calendar as your other certificates.
{% endhint %}

## Getting a deployment

Deployment models, regions, and domains are agreed as part of an Enterprise arrangement. To discuss which model fits, get in touch through the [Service Desk](https://docs.akenza.io/faq/service-desk).


# Organization context

Where organizations sit in the akenza hierarchy, what belongs to one, and who can reach it.

Organizations are one level in the hierarchy of entities in the akenza ecosystem. Listed below is a hierarchically sorted list of entities:

* [Tenant](https://docs.akenza.io/general/tenants), the akenza deployment the organization runs on
* **Organization**
* [Workspace](https://docs.akenza.io/general/workspace-context)

An organization on akenza is an entity to control access rights to workspaces, assets and data. Each organization contains one or more workspaces as well as one or more users.

Organizations extend over all applications of akenza. Any given organization will extend over all applications its subscription allows access to.

Billing and subscription are managed at organization level. See our [Billing & Subscription](https://docs.akenza.io/device-management/managing-an-organization/subscription) page for details.

## What belongs to an organization

An organization is the level at which access, identity, and anything shared between projects is decided:

<table><thead><tr><th width="230">Object</th><th>Scope</th></tr></thead><tbody><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace">Workspaces</a></td><td>Every workspace is assigned to exactly one organization.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/create-new-device">Devices</a></td><td>Belong to a workspace, but can be listed and searched across the whole organization.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/custom-components">Custom components</a></td><td>Custom device types and logic blocks are defined once here and usable in any workspace.</td></tr><tr><td><a href="https://docs.akenza.io/dashboard-builder/dashboard-builder">Dashboards</a></td><td>Managed at organization level, so one dashboard can combine devices from several workspaces.</td></tr><tr><td><a href="https://docs.akenza.io/data-fusion-layer/data-fusion-layer">Data Fusion Layer</a></td><td>The semantic model of sites, floors, zones, and assets.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/api-keys">API keys</a></td><td>Issued per organization and scoped to it.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/audit-logs">Audit logs</a></td><td>A record of changes across the organization.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/organization-users">Users</a></td><td>Access is granted here or in an individual workspace.</td></tr></tbody></table>

The division is worth keeping in mind when deciding where to put something. Objects used in day-to-day operation of one project, such as devices, data flows, rules, integrations, tags, and custom fields, belong to a [workspace](https://docs.akenza.io/general/workspace-context). Anything shared between projects, or that concerns who may see them at all, belongs to the organization.

{% content-ref url="/pages/SwWd28hSdtf5reOYIkXR" %}
[Managing an organization](https://docs.akenza.io/device-management/managing-an-organization)
{% endcontent-ref %}

## Users in an organization

The following user roles exist in an organization:

* Organization owner
* Organization admin
* Organization editor
* Organization viewer
* Organization member

Refer to the [user roles page](https://docs.akenza.io/general/users/user-roles) for an overview of all user permissions for each role.

A user with access to at least one workspace in an organization will show up as organization member. A user with organization-specific rights higher than member has corresponding access rights to all workspaces of the organization, including workspaces created later. Access granted in a single workspace never extends upward to the organization.

{% hint style="info" %}
Only the **organization owner** can delete the organization or transfer ownership, and an organization has exactly one owner at a time.
{% endhint %}

## Organization settings

Each organization carries its own settings, including [white labeling](https://docs.akenza.io/device-management/managing-an-organization/general-settings/white-labeling), whether [Genio AI](https://docs.akenza.io/device-management/managing-an-organization/general-settings/genio-ai) is active, and its [subscription](https://docs.akenza.io/device-management/managing-an-organization/subscription). Because subscription is held here, workspaces inherit the features available to them from the organization they belong to.

{% content-ref url="/pages/eOXw478KABqwFuIjT9ms" %}
[General Settings](https://docs.akenza.io/device-management/managing-an-organization/general-settings)
{% endcontent-ref %}

## Usage examples

Organizations on akenza often reflect business organizations, companies or organization units.

Resellers of the akenza platform may choose to onboard their customers as organizations on their [tenant](https://docs.akenza.io/general/tenants), strictly isolating the devices and data of individual customers. Combined with [white labeling](https://docs.akenza.io/device-management/managing-an-organization/general-settings/white-labeling), each customer sees a platform carrying the reseller's branding rather than akenza's, and a [tenant integration](https://docs.akenza.io/general/tenants#tenant-integrations) lets them all onboard devices onto the reseller's own network.


# Workspace Context

Where workspaces sit in the akenza hierarchy, what belongs to one, and what stays separate between them.

Workspaces are one level in the hierarchy of entities in the akenza ecosystem. Listed below is a hierarchically sorted list of entities:

* [Tenant](https://docs.akenza.io/general/tenants), the akenza deployment the workspace runs on
* [Organization](https://docs.akenza.io/general/organization-context)
* **Workspace**

A workspace on akenza is an entity to control access rights to assets and data. Each workspace contains one or more users, and each workspace is assigned to exactly one organization.

Workspaces extend over all applications of akenza. Any given workspace will extend over all applications its corresponding organization's subscription allows access to.

Billing and subscription are handled at organization level. Workspaces inherit access to features from the organization they belong to. See our [Billing & Subscription](https://docs.akenza.io/device-management/managing-an-organization/subscription) page for details.

## What belongs to a workspace

A workspace is the boundary for the day-to-day objects of an IoT project:

<table><thead><tr><th width="220">Object</th><th>Scope</th></tr></thead><tbody><tr><td><a href="https://docs.akenza.io/device-management/create-new-device">Devices</a></td><td>Every device is assigned to exactly one workspace.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/your-data-flow">Data flows</a></td><td>Defined in a workspace and applied to the devices in it.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/rule-engine">Rules</a></td><td>Act on the data of devices in the same workspace.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/integrations">Integrations</a></td><td>A connectivity provider account is linked per workspace.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/custom-fields">Custom fields</a></td><td>Defined per workspace and available on its devices.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/tags">Tags</a></td><td>Defined per workspace, and unique within it.</td></tr></tbody></table>

Objects in one workspace are not visible from another, which is what makes a workspace a useful unit of separation. It is also why a tag only has to be unique within the workspace that owns it, and why moving work between workspaces means recreating rather than sharing.

{% hint style="info" %}
Dashboards are the exception. They are managed at organization level, so one dashboard can draw on devices from several workspaces, as long as you have access to them. See [Applications](https://docs.akenza.io/general/applications).
{% endhint %}

{% content-ref url="/pages/-MO5H-sO9l8N2tO7n0vw" %}
[Managing a workspace](https://docs.akenza.io/device-management/managing-a-workspace)
{% endcontent-ref %}

## Users in a workspace

Every user on akenza is a member of at least one workspace. The following roles exist:

* Workspace admin
* Workspace editor
* Workspace viewer

Access rights to a workspace do not extend to the parent organization. Organization roles, on the other hand, carry implicit workspace roles for all of that organization's workspaces. The rights of each role are described in detail on the [user roles page](https://docs.akenza.io/general/users/user-roles).

## Workspace settings

Each workspace carries its own settings, including its time zone, data retention, occupancy working hours, and device lifecycle reports. The time zone in particular is worth setting deliberately, because dashboards group data by the workspace time zone rather than by the viewer's.

{% content-ref url="/pages/f97Pg2tTISBVxUzJX1cR" %}
[General Settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings)
{% endcontent-ref %}

## Usage example

Workspaces on akenza may represent a number of real world entities, including but not limited to the following:

* Organization units
* Buildings
* Factories
* Vehicles
* Locations
* Fleet of sensor devices
* Individual use cases

Organizations on akenza may decide to use workspaces to give access to devices and data to a subset of their organization members. You may assign devices and users to workspaces that represent your specific business needs.


# Users

How a user can belong to several organizations and workspaces, holding a different role in each.

A **user** on akenza represents a person. The same user may be part of one or more [organizations](https://docs.akenza.io/general/organization-context), as well as one or more [workspaces](https://docs.akenza.io/general/workspace-context) inside each organization, and may hold a different role in every one of them. Rights are therefore never a property of the person, but of the person in a particular place. Each user belongs to exactly one [tenant](https://docs.akenza.io/general/tenants), the akenza deployment they sign in to.

## Registration

A new account is created at [app.akenza.io](https://app.akenza.io) with *Register now* on the login screen. Registration also asks you to create an organization and a workspace, so that the account has somewhere to work:

{% content-ref url="/pages/-MUICYzPAplD8-W7nHt7" %}
[Getting Started](https://docs.akenza.io/how-to-create-a-working-environment)
{% endcontent-ref %}

Most people never go through this. If you are joining an existing setup, an administrator adds your email address to their [organization](https://docs.akenza.io/device-management/managing-an-organization/organization-users) or [workspace](https://docs.akenza.io/device-management/managing-a-workspace/workspace-users) instead, and you arrive with access already granted rather than creating an organization of your own.

## Signing in

Signing in starts with your email address, after which you continue in one of two ways:

* With the **password** set on your akenza account.
* With a **linked identity provider**, so that an account you already have signs you in. Google, Microsoft, and GitHub are supported.

{% hint style="info" %}
On the **Expert and Enterprise** tiers, a custom **SSO integration** with your own identity provider is supported. It is discovered automatically from the domain of the email address you enter, so users at that domain are sent to your identity provider without having to pick anything.
{% endhint %}

## Two-factor authentication

An account can be secured with **two-factor authentication** using a one-time password (OTP) from an authenticator app. After entering your password you are asked for the current code from that app, so a leaked password is not enough to reach your data on its own.

Set it up under **User settings** in your user profile with *Add 2FA application*, then scan the code with your authenticator. More than one authenticator can be registered.

{% hint style="warning" %}
Two-factor authentication is strongly recommended for any real deployment, and especially for accounts holding the **organization owner** or **admin** role, since those can change who else has access.
{% endhint %}

## Your user profile

Your profile is reached from the navigation and has two sections:

* **User settings** holds your account itself: personal information (first and last name, email address, country, and an optional phone number), whether you receive product update and marketing mails, your password, linked identity provider accounts, two-factor authentication, your signed-in devices, and account deletion.
* **Access** shows which organizations and workspaces you have access to, and the role you hold in each.

**Signed in devices** lists your active sessions with the device type, IP address, when the session was last used, and when it expires. Any session other than the current one can be signed out from here, which is the thing to reach for if you have used a shared or lost machine.

{% hint style="danger" %}
An account can only be deleted if it does not own an organization. Transfer ownership to another member in the [organization settings](https://docs.akenza.io/device-management/managing-an-organization/general-settings) first, then delete the account.
{% endhint %}

## Where access is granted

Access is granted at one of two levels, and the choice decides how far it reaches:

<table><thead><tr><th width="180">Granted at</th><th>Reaches</th><th>Use it for</th></tr></thead><tbody><tr><td><strong>Organization</strong></td><td>The organization and <strong>every</strong> workspace in it, including workspaces created later.</td><td>People who work across the whole account.</td></tr><tr><td><strong>Workspace</strong></td><td>That workspace alone.</td><td>A customer, contractor, or team that should see one project or site only.</td></tr></tbody></table>

The relationship runs in one direction. An organization role above member carries an implicit role in every workspace of that organization. A workspace role never extends up to the organization, nor across to its other workspaces.

{% hint style="info" %}
A user who has access to at least one workspace appears in the organization's user list as **organization member**. That role records their presence without granting anything organization-wide, so seeing someone listed there does not mean they were given organization access.
{% endhint %}

Because organization roles cover workspaces that do not exist yet, granting one is the larger of the two decisions. When in doubt, grant at workspace level and add more later.

## Roles

An organization has five roles (**owner**, **admin**, **editor**, **viewer**, and **member**) and a workspace has three (**admin**, **editor**, and **viewer**). Broadly, admins manage, editors change things, and viewers read.

Above them, a [tenant](https://docs.akenza.io/general/tenants) has two roles of its own, **tenant admin** and **tenant viewer**, which span every organization on the deployment.

For exactly what each role may do, down to the individual action, see the permission matrix:

{% content-ref url="/pages/-MVvnykxZJF8KQPqkfwZ" %}
[User Roles](https://docs.akenza.io/general/users/user-roles)
{% endcontent-ref %}

## Managing users

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-building">:building:</i></td><td><strong>Organization Users</strong></td><td>Add and remove users at organization level, and assign organization roles.</td><td><a href="https://docs.akenza.io/device-management/managing-an-organization/organization-users">Organization Users</a></td></tr><tr><td><i class="fa-layer-group">:layer-group:</i></td><td><strong>Workspace Users</strong></td><td>Grant access to a single workspace and assign workspace roles.</td><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/workspace-users">Workspace Users</a></td></tr></tbody></table>

<details>

<summary>Adding users with the API</summary>

Users can also be added through the [REST API](https://docs.akenza.io/reference/api-documentation), for example to onboard many people at once. Authenticate with an [API key](https://docs.akenza.io/device-management/managing-an-organization/api-keys) in the `x-api-key` header, or with a bearer token in the `Authorization` header. The caller needs the right to add users at the level it assigns the role, as listed in the [permission matrix](https://docs.akenza.io/general/users/user-roles).

Adding a user is two calls: look up the ID of the role to grant, then assign it to one or more email addresses.

**1. Look up the role ID**

List the organization roles:

```bash
curl --url 'https://api.akenza.io/v3/organization-roles?organizationId=<orgId>' \
  -H 'x-api-key: <apiKey>' \
  -H 'accept: application/json'
```

Or the roles of a workspace:

```bash
curl --url 'https://api.akenza.io/v3/workspace-roles?organizationId=<orgId>&workspaceId=<wsId>' \
  -H 'x-api-key: <apiKey>' \
  -H 'accept: application/json'
```

The response is a page of roles. Each carries its `id`, `name`, `description`, and the `permissions` it grants per resource:

```json
{
  "content": [
    {
      "id": "6000000000000003",
      "name": "Organization-Admin",
      "description": "Organization Admins can manage and edit the Organization and have full access on its Workspaces.",
      "permissions": {
        "asset": ["*"],
        "organization": ["read", "update", "manage"],
        "organization.member": ["*"],
        "workspace": ["*"],
        "workspace.member": ["*"]
      }
    }
  ],
  "totalElements": 3
}
```

**2. Assign the role**

At organization level:

```bash
curl --url 'https://api.akenza.io/v3/organization-roles/assign?organizationId=<orgId>' \
  -H 'x-api-key: <apiKey>' \
  -H 'content-type: application/json' \
  --data-raw '{"members":[{"email":"<userEmail>","roleId":"<roleId>"}],"sendNotifications":true}'
```

At workspace level:

```bash
curl --url 'https://api.akenza.io/v3/workspace-roles/assign?organizationId=<orgId>&workspaceId=<wsId>' \
  -H 'x-api-key: <apiKey>' \
  -H 'content-type: application/json' \
  --data-raw '{"members":[{"email":"<userEmail>","roleId":"<roleId>"}],"sendNotifications":true}'
```

`members` takes several entries, so one call can add a whole team, each with its own role. With `sendNotifications` set to `true`, every user added receives an email about their new access. A successful call answers with a confirmation such as `{"message":"Organization roles successfully assigned"}`.

</details>

## Usage example

Generally, users are intended to represent people within your own organization or your customers' organizations.

A facility manager who only ever looks at one building belongs in that building's workspace. A platform administrator who maintains device types and dashboards for every site belongs at organization level, because that work spans all of them.


# User Roles

A matrix of every akenza user role and the actions it permits, at both organization and workspace level.

The matrix below lists every action in akenza against every role that can perform it. Actions are grouped by the area they apply to (organization, workspace, asset inventory, device types, data flows, integrations), and the columns are split into the five **organization** roles and the three **workspace** roles.

Read a row to find who may do something, or a column to find what a role can do. A user's effective rights are the combination of both: their organization role, if any, plus their role in the workspace they are working in. See [Users](https://docs.akenza.io/general/users) for how the two levels relate.

Some rows worth knowing before you grant a role:

<table><thead><tr><th width="250">Action</th><th>Who can do it</th></tr></thead><tbody><tr><td>Add, remove, or change users</td><td>Organization owner and admin. At workspace level, also the workspace admin. Editors cannot.</td></tr><tr><td>Delete an organization</td><td>The organization owner alone.</td></tr><tr><td>Manage billing</td><td>Organization owner and admin.</td></tr><tr><td>Create a workspace</td><td>Every organization role except member, viewers included.</td></tr><tr><td>Delete a workspace</td><td>Organization owner, admin, and editor, plus the workspace admin.</td></tr></tbody></table>

<table data-header-hidden data-full-width="true"><thead><tr><th>Scope</th><th>Action</th><th align="center">Organization</th><th align="center"></th><th align="center"></th><th align="center"></th><th align="center"></th><th align="center">Workspace</th><th></th><th></th></tr></thead><tbody><tr><td><strong>Scope</strong></td><td><strong>Action</strong></td><td align="center"><strong>Organization</strong></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"><strong>Workspace</strong></td><td></td><td></td></tr><tr><td></td><td></td><td align="center"><strong>Owner</strong></td><td align="center"><strong>Admin</strong></td><td align="center"><strong>Editor</strong></td><td align="center"><strong>Viewer</strong></td><td align="center"><strong>Member</strong></td><td align="center"><strong>Admin</strong></td><td><strong>Editor</strong></td><td><strong>Viewer</strong></td></tr><tr><td><strong>Organization</strong></td><td></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Overview</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Edit</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Billing</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Delete</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Add user</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Edit user role</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Remove user</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Create workspace</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>View workspace list</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Edit Settings</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>View Asset list</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Edit Asset</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Delete Asset</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td><strong>Workspace</strong></td><td></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Overview</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>✅</td></tr><tr><td></td><td>Edit</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>Delete</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>❌</td><td>❌</td></tr><tr><td></td><td>Add user</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>❌</td><td>❌</td></tr><tr><td></td><td>Edit user role</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>❌</td><td>❌</td></tr><tr><td></td><td>Remove user</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>❌</td><td>❌</td></tr><tr><td></td><td>Edit settings</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>View Asset list</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>✅</td></tr><tr><td><strong>Asset Inventory</strong></td><td></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>View</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>✅</td></tr><tr><td></td><td>Create</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>Edit</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>Delete</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td><strong>Device Type</strong></td><td></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>View</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Create</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Edit</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>Delete</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center"></td><td></td><td></td></tr><tr><td><strong>Dataflow</strong></td><td></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>View</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>✅</td></tr><tr><td></td><td>Create</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>Edit</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>Delete</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td><strong>Integrations</strong></td><td></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td></td><td></td></tr><tr><td></td><td>View</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>✅</td></tr><tr><td></td><td>Create</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>Edit</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr><tr><td></td><td>Delete</td><td align="center">✅</td><td align="center">✅</td><td align="center">✅</td><td align="center">❌</td><td align="center">❌</td><td align="center">✅</td><td>✅</td><td>❌</td></tr></tbody></table>


# Occupancy monitoring

Highlights occupancy use cases for end-users and describes how to implement them with akenza.

Occupancy monitoring allows to improve space utilization; allowing saving on real-easte, utilities and cleaning costs as well as enhancing your workplace experience. Yet managing and interpreting occupancy data generated by many sensors is challenging. Akenza offers advanced analytics capabilities to gain insights into your occupancy patterns.

## Example with concurrent desks occupancy

Let's assume we equipped 4 desks with occupancy sensors and we track their state over four hours. Green means the desk is empty, yellow means it was occupied at one point during the hour. Recording the state of a desk every hour, we can represent the time-series of each desk as follows:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-bfba0e8daea54736b4bb3c4aae18356e2a57b9fc%2Foccupancy-concurrent-desks-example.png?alt=media" alt=""><figcaption></figcaption></figure>

On the bottom two lines, we can read that at 12:00 PM only 1 desk was free, at 1:00 PM all were occupied and at 2:00 PM all were free.

## Problem definition and concepts

Based on the example above we define 5 key metrics for tracking occupancy:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-7c9fa30fea70a4b17059a6e3c0c0b51a66671c61%2Foccupancy-key-metrics.png?alt=media" alt=""><figcaption></figcaption></figure>

* <mark style="color:$danger;">OCCUPANCY\_ABSOLUTE</mark>
  * absolute count of **occupied** desks
* <mark style="color:$primary;">AVAILABILITY\_ABSOLUTE</mark>
  * absolute count of **free** desks
* **CAPACITY**
  * total number of desks, whose occupancy is tracked/which can be used
  * \= OCCUPANCY\_ABSOLUTE + AVAILABILITY\_ABSOLUTE
* <mark style="color:$danger;">OCCUPANCY\_RELATIVE</mark>
  * relative share (%) of **occupied** desks
  * \= OCCUPANCY\_ABSOLUTE */* CAPACITY
* <mark style="color:$primary;">AVAILABILITY\_RELATIVE</mark>
  * relative share (%) of **free** desks
  * \= AVAILABILITY\_ABSOLUTE / CAPACITY

## Business use cases

### "Capacity crunch": Identify periods when no desks are available

> As a property manager, I want to avoid the situation where all desks are occupied and employees cannot find a desk to work.

In the example chart below, we plot an example of occupancy over a working day. At 10:00 AM, we see that the occupancy reaches 100%, corresponding to a "capacity crunch". Employees arriving at 10:00 AM will be unable to find a free desk.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-acea1c18db498e4ec112687a69d740a739b2bb21%2Foccupancy-capacity-crunch-chart.png?alt=media" alt=""><figcaption></figcaption></figure>

The "capacity crunch" is identified when relative occupancy reaches a maximum over the day. This is the default time aggregation behaviour (MAX over time) of the "concurrent occupancy" aggregation, selectable in datasource section of dashboards:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-66d9d163a7d243da4868d4edc627031a910d3edd%2Foccupancy-capacity-crunch-dashboard.png?alt=media" alt=""><figcaption></figcaption></figure>

Additionally, you can also compute the availability (complementary of occupancy) and the capacity. The following screenshot showcases all those capabilities:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-eae901d0c2a8ce87171e247d96ee7b099dff4d79%2Foccupancy-availability-capacity.png?alt=media" alt=""><figcaption></figcaption></figure>

### "Unused capacity": Identify periods when desks are over-provisioned

> As a property manager, I want to avoid the situation where some desks are never used and real estate usage is not optimized.

In the example chart below, we look at the usage of four desks over a day. Green denotes that the desk is free and yellow it's occupied. We observe that desk C is never occupied and therefore in this example, `unused capacity` would be 1.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2ad28afab03059803845dde379a0f28db785f8a6%2Foccupancy-unused-capacity-chart.png?alt=media" alt="Usage of four desks between 8:00 and 17:00. Desk C stays free all day and is highlighted as unused capacity."><figcaption></figcaption></figure>

The absolute unused capacity is computed by counting the desks free during an entire day. The relative unused capacity is computed by dividing absolute unused capacity by total desk capacity. This can be accessed in datasource section of dashboards:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-8bf6ebb6d26fba91ae32f72b892c6d2c266c4c17%2Foccupancy-unused-capacity-dashboard.png?alt=media" alt="Dashboard aggregation selector with Occupancy, Unused capacity, Absolute selected."><figcaption></figcaption></figure>

## What is the difference with existing occupancy calculation (time-based occupancy in %)?

Additionally to the concurrent occupancy described above, you can also compute a so-called "Time-based occupancy in %" (the underlying algorithm is described there [Querying aggregations](https://docs.akenza.io/reference/api-documentation/querying-device-data/querying-aggregations#time-based-occupancy)).

It can be selected below in the selector of datasource in dashboards:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-b93be3dfd587e1b4002353df4f147016e88d93d0%2Foccupancy-datasource-selector.png?alt=media" alt=""><figcaption></figcaption></figure>

This time-based occupancy averages occupancy first over time and **then** over desks. It means that it doesn't take into account **whether two desks are occupied at the same time (concurrently)** to compute the occupancy, it only averages the occupancy in % over time and then over desks. Hence the time-based occupancy can only output relative values (%), whereas the concurrent occupancy can either output an absolute number of desks or a relative ones.

{% hint style="info" %}
Both metrics (concurrent occupancy and time-based occupancy) can be useful to analyse and optimize occupancy within a managed building.
{% endhint %}

Let's take two examples to **better understand the differences:**

* Example 1

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-b432b57ba5c4158b87614279a3230e66cb1a5b73%2Foccupancy-calculation-example-1.png?alt=media" alt=""><figcaption></figcaption></figure>

Here we have two desks which are mostly occupied during the day, with some breaks (meeting, lunch break), optimizing it further looks difficult as it is quite packed. The time-based occupancy would report around 77.5% whereas the concurrent occupancy would report 100%. **In this case, the concurrent occupancy seems to be the "relevant" metric.**

* Example 2

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-4f8c12e3ecc9aa257c02b344518fba0a7e9d2a74%2Foccupancy-calculation-example-2.png?alt=media" alt=""><figcaption></figcaption></figure>

Here we have 2 desks, but one is not used at all during the morning, only in the afternoon. The time-based occupancy reports 60% (averaged over time), whereas concurrent occupancy still reports 100% (because it's maximized over the day). Here we see that there *might be* some optimization potential (e.g. by shifting office policies or using another desk in another floor). **In this case, it was useful to also look at the time-based occupancy in %.**

Hence the time-based occupancy in % can be seen as a "theoratical occupancy". It is always below or equal to the concurrent occupancy.

* time-based occupancy in % can almost never reach 100% (because of breaks, short interruptions), whereas concurrent occupancy can reach it
* if concurrent occupancy reaches 100% but time-based occupancy does not, then there *might be* some optimization potential (by shifting office policies, using another desk in another floor...)
* the "effective occupancy" - which directly reflects the daily workplace experience - is somewhere between time-based occupancy (lower bound) and concurrent occupancy (upper bound)

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-852af6a176426abe618bf268187bfbd5c5b5728f%2Foccupancy-effective-vs-time-based.png?alt=media" alt=""><figcaption></figcaption></figure>

## TL;DR: which occupancy calculation should I use?

{% hint style="info" %}
As a starter, we recommend using the concurrent occupancy logic. When doing in-depth analysis, looking at both metrics is recommended.
{% endhint %}

| Capabilities of each method                                   | Concurrent occupancy | Time-based occupancy |
| ------------------------------------------------------------- | :------------------: | :------------------: |
| Provide absolute figures (e.g. "5 desks are occupied")        | :white\_check\_mark: |           ❌          |
| Provide relative figures (e.g. 70% of the desks are occupied) | :white\_check\_mark: | :white\_check\_mark: |
| Provide availability and total capacity                       | :white\_check\_mark: |           ❌          |
| Identify capacity crunch                                      | :white\_check\_mark: |           ❌          |
| Identify margin for possible "optimizable" space              |           ❌          | :white\_check\_mark: |

## Limitations

* occupancy data (both concurrent and time-based) are available only at hourly (or higher: daily, weekly ...etc) resolution


# Managing an organization

Create an organization, manage its users and roles, and configure the settings that apply across all of its workspaces.

**Organizations** are shared accounts where businesses and projects can collaborate across many workspaces at once. Every setup of a device, every uplink received, and every user added to a workspace is linked to an organization.

{% hint style="info" %}
For how organizations sit between tenants and workspaces, see [Organization context](https://docs.akenza.io/general/organization-context). For the level below, see [Managing a workspace](https://docs.akenza.io/device-management/managing-a-workspace).
{% endhint %}

## The organization home

The **organization home** summarizes everything underneath the organization:

* **Workspaces**, how many there are and their combined [health score](https://docs.akenza.io/device-management/managing-a-workspace/health-score).
* **Devices**, the total across all workspaces and how it is trending.
* **Device health**, a breakdown by online status, battery level, and signal quality.
* **About this organization**, its description, owner, organization ID, and when it was created and last edited.

Below that are shortcuts into the [Dashboard Builder](https://docs.akenza.io/dashboard-builder/dashboard-builder), the [Device Setup Assistant](https://docs.akenza.io/device-setup-assistant/device-setup-assistant), and [Genio](https://docs.akenza.io/genio/genio), followed by your workspaces and dashboards, each of which can be searched, sorted, and opened directly.

## What belongs to an organization

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-layer-group">:layer-group:</i></td><td><strong>Workspaces</strong></td><td>The projects or sites in this organization, each holding its own devices, data flows, and rules.</td><td><a href="https://docs.akenza.io/device-management/managing-a-workspace">Managing a workspace</a></td></tr><tr><td><i class="fa-microchip">:microchip:</i></td><td><strong>Devices</strong></td><td>Every device across all workspaces, in one list.</td><td><a href="https://docs.akenza.io/device-management/create-new-device">Devices</a></td></tr><tr><td><i class="fa-cube">:cube:</i></td><td><strong>Data Fusion Layer</strong></td><td>The semantic model of your sites, floors, zones, and assets.</td><td><a href="https://docs.akenza.io/data-fusion-layer/data-fusion-layer">Overview</a></td></tr><tr><td><i class="fa-code">:code:</i></td><td><strong>Custom components</strong></td><td>Logic blocks and device types you write once and reuse in any workspace.</td><td><a href="https://docs.akenza.io/device-management/custom-components">Custom Components</a></td></tr><tr><td><i class="fa-key">:key:</i></td><td><strong>API keys</strong></td><td>Credentials for reaching akenza from your own applications.</td><td><a href="https://docs.akenza.io/device-management/managing-an-organization/api-keys">API keys</a></td></tr><tr><td><i class="fa-users">:users:</i></td><td><strong>Users</strong></td><td>Who has access, and the role they hold across the organization's workspaces.</td><td><a href="https://docs.akenza.io/device-management/managing-an-organization/organization-users">Organization Users</a></td></tr></tbody></table>

Custom components are the reason this level matters in day-to-day work: a [custom device type](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type) or [logic block](https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic) belongs to the organization, so it can be written once and applied to devices in any of its workspaces.

## Create an organization

During the signup process, you are asked to add an **organization** and a **workspace**. An organization name is typically the company name. Optionally a description and a logo can be added for recognizability.

An organization can also be added later. Select *Switch Organization* at the top of the sidebar, then *New Organization*.

![Create organization](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-093d4f8ac6a82d1e5dab2d6d78813cf0a7c41fce%2Fcreate-organization.png?alt=media)

{% hint style="info" %}
Every organization belongs to a [tenant](https://docs.akenza.io/general/tenants), the akenza deployment it runs on. Tenant administrators can prevent tenant members from creating organizations of their own.
{% endhint %}

## Users and roles

An organization has the roles **owner**, **admin**, **editor**, **viewer**, and **member**. Adding users requires the **organization owner** or **admin** role, and the users tab lists everyone with the role they hold, regardless of which workspaces they were added to.

Organization roles above member carry implicit access to every workspace in the organization, which is what makes them worth granting carefully.

Only the **organization owner** can delete the organization or transfer ownership to another member.

{% content-ref url="/pages/kIVoTDaFnfHZvMBE08Hj" %}
[Organization Users](https://docs.akenza.io/device-management/managing-an-organization/organization-users)
{% endcontent-ref %}

## Settings

All organization-specific settings are managed from the organization settings group in the second-level navigation. Whether they are accessible to you depends on your user role.

<table><thead><tr><th width="250">Page</th><th>What it covers</th></tr></thead><tbody><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/general-settings">General Settings</a></td><td>Name, description, owner, white labeling, Genio AI, organization properties, and deletion.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/subscription">Billing &#x26; Subscription</a></td><td>The plan the organization is on and what it includes.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/api-keys">API keys</a></td><td>Credentials for the REST and WebSocket APIs.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/audit-logs">Audit Logs</a></td><td>A record of what changed in the organization, and who changed it.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/organization-users">Users</a></td><td>Adding and removing users, and assigning roles.</td></tr></tbody></table>


# General Settings

Settings that apply to a whole organization.

The **General** page of an organization holds the settings that apply to the organization and, through it, to all of its workspaces.

Modifying the settings requires at least the **organization admin** role. Select *Save* to apply a change.

## Organization basics

<table><thead><tr><th width="220">Setting</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>The organization name, shown in the breadcrumb and in the organization switcher. Typically your company name.</td></tr><tr><td><strong>Description</strong></td><td>Optional free text, up to 500 characters. It appears under <em>About this Organization</em> on the organization home.</td></tr><tr><td><strong>Organization owner</strong></td><td>The single user who owns the organization. Only one user can hold this role, and only the owner can delete the organization or hand ownership to someone else.</td></tr></tbody></table>

{% hint style="warning" %}
Changing the **organization owner** transfers that role away from you immediately. Make sure the person taking it over is the right one, because only the new owner can transfer it back.
{% endhint %}

## Sections

<table><thead><tr><th width="250">Section</th><th>What it controls</th></tr></thead><tbody><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/general-settings/white-labeling">White label settings</a></td><td>Present akenza under your own name, colors, and logo.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/general-settings/genio-ai">Genio AI</a></td><td>Whether the AI assistant is available in this organization.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/general-settings/organization-properties">Organization properties</a></td><td>A free-form JSON object of extra metadata, readable through the REST API.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-an-organization/general-settings/actions">Actions</a></td><td>Deleting the organization.</td></tr></tbody></table>

{% hint style="info" %}
[Billing & Subscription](https://docs.akenza.io/device-management/managing-an-organization/subscription), [API keys](https://docs.akenza.io/device-management/managing-an-organization/api-keys), [Audit Logs](https://docs.akenza.io/device-management/managing-an-organization/audit-logs), and [Users](https://docs.akenza.io/device-management/managing-an-organization/organization-users) are also organization-wide, but have their own pages in the settings group rather than living under General.
{% endhint %}


# White Labeling

Present akenza under your own name, colors, and logo.

**White labeling** replaces akenza's own branding with yours, so that the people using the platform, and the notifications it sends them, carry your name rather than akenza's. It applies to the whole organization and everything underneath it.

This matters most when the people using akenza are not your colleagues. A facility manager at a customer site, or a tenant opening a shared dashboard, sees your product rather than a platform they have no relationship with.

{% hint style="info" %}
White labeling is available on **Expert plans**. See [akenza.io/pricing](https://akenza.io/pricing) for what each tier includes.
{% endhint %}

## Turning it on

Open **White label settings** on the [General settings](https://docs.akenza.io/device-management/managing-an-organization/general-settings) page and enable **White label your Organization**. The settings below become available, and *Save* applies them.

## What you can change

<table><thead><tr><th width="230">Setting</th><th>What it affects</th></tr></thead><tbody><tr><td><strong>Application name</strong></td><td>The product name shown throughout the application in place of "akenza".</td></tr><tr><td><strong>SMS sender name</strong></td><td>The sender that recipients see on <a href="https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/sms">SMS notifications</a>.</td></tr><tr><td><strong>Primary color</strong></td><td>The main accent color of the interface, given as a hex value such as <code>#1890ff</code>.</td></tr><tr><td><strong>Success, warning, and error colors</strong></td><td>The status colors used for positive, cautionary, and error states.</td></tr><tr><td><strong>Application logo</strong></td><td>Either an uploaded <strong>image</strong> or a <strong>monogram</strong> generated from your application name.</td></tr><tr><td><strong>Wide logo</strong></td><td>An optional second logo for the places where a wide mark fits better than a compact one.</td></tr></tbody></table>

### Logos

Choose **Image** if you have a compact company logo, or **Monogram** to derive a mark from the application name instead. Once an image is uploaded you can replace or delete it. Enabling **Upload additional wide logo** lets you supply a wide variant alongside the compact one.

{% hint style="warning" %}
Pick status colors that stay distinguishable from one another. Success, warning, and error carry meaning across dashboards and device states, so a palette where they read as similar shades makes the interface harder to scan, however well it matches your brand.
{% endhint %}

## Where it shows

White labeling reaches the application interface, the logos and colors in it, notifications your rules send, and dashboards shared through a [public link](https://docs.akenza.io/dashboard-builder/managing-dashboards/public-links), including [signage screens](https://docs.akenza.io/dashboard-builder/signage-screens) and [embedded dashboards](https://docs.akenza.io/dashboard-builder/embedding-dashboards).


# Genio AI

Turn the Genio AI assistant on or off for an organization.

This setting controls whether [Genio](https://docs.akenza.io/genio/genio), the AI assistant built into akenza, is available in this organization.

Genio brings AI-powered insights and recommendations directly into the platform: answering questions about your device data in plain language, assembling reports, and helping interpret the health of a deployment from the organization and workspace home.

## Activating Genio

Open **Genio AI** on the [General settings](https://docs.akenza.io/device-management/managing-an-organization/general-settings) page, select **Activate Genio AI**, and save. The setting applies to the whole organization.

To provide these capabilities, akenza processes relevant data using AI services.

{% hint style="info" %}
**Your data is handled securely and is never used for AI model training.** See [Genio](https://docs.akenza.io/genio/genio) for how it reaches your data and which model serves it.
{% endhint %}

Leaving the setting off means no data from this organization is sent to those services, which is the option to choose if your own policies do not permit it.

{% content-ref url="/pages/Zo11Hy8psJMCyKfAEND0" %}
[Overview](https://docs.akenza.io/genio/genio)
{% endcontent-ref %}


# Organization Properties

Attach your own metadata to an organization as a JSON object, readable through the REST API.

**Organization properties** hold additional metadata about an organization as a free-form **JSON object**. The object is available through the [REST API](https://docs.akenza.io/reference/api-documentation), which makes it a useful place to keep information your own applications and integrations need to read alongside the organization.

Typical uses are recording identifiers from another system, such as a customer number in your ERP, or storing configuration that an integration of yours reads at runtime.

## Editing the object

Open **Organization properties** on the [General settings](https://docs.akenza.io/device-management/managing-an-organization/general-settings) page, edit the JSON in the editor, and select *Save*. The content must be a single valid JSON object, and an organization with nothing set shows an empty one:

```json
{}
```

{% hint style="warning" %}
The editor replaces the whole object, so an application writing here through the API and a person editing in the UI can overwrite each other. Read the current value before writing a new one, and keep keys that belong to other consumers intact.
{% endhint %}

{% hint style="info" %}
Organization properties describe the **organization**. For metadata on a single project or site, use [workspace properties](https://docs.akenza.io/device-management/managing-a-workspace/general-settings/workspace-properties); for metadata on individual devices, use [custom fields](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields).
{% endhint %}


# Actions

Delete an organization.

The **Actions** section at the bottom of the [General settings](https://docs.akenza.io/device-management/managing-an-organization/general-settings) page holds the destructive operations for an organization.

## Delete organization

*Delete Organization* removes the organization.

{% hint style="danger" %}
Deleting an organization cannot be undone. It takes every workspace in the organization with it, and with them the devices, device data, integrations, data flows, and rules those workspaces hold, along with the organization's dashboards, custom device types, and logic blocks.

Before deleting, make sure anything you still need has been sent somewhere outside akenza, by exporting device data via the UI or reading it out through the [REST API](https://docs.akenza.io/reference/api-documentation).
{% endhint %}

Only the **organization owner** can delete an organization. If you want to hand it over rather than delete it, change the [organization owner](https://docs.akenza.io/device-management/managing-an-organization/general-settings) instead.

{% hint style="info" %}
Deleting an organization does not by itself settle what you owe. Check [Billing & Subscription](https://docs.akenza.io/device-management/managing-an-organization/subscription) for how the subscription is ended.
{% endhint %}


# Billing & Subscription

{% hint style="info" %}
Work in progress
{% endhint %}


# API keys

Issue credentials for the akenza APIs, restrict them to specific workspaces, and grant only the permissions they need.

An **API key** is a static secret that lets an application reach akenza without a user account. It is sent in the `x-api-key` header on every request, and the [REST API](https://docs.akenza.io/reference/api-documentation), the [WebSocket API](https://docs.akenza.io/reference/websocket-api), and integrations such as the [Grafana data source](https://docs.akenza.io/tutorials/bi-tools/grafana-data-source-plugin) all authenticate this way.

Keys belong to the organization and are managed under **Settings > API Keys**.

{% hint style="info" %}
API keys are one of two credential types. [OAuth2 clients](#oauth2-clients) are the other, and they carry the same scope and permission model.
{% endhint %}

## Who can manage API keys

Only the **organization owner** and **organization admins** can create and view API keys. For everyone else the API credential management is not available at all, which means a key never exposes more than the people who could already administer the organization.

## Creating an API key

{% stepper %}
{% step %}

### Open the creation form

Select *Create API Key* on the API Keys page.
{% endstep %}

{% step %}

### Name it

Give the key a **name** and, optionally, a **description**. Name it after the system that will use it, for example `Grafana` or `Data Consumer`, and use the description to record what it is for. Both are shown in the list, and they are the only way to tell later which key belongs to which integration.
{% endstep %}

{% step %}

### Choose the scope

By default a key reaches **every workspace** in the organization, including workspaces created later. Enable *Restrict permissions to specific Workspaces* and select the workspaces it may reach to narrow that down.
{% endstep %}

{% step %}

### Select the permissions

Under **Permissions**, expand a group and tick the individual verbs it may use. *All permissions* selects everything at once, which is worth avoiding for anything but a throwaway key.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-57fced0271cb4f058ecb30013e8c60091a42512a%2Fapi-key-permissions.png?alt=media" alt="The Create new API Key form, with permission groups expanded into their individual verbs"><figcaption><p>Each permission group expands into the verbs the key may use</p></figcaption></figure>
{% endstep %}

{% step %}

### Create and store the secret

Select *Create API key*. Copy the generated secret into your password manager or secret store before you leave the page, and configure it in the application that needs it.
{% endstep %}
{% endstepper %}

## Permissions

Permissions are granted per group and per verb. The groups cover organization users, billing, workspaces and workspace users, devices, device types, data flows, integrations, rules, custom logic, dashboards, and the [Data Fusion Layer](https://docs.akenza.io/data-fusion-layer/data-fusion-layer). Depending on the group, the available verbs are `create`, `read`, `update`, `delete`, and `manage`.

**Organization read** is always granted and cannot be removed, because a key has to be able to resolve the organization it belongs to. Everything beyond that is off until you grant it.

{% hint style="warning" %}
Grant the smallest set that does the job. A key that only feeds a reporting tool needs `asset: read` and nothing else, while a key with `manage` on workspace members can change who has access to your data. Keys do not expire, so an over-permissioned key stays over-permissioned until someone notices.
{% endhint %}

The permission names shown when you open a key are the same scope names used by the API, such as `asset`, `dataFlow`, `workspace.member`, and `organization.member`. See [Authentication](https://docs.akenza.io/reference/api-documentation/authentication) for the full list and for how they map onto requests.

## Viewing, copying, and deleting a key

Selecting a key's name opens a panel with everything it can do:

* The **API key** itself.
* Its **permissions**, listed as scope and verbs, for example `organization: read` and `asset: all`.
* Its **scope**, the organization and either *All workspaces* or the workspaces it was restricted to.

*Copy* in the list row copies the key. *Delete* revokes it immediately, and any application still using it starts receiving `401` responses, so check what the key is wired into before removing it.

{% hint style="danger" %}
A key's permissions and scope cannot be edited after creation. To change what a key may do, create a replacement, move your integrations across to it, and then delete the old one.
{% endhint %}

## Using the key

Send the secret in the `x-api-key` header:

```bash
curl -s 'https://api.akenza.io/v3/assets' \
  -H 'x-api-key: 099123122.2ab1000..'
```

A request that carries both an `Authorization` header and an `x-api-key` header is rejected, so send exactly one. If a call returns `403 permission denied`, the key is missing either the scope and verb for that endpoint or access to the workspace the object lives in.

{% hint style="info" %}
Actions taken with an API key appear in the [audit logs](https://docs.akenza.io/device-management/managing-an-organization/audit-logs) alongside actions taken by users, which is another reason to give each integration a key of its own rather than sharing one.
{% endhint %}

## OAuth2 clients

An **OAuth2 client** is the second credential type for machine-to-machine access. Instead of sending a long-lived secret on every request, your application exchanges a client ID and client secret for an access token using the **OAuth2 client credentials grant**, then sends that token as a standard bearer token. Tokens are valid for 15 minutes and there are no refresh tokens.

Both credential types are issued per organization, can be restricted to specific workspaces, and use the same permissions, so the choice is about how the credential is handled rather than about what it may do:

<table><thead><tr><th width="190"></th><th>API keys</th><th>OAuth2 clients</th></tr></thead><tbody><tr><td><strong>Sent as</strong></td><td>A static secret in the <code>x-api-key</code> header</td><td>A short-lived bearer token in the <code>Authorization</code> header</td></tr><tr><td><strong>Lifetime</strong></td><td>Long-lived until deleted</td><td>15 minutes per token</td></tr><tr><td><strong>Rotation</strong></td><td>Delete and recreate the key</td><td>Rotate the client secret in place</td></tr><tr><td><strong>Tooling</strong></td><td>Any HTTP client</td><td>Any OAuth2 or OpenID Connect client library</td></tr><tr><td><strong>Permission model</strong></td><td colspan="2">Identical</td></tr></tbody></table>

Choose **API keys** when simplicity matters and you have no requirement for short-lived credentials or secret rotation. Choose **OAuth2 clients** when your organization expects standard OAuth2 tooling, wants credentials that expire on their own, or needs to rotate a secret without a gap in service, since rotation keeps already-issued tokens working until they expire.

{% content-ref url="/pages/96f516551ed529475d80541161c6b76e45f9240a" %}
[Authentication](https://docs.akenza.io/reference/api-documentation/authentication)
{% endcontent-ref %}


# Audit Logs

A record of what changed in your organization, when it changed, and who changed it.

<img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2ba856f462f2adf65e5d44b734fa7ad3654afbdc%2Fbadge-expert-small.png?alt=media" alt="" data-size="line">

**Audit logs** record the changes made to the objects in your organization. Every entry names the object, the kind of change, the moment it happened, and the account behind it, which makes them the place to go when a dashboard looks different from yesterday, a rule stopped firing, or something is missing and nobody remembers removing it.

They are found under **Settings > Audit logs** and cover the whole organization, including all of its workspaces.

{% hint style="info" %}
Audit logs are visible to the **organization owner** and **organization admins**, the same roles that can reach [API keys](https://docs.akenza.io/device-management/managing-an-organization/api-keys) and change organization settings.
{% endhint %}

## What an entry records

<table><thead><tr><th width="190">Column</th><th>What it shows</th></tr></thead><tbody><tr><td><strong>Action</strong></td><td><em>View log</em>, which opens the entry in full.</td></tr><tr><td><strong>Timestamp</strong></td><td>When the change was recorded. The list starts with the most recent.</td></tr><tr><td><strong>Event</strong></td><td>The kind of change: <strong>Create</strong>, <strong>Update</strong>, or <strong>Delete</strong>.</td></tr><tr><td><strong>Resource name</strong></td><td>The name the object had at the time. It links to the object where it still exists, so a delete entry is plain text.</td></tr><tr><td><strong>Resource type</strong></td><td>What kind of object it was, for example a dashboard, a rule, or a device.</td></tr><tr><td><strong>Resource ID</strong></td><td>The object's identifier, which stays the same even when it is renamed. This is the value to use when following up through the <a href="https://docs.akenza.io/reference/api-documentation">API</a>.</td></tr><tr><td><strong>Agent</strong></td><td>The account that made the change.</td></tr><tr><td><strong>Workspace</strong></td><td>The workspace the object belongs to. Objects held at organization level, such as dashboards, show no workspace.</td></tr></tbody></table>

Because the name is stored as it was at the time, renaming an object does not rewrite its history. An entry from before a rename still shows the old name, while the resource ID ties both to the same object.

## Reading a change

*View log* opens the entry and shows what actually changed, comparing the object before and after as a diff. For an **Update** this is the quickest way to see which field moved, rather than inferring it from the object's current state.

## Finding a specific change

The list holds every change in the organization and grows quickly, so it is paginated, with the total count shown above it. Three things narrow it down:

* **Search** across the entries, for example by the name of the object you are investigating.
* **Filter**, using the filter button next to the search field.
* **Sort** by event, resource name, resource type, resource ID, or agent, using the arrows in the column headers.

Sorting by **agent** answers "what did this person change", and sorting by **resource ID** groups every entry for one object together, including the entries from before it was renamed.

## What to use them for

* **Explaining a change in behaviour.** A rule that stopped sending notifications, or a dashboard that lost a component, usually has an **Update** entry from the moment it changed.
* **Recovering context after a deletion.** A **Delete** entry records what was removed, by whom, and when.
* **Reviewing activity.** Filtering by agent shows what an account has been doing, which is worth checking when someone leaves the organization or a credential is suspected of being exposed.

{% hint style="info" %}
Audit logs record changes to configuration, not the measurements your devices send. For how the fleet itself is behaving, see the [Data Processing Logs](https://docs.akenza.io/device-management/data-processing-logs).
{% endhint %}


# Organization Users

Add and remove users at organization level, and assign organization roles.

The **Users** page of an organization lists everyone with access to it and the role they hold. Access granted here reaches the organization and **every** workspace in it, including workspaces created later, which makes it the right level for people who work across the whole account. For access to a single project or site, use [Workspace Users](https://docs.akenza.io/device-management/managing-a-workspace/workspace-users) instead.

{% content-ref url="/pages/2jrXgXOtAj7QPMD4wIMc" %}
[Users](https://docs.akenza.io/general/users)
{% endcontent-ref %}

## Roles

<table><thead><tr><th width="250">Role</th><th>Access</th></tr></thead><tbody><tr><td><strong>Organization owner</strong></td><td>The single user who owns the organization. Only the owner can delete it or transfer ownership.</td></tr><tr><td><strong>Organization admin</strong></td><td>Can manage and edit the organization, including its users and billing, with full access to its workspaces.</td></tr><tr><td><strong>Organization editor</strong></td><td>Edit access to the organization and its workspaces, but cannot add or remove users.</td></tr><tr><td><strong>Organization viewer</strong></td><td>Read-only access to the organization and its workspaces.</td></tr><tr><td><strong>Organization member</strong></td><td>Reaches the organization only through the workspaces they belong to.</td></tr></tbody></table>

{% hint style="info" %}
A user with access to at least one workspace in the organization appears here as **organization member**, even though they were never added at organization level. That is the role's purpose: it records their presence without granting organization-wide access.
{% endhint %}

Managing users requires the **organization owner** or **admin** role. For the full breakdown of what each role permits, see the [permission matrix](https://docs.akenza.io/general/users/user-roles).

{% content-ref url="/pages/mk4TxkSxPtPKABDFycdi" %}
[Add & removing users from your organization](https://docs.akenza.io/device-management/managing-an-organization/organization-users/add-and-removing-users-from-your-organization)
{% endcontent-ref %}


# Add & removing users from your organization

* [#add-users-to-your-organization](#add-users-to-your-organization "mention")
* [#removing-users-from-your-organization](#removing-users-from-your-organization "mention")
* [#workspace-roles](#workspace-roles "mention")

### Add users to your Organization

To add new users to your **Organization**, go to *Users* within the Organization Overview and select *Add User*.

![Organization users](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-82c91d8de21375d906a13e58714a5eab5029fd9e%2Forganization-users.png?alt=media)

Add the user Email and select the appropriate user role:

{% hint style="info" %}
**Organization-Admins** can manage and edit the Organization and have full access to its Workspaces.

**Organization-Editors** have edit access to the Organization and its Workspaces.

**Organization-Viewers** have read-only access to the Organization and its Workspaces.
{% endhint %}

Adding a user requires at least **organization admin** rights.

### Removing users from your Organization

Users are removed from the same **Users** page. Removing a user takes away the organization role they were given, and with it the access to every workspace that role implied.

{% hint style="warning" %}
Removing an organization role does not necessarily remove the person from akenza. If they were also added to a workspace directly, that access survives, and they continue to appear in the list as **organization member**. To remove them entirely, also remove them from each [workspace](https://docs.akenza.io/device-management/managing-a-workspace/workspace-users) they belong to.
{% endhint %}

The [organization owner](https://docs.akenza.io/device-management/managing-an-organization/general-settings) cannot be removed. Transfer ownership to another member first.

### Workspace Roles

Organization roles and workspace roles are separate, and they meet in one direction only. An organization role above member carries an implicit role in **every** workspace of that organization, including workspaces created later. A workspace role grants access to that workspace alone and never extends up to the organization or across to its other workspaces.

Learn more about user roles:

{% content-ref url="/pages/-MVvnykxZJF8KQPqkfwZ" %}
[User Roles](https://docs.akenza.io/general/users/user-roles)
{% endcontent-ref %}


# Managing a workspace

Create a workspace, manage the devices, data flows, and rules it holds, and configure the settings that apply to them.

**Workspaces** are where the actual work happens. Adding integration providers, data flows, and rules, or managing devices, are all activities that happen within a workspace. An organization can hold as many workspaces as you need, and every device belongs to exactly one of them.

The **workspace home** summarizes the state of the workspace: a [health score](https://docs.akenza.io/device-management/managing-a-workspace/health-score) with a short written assessment, the total device count, a breakdown of device status by online state, battery level, and signal quality, recent data processing, and the workspace metadata. [Genio](https://docs.akenza.io/genio/genio) can analyze the same picture and suggest what to do about it.

{% hint style="info" %}
For how workspaces sit between organizations and devices, see [Workspace Context](https://docs.akenza.io/general/workspace-context). For the level above, see [Managing an organization](https://docs.akenza.io/device-management/managing-an-organization).
{% endhint %}

## Create a workspace

To create a new workspace, select *Add workspace* on the workspaces page in your organization, or when switching workspaces.

![Create workspace](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2b692b7faf67e2b754ca532ed61015dedad4189d%2Fcreate-workspace.png?alt=media)

## What you manage in a workspace

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-microchip">:microchip:</i></td><td><strong>Devices</strong></td><td>The asset inventory of this workspace, where devices are created, imported, and inspected.</td><td><a href="https://docs.akenza.io/device-management/create-new-device">Devices</a></td></tr><tr><td><i class="fa-diagram-project">:diagram-project:</i></td><td><strong>Data Flows</strong></td><td>How uplinks are authenticated, decoded, and where the results are stored or forwarded.</td><td><a href="https://docs.akenza.io/device-management/your-data-flow">Data Flows</a></td></tr><tr><td><i class="fa-bolt">:bolt:</i></td><td><strong>Rules</strong></td><td>Business logic on incoming data, triggering notifications, downlinks, or aggregations.</td><td><a href="https://docs.akenza.io/device-management/rule-engine">Rules</a></td></tr><tr><td><i class="fa-cloud">:cloud:</i></td><td><strong>Integrations</strong></td><td>Connectivity provider accounts, used to connect, synchronize, and manage their devices.</td><td><a href="https://docs.akenza.io/device-management/integrations">Integrations</a></td></tr><tr><td><i class="fa-list-check">:list-check:</i></td><td><strong>Custom Fields</strong></td><td>Your own structured information on devices, such as a serial number or GPS coordinates.</td><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/custom-fields">Custom fields</a></td></tr><tr><td><i class="fa-tag">:tag:</i></td><td><strong>Tags</strong></td><td>Groupings of devices, so that filters, dashboards, and rules can address them together.</td><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/tags">Tags</a></td></tr></tbody></table>

Each of these lives in its own workspace, so devices, data flows, rules, and integrations in one workspace are invisible to another. Tags and custom fields are defined per workspace too, which is why a tag has to be unique only within the workspace that owns it.

Alongside them, the workspace navigation holds [Logs](https://docs.akenza.io/device-management/data-processing-logs) for inspecting what happened to incoming data, [Users](https://docs.akenza.io/device-management/managing-a-workspace/workspace-users) for access, and [General settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings). Whether a given page is accessible to you depends on your user role.

## Users and roles

A workspace has three roles: **admin**, **editor**, and **viewer**. Only **workspace admins**, and organization admins and owners, can invite users or change their roles. Every user listed on the workspace users tab shows both their organization and their workspace role.

Organization roles above member carry implicit access to all of that organization's workspaces, so a user can reach a workspace either directly or through the organization.

{% content-ref url="/pages/FblVKXEkBb8PUClw9HYL" %}
[Workspace Users](https://docs.akenza.io/device-management/managing-a-workspace/workspace-users)
{% endcontent-ref %}

{% content-ref url="/pages/-MVvnykxZJF8KQPqkfwZ" %}
[User Roles](https://docs.akenza.io/general/users/user-roles)
{% endcontent-ref %}


# Health score

How the workspace health score is calculated from the online state, signal quality, and battery level of the devices in a workspace, and how to improve it.

{% hint style="info" icon="heart-pulse" %}
**Your deployment at a glance.** Monitoring a large IoT fleet can be cumbersome, and checking the online status and battery level of thousands of devices by hand takes a long time. The health score captures the state of your deployment in a single number, from **1** (bad) to **5** (good).
{% endhint %}

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-7cc255cfc295a13bb7ed385333d70a50712ee9e6%2Fworkspace-health-score-example.png?alt=media" alt="An example workspace overview with a health score of 4, its written assessment, and the device status breakdown by online status, battery level, and signal quality"><figcaption><p>The health score on the workspace overview</p></figcaption></figure>

The **health score** is computed for each [workspace](https://docs.akenza.io/device-management/managing-a-workspace). It combines three partial scores, each also rated from 1 to 5:

<table><thead><tr><th width="220">Partial score</th><th>Based on</th></tr></thead><tbody><tr><td><strong>Online score</strong></td><td>The share of devices that are online.</td></tr><tr><td><strong>Signal score</strong></td><td>The <a href="https://docs.akenza.io/device-management/create-new-device/devices#signal-quality-indicator-sqi">signal quality indicator (SQI)</a> of each device's last uplink.</td></tr><tr><td><strong>Battery score</strong></td><td>The <a href="https://docs.akenza.io/device-management/create-new-device/devices#battery-level">battery level</a> of each device's last uplink.</td></tr></tbody></table>

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-476c7e302c49b0119c3b7ba57aef17cccade449d%2Fworkspace-health-score-hierarchy.png?alt=media" alt="Demonstrating all the subscores (online_status, battery_level ...etc) flowing in the main workspace health score"><figcaption><p>Workspace metrics flowing in the health score</p></figcaption></figure>

**The health score is the average of the partial scores, but never higher than the online score.** Offline devices are therefore the quickest way to lose points: good batteries and strong signals do not help if the devices are not sending data.

Each device gets a **rating**, such as good or bad, and the workspace gets a **score** calculated from the ratings of all its devices. Scores are rounded to whole numbers, and a result below 1 counts as 1.

The score is calculated from the latest state of every device in the workspace and recalculated periodically, so it follows devices going offline, coming back online, or reporting new uplink metrics.

### Troubleshoot your IoT fleet

Start with the offline devices, as they indicate data loss due to connectivity issues.

Once all connecvity issues are resolved, you can look into battery level (e.g. scheduling next battery change) or signal quality indicator (e.g. add gateways).

{% hint style="info" %}
**Genio can help you with this troubleshooting.** You can click the button `Analyse with GenIO` on the top left card of the **Workspace overview** page. For more details, see [Use Genio to troubleshoot your fleet](https://docs.akenza.io/genio/genio#use-genio-to-troubleshoot-your-fleet).
{% endhint %}


# General Settings

Settings that apply to a single workspace.

The **General** page of a workspace holds the settings that apply to that workspace and everything in it.

Modifying the settings requires the **Workspace Admin** role. Select *Save settings* to apply a change.

## Workspace basics

<table><thead><tr><th width="190">Setting</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>The workspace name, shown in the breadcrumb and in the workspace switcher. Often a project or a site, such as "Office Noerd".</td></tr><tr><td><strong>Description</strong></td><td>Optional free text, up to 500 characters. A street address is a common choice.</td></tr><tr><td><strong>Location</strong></td><td>The place the workspace represents. Select <em>Edit location</em> to set or change it.</td></tr><tr><td><strong>Time Zone</strong></td><td>The time zone the workspace operates in, for example (GMT+2) Europe/Zurich.</td></tr><tr><td><strong>Data retention</strong></td><td>How long data from this workspace is kept. <em>infinite</em> keeps it indefinitely.</td></tr></tbody></table>

{% hint style="info" %}
The workspace time zone is what dashboards group by. Day, week, and month boundaries in a [chart](https://docs.akenza.io/dashboard-builder/components/line-and-bar-chart) follow the workspace time zone rather than each viewer's browser, so everyone looking at the workspace sees the same buckets. It also defines the day boundaries used by [occupancy settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings/occupancy-settings).
{% endhint %}

{% hint style="warning" %}
Shortening **data retention** causes data older than the new period to be dropped. Forward anything you need to keep to a long-term destination with an [output connector](https://docs.akenza.io/device-management/your-data-flow/connectors) before reducing it.
{% endhint %}

## Sections

<table><thead><tr><th width="270">Section</th><th>What it controls</th></tr></thead><tbody><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/general-settings/device-lifecycle-reports">Lifecycle report</a></td><td>Daily or weekly email reports on device health, covering offline devices, weak signals, and low batteries.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/general-settings/workspace-properties">Workspace properties</a></td><td>A free-form JSON object of extra metadata, readable through the REST API.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/general-settings/occupancy-settings">Occupancy settings</a></td><td>Working days and hours, so that aggregations ignore the times the space is closed.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/general-settings/device-setup-assistant">Device Setup Assistant</a></td><td>The mapping file used when devices are configured on site.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/managing-a-workspace/general-settings/actions">Actions</a></td><td>Deleting the workspace.</td></tr></tbody></table>

{% hint style="info" %}
[Tags](https://docs.akenza.io/device-management/managing-a-workspace/tags) and [custom fields](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields) are also defined per workspace, but are managed on their own pages rather than under General.
{% endhint %}


# Device Lifecycle Reports

Akenza provides *daily* or *weekly* email reports on **device health** at the **Workspace** level, identifying *offline* devices, *weak* signals, or *low battery* levels. Each email includes a comprehensive list of new and ongoing alerts in each category, along with direct links to inspect the affected devices.

You can manage device lifecycle reports in the **Lifecycle report** section of the [General settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings) page. Any **Workspace Admin** can turn them on with **Activate lifecycle reports**, choose a **Delivery interval** of *Every day* or *Every week*, and maintain the list of **Report recipients**, which can hold several people.

![Lifecycle notifications](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-1c29a27b1846b6f69b816baf71ab30274a963951%2Fdevice-lifecycle-reports.png?alt=media)

On workspace creation, the notifications are **enabled by default**, and the workspace creator is set as the default recipient.

### Notification criteria

#### Offline

In order for a device to be marked as offline, the specified offline timeout is compared to the timestamp of the last received message. If the difference exceeds the specified threshold the device is marked as offline.

{% hint style="info" %}
This metric is available for **all devices.**
{% endhint %}

#### Weak Signal

If a device reports a **Signal Quality Indicator (SQI)** of 1, it marked as having a **weak signal**.

More information about SQI can be found in the [Uplink Metrics](https://docs.akenza.io/device-management/create-new-device/devices#uplink-metrics) section of the device reference.

{% hint style="info" %}
This metric is available for **LoRa devices** only.
{% endhint %}

#### Low Battery

If a device reports a battery level of **25% or lower**, it is counted as having a **low battery**.

The battery level can be calculated in a script or directly sent in the uplink payload (for passthrough devices). More information about Battery Level can be found in the [Uplink Metrics](https://docs.akenza.io/device-management/create-new-device/devices#uplink-metrics) section of the device reference.

{% hint style="info" %}
This metric is available for all devices, given the uplink payload or resulting sample contains the specified key and value which is used to determine the battery level.
{% endhint %}

### E-mail example

The below E-mail is an example of the lifecycle notification from the akenza office:

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2a2e6cbfc4a4e161533b25d99a7749205f52c02d%2Fdevice-lifecycle-email-report-example.png?alt=media" alt="" width="375"><figcaption><p>An example of a Device Lifecycle Report with one offline device.</p></figcaption></figure>


# Workspace properties

Attach your own metadata to a workspace as a JSON object, readable through the REST API.

**Workspace properties** hold additional metadata about a workspace as a free-form **JSON object**. The object is available through the [REST API](https://docs.akenza.io/reference/api-documentation), which makes it a useful place to keep information your own applications and integrations need to read alongside the workspace.

Typical uses are describing the site a workspace represents, recording identifiers from another system such as an ERP or IWMS, or storing configuration that a feature or an integration of yours reads at runtime.

## Editing the object

Open **Workspace properties** on the [General settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings) page, edit the JSON in the editor, and select *Save settings*. The content must be a single valid JSON object.

```json
{
  "onboardingConfig": {
    "spatialModelUrl": "https://example.com/spatial-model.json"
  }
}
```

Some akenza features read their own configuration from a reserved key in this object. The `onboardingConfig` key shown above is one such example, pointing at a spatial model used during device onboarding.

{% hint style="warning" %}
The editor replaces the whole object, so an application that writes here through the API and a person editing in the UI can overwrite each other. Read the current value before writing a new one, and keep keys that belong to other consumers intact.
{% endhint %}

{% hint style="info" %}
Workspace properties describe the **workspace**. To attach structured information to individual devices, use [custom fields](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields) instead, which are searchable and can be shown as columns in the asset inventory.
{% endhint %}


# Occupancy settings

Define when a workspace is in use, so that occupancy figures ignore nights, weekends, and closed days.

Occupancy settings tell akenza when the space a workspace represents is actually in use. Hours outside that window are excluded from aggregations (by setting filter working hours on a dashboard component or when querying data using the akenza REST API), so a dashboard reports data during working time rather than averaging it across nights, weekends, and days the building was closed.

This matters because the two are very different numbers. A meeting room used solidly from 09:00 to 17:00 is fully utilized, but measured across the whole 24 hours it looks like a third empty.

{% hint style="info" %}
For what the resulting metrics mean, and the difference between concurrent and time-based occupancy, see [Occupancy monitoring](https://docs.akenza.io/analytics-use-cases/occupancy-monitoring).
{% endhint %}

## Working days and hours

<table><thead><tr><th width="200">Setting</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Working days</strong></td><td>The days of the week that count. Select the days that apply, for example Monday to Friday.</td></tr><tr><td><strong>Working hours</strong></td><td>The daily window that counts, given as <em>From</em> and <em>To</em>, for example 09:00 to 17:00.</td></tr><tr><td><strong>Lunch break</strong></td><td>Optional. A window inside working hours to leave out, for example 12:00 to 13:00.</td></tr></tbody></table>

Times are interpreted in the workspace time zone, which is set at the top of the [General settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings) page.

## Public holidays

**Exclude public holidays from occupancy aggregation** leaves out the public holidays of a regional calendar, shown next to the toggle as a region code such as `CH-ZH`. Select *View the list* to see exactly which dates will be excluded before you rely on it.

## Excluding and including specific days

Two further toggles handle the days a calendar cannot know about:

* **Exclude specific days.** Individual dates to leave out, such as a company shutdown between Christmas and New Year. Add one date per entry with *Add option*.
* **Include specific days.** Individual dates to count even though they would otherwise be excluded, such as a Saturday when the site was open for an event.

Included days take precedence, which is what lets you keep a normal working week while making a one-off exception.

{% hint style="warning" %}
Changing these settings changes how data is aggregated. Figures for a period may therefore differ from figures you read before the change, so it is worth agreeing the working pattern with whoever uses the dashboards before adjusting it.
{% endhint %}


# Device Setup Assistant

Upload the mapping file that pre-fills device names, tags, and custom fields during an on-site installation.

This section configures the **mapping file** used by the [Device Setup Assistant](https://docs.akenza.io/device-setup-assistant/device-setup-assistant) when devices in this workspace are set up on site.

Without a mapping file, an installer types every value by hand at the device. With one, they select or scan the device, choose a single value, and the remaining device name, [tags](https://docs.akenza.io/device-management/managing-a-workspace/tags), and [custom fields](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields) are filled in from the file. On a large rollout that is the difference between a considered installation and a long afternoon of typing.

{% hint style="info" %}
The Device Setup Assistant is available on **Expert plans**. See [akenza.io/pricing](https://akenza.io/pricing) for what each tier includes.
{% endhint %}

## Uploading a mapping file

{% stepper %}
{% step %}

### Prepare the CSV

Build a CSV whose columns match the tags and custom fields defined in this workspace, and decide which custom field acts as the **primary field**, the one an installer picks from on site. The field name rules and a downloadable template are on the [Device Setup Assistant overview](https://docs.akenza.io/device-setup-assistant/device-setup-assistant).
{% endstep %}

{% step %}

### Upload it

Open **Device Setup Assistant** on the [General settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings) page and select *Upload file*. The section shows *No file uploaded* until a file is in place.
{% endstep %}

{% step %}

### Save

Select *Save settings*. The file now applies to installations in this workspace.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
The custom fields and tags named in the CSV must already exist in the workspace, spelled exactly as they are in the file. Values for names that do not exist are not applied.
{% endhint %}

{% content-ref url="/pages/GHXcYnuq8FQFCM4YK8xC" %}
[Overview](https://docs.akenza.io/device-setup-assistant/device-setup-assistant)
{% endcontent-ref %}


# Actions

Delete a workspace.

The **Actions** section at the bottom of the [General settings](https://docs.akenza.io/device-management/managing-a-workspace/general-settings) page holds the destructive operations for a workspace.

## Delete workspace

*Delete Workspace* removes the workspace from your organization.

{% hint style="danger" %}
Deleting a workspace cannot be undone. It removes the devices, device data, integrations, data flows, and rules that belong to it.

Before deleting, make sure anything you still need has been sent somewhere outside akenza, by exporting device data via the UI or read out through the [REST API](https://docs.akenza.io/reference/api-documentation).
{% endhint %}

Deleting a workspace requires the **Workspace Admin** role. Dashboards are managed at organization level, so they are not part of the workspace, but any component that pointed at a deleted workspace's devices no longer has data to show.


# Custom fields

Store your own structured information on devices, such as a serial number, an installation date, or a location.

**Custom fields** add your own information to a device, alongside the data it sends. A serial number, the date a battery was last replaced, the room a sensor hangs in, the contact responsible for it: none of this arrives in an uplink, but all of it is needed to run a fleet.

A custom field is defined once for the [workspace](https://docs.akenza.io/device-management/managing-a-workspace) and can then be filled in on any device in it. The definition holds the name, the type, and, for text and number fields, the values that may be chosen.

## Field types

<table><thead><tr><th width="200">Type</th><th>Use it for</th></tr></thead><tbody><tr><td><strong>Text</strong></td><td>Anything written, such as a serial number, an asset tag from another system, or a responsible team.</td></tr><tr><td><strong>Number</strong></td><td>Values you want to compare or sort, such as a floor number or an installation height.</td></tr><tr><td><strong>Date</strong></td><td>Points in time, such as commissioning, last maintenance, or warranty expiry.</td></tr><tr><td><strong>GPS coordinates</strong></td><td>A fixed position for a device that does not report one itself.</td></tr><tr><td><strong>JSON</strong></td><td>Structured information that does not fit the other types, for example a block of configuration carried over from another system.</td></tr></tbody></table>

Pick the narrowest type that fits. A date stored as text cannot be sorted sensibly, and a number stored as text will not compare the way you expect.

### Select options

For **Text** and **Number** fields you can define the values that may be chosen, which turns the field into a list instead of free input. This is what keeps a fleet consistent: `Floor 1`, `floor 1`, and `1st floor` are three different values when they are typed by hand, and one value when they are picked from a list.

Options are added, edited, and removed in the custom field management page, and a field can be marked as **required** so that a value has to be supplied rather than left empty.

## Adding a custom field to a device

A custom field can be set while the device is being created, with *+ Add Custom Field*. An existing field can be selected, or a new one created on the spot.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-d04a23d56b4f2861d915958082bc2afec4c20f7d%2Fcreate-device-basic-information.png?alt=media" alt="Adding a custom field during device creation"><figcaption><p>Custom fields during device creation</p></figcaption></figure>

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e264cbb1564dcc1cd3275954252cad2f8f980670%2Fcustom-field-types.png?alt=media" alt="The field types available for a custom field"><figcaption><p>The available field types</p></figcaption></figure>

The same fields can be set later on the device itself, so nothing has to be decided at creation time.

## Managing custom fields for the workspace

**Custom Fields** in the workspace settings lists every field defined in the workspace. From there you can create a field, edit an existing one including its select options, and import a set of fields at once.

Definitions and values are separate things: editing a definition changes the field for every device that uses it, while a value belongs to the one device it is set on.

### Importing definitions

A set of custom fields can be imported from a CSV file with these columns:

<table><thead><tr><th width="190">Column</th><th>What it holds</th></tr></thead><tbody><tr><td><code>name</code></td><td>The field name as it appears on devices.</td></tr><tr><td><code>description</code></td><td>An optional explanation of what belongs in the field.</td></tr><tr><td><code>type</code></td><td><code>STRING</code>, <code>NUMBER</code>, <code>DATE</code>, <code>GPS</code>, or <code>JSON</code>.</td></tr><tr><td><code>required</code></td><td><code>true</code> or <code>false</code>.</td></tr><tr><td><code>selectOptions</code></td><td>The permitted values for a text or number field, one per line inside the cell. Leave empty for free input.</td></tr></tbody></table>

{% file src="/files/X9FXBu5e4EofkBn9ZgXV" %}

{% hint style="info" %}
This imports the **definitions**. To fill in **values** across many devices, use the asset inventory: custom field values are one of the properties supported by [bulk edit](https://docs.akenza.io/device-management/create-new-device/asset-bulk-import), and they can also be set per device during a [bulk import](https://docs.akenza.io/device-management/create-new-device/asset-bulk-import) of devices.
{% endhint %}

## Where custom fields show up

* **In the asset inventory**, as columns you can show alongside the built-in ones.
* **In filters**, so you can list every device sharing a value, for example all sensors on one floor or every device due for a battery change.
* **In outputs**, template custom field values as part of the events sent by an output connector.

{% hint style="info" %}
Custom fields describe a single device. To group devices so that rules and filters can address them together, use [tags](https://docs.akenza.io/device-management/managing-a-workspace/tags). To model how devices relate to a building, its floors, and its rooms, use the [Data Fusion Layer](https://docs.akenza.io/data-fusion-layer/data-fusion-layer).
{% endhint %}


# Tags

Group devices in a workspace so that rules, dashboards, filters, and bulk actions can address them together.

A **tag** is a label put on devices so they can be treated as a group. Where a [custom field](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields) describes one device, a tag connects many: every sensor on the first floor, every CO2 sensor, every device belonging to one customer.

Using tags for grouping devices, a single [rule](https://docs.akenza.io/device-management/rule-engine) can cover all of its devices, a filter can list them, a dashboard component can aggregate and visualize data for all of the devices belonging to a tag, without anyone maintaining a list of device IDs by hand.

Tags belong to the [workspace](https://docs.akenza.io/device-management/managing-a-workspace). A tag name is limited to **64 characters** and has to be unique within its workspace, so the same name can exist in another workspace without the two being related.

## Adding tags when you create a device

Tags can be assigned in the device creation step. Existing tags are offered in the tag field, and typing a name that does not exist yet creates it.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-64172d958bf5087b83537d4baec77f4613fbcc05%2Fcreate-device-tags.png?alt=media" alt="Assigning tags while creating a device"><figcaption><p>Tags during device creation</p></figcaption></figure>

## Adding tags to an existing device

On the device detail page you can pick from the tags already in the workspace or create a new one. A device can carry as many tags as you need, which is what makes tags worth using: a sensor can be part of a floor, a device class, and a customer at the same time.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-d9ec25ea76c346bc846d03272f28c410e36f29fc%2Fdevice-detail-page.png?alt=media" alt="Tags on the device detail page"><figcaption><p>Tags on the device detail page</p></figcaption></figure>

{% hint style="info" %}
Removing a tag from a device only removes the assignment. The tag itself stays in the workspace and keeps its other devices.
{% endhint %}

## Managing tags for the workspace

**Tags** in the workspace settings lists every tag in the workspace, where they can be created, edited, and imported in bulk. Each tag has a name, an optional description, and a color, which is what makes it recognizable at a glance in the inventory.

A set of tags can be imported from a CSV file with these columns:

<table><thead><tr><th width="190">Column</th><th>What it holds</th></tr></thead><tbody><tr><td><code>name</code></td><td>The tag name, unique in the workspace and at most 64 characters.</td></tr><tr><td><code>description</code></td><td>An optional explanation of what the tag stands for.</td></tr><tr><td><code>color</code></td><td>A hex color such as <code>#40A9FF</code>.</td></tr></tbody></table>

{% file src="/files/SG1vFLHaE6YRzvj24NVS" %}

## Using tags as rule input

A tag can be selected as the [input of a rule](https://docs.akenza.io/device-management/rule-engine/rule-input), which then runs for every device carrying that tag. The rule keeps up on its own: tag a newly installed sensor and it is covered, without editing the rule.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-5eeac44a8422212cc9d97e9bc5c2e35a62561a40%2Frule-input-devices.png?alt=media" alt="Selecting a tag as the input of a rule"><figcaption><p>A tag as rule input</p></figcaption></figure>

{% hint style="warning" %}
Devices addressed through one tag have to share a data schema, meaning the same topic and data keys. The rule logic reads a specific key from the incoming sample, so a device that structures its data differently will not produce the value the rule expects.
{% endhint %}

This is the practical reason to keep at least one tag per device class. A tag such as `co2` is safe as a rule input in a way that `building_a`, spanning every kind of sensor in a building, is not.

## Using tags as a dashboard data source

A [dashboard](https://docs.akenza.io/dashboard-builder/dashboard-builder) component reads either from one device or from a tag. On the component's **Source** tab, set **Type** to *Tag*, pick the tag, and choose the data point to read. The component then covers every device carrying that tag, and combines their values into the figure it shows, according to the aggregation settings of the component.

A trend component pointed at a tag such as `1og` and the data point `count`, aggregated by maximum, reports the peak number of people counted across that floor, regardless of how many sensors contribute to it.

Two things follow from this:

* **The dashboard keeps up with the fleet.** A sensor tagged after the dashboard was built is included the next time the component loads, without anyone editing the dashboard.
* **The data point has to exist on every device with the tag**, for the same reason it has to for rules. A device that does not report the selected key contributes nothing to the result.

## Naming tags

Tags are flat labels, with no hierarchy and no nesting, so the structure has to live in the names. A convention worth adopting:

* **By device type**, for example `temperature`, `co2`, `water-meter`. These are the tags that work as rule inputs.
* **By location**, for example `floor_1`, `building_a`. These are what you filter the inventory by.
* **By responsibility**, for example a customer, a tenant, or the team that maintains the devices.

Agree on the separator and the case before the fleet grows. `floor1` and `floor_1` are two tags, and nothing later merges them.

{% hint style="info" %}
Tags are for grouping. To model a building properly, with sites, floors, zones, and what each sensor measures in them, use the [Data Fusion Layer](https://docs.akenza.io/data-fusion-layer/data-fusion-layer), which carries the relationships a flat label cannot.
{% endhint %}


# Workspace Users

Grant access to a single workspace and assign workspace roles.

The **Users** page of a workspace lists everyone who can reach it and the role they hold. Access granted here applies to this workspace alone, which makes it the right level for a customer, a contractor, or a team responsible for one site. For access across every workspace at once, use [Organization Users](https://docs.akenza.io/device-management/managing-an-organization/organization-users) instead.

## Add users to your Workspace

To add new users to your **Workspace**, go to *Users* within the Workspace Overview and select *Add User*.

![Workspace users](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e7403cedcc63ef09603dc076de3a56b17a208856%2Fworkspace-users.png?alt=media)

Add the user Email and select the appropriate user role:

{% hint style="info" %}
**Workspace-Admins** have full access on the Workspace.

**Workspace-Editors** have edit access on the Workspace.

**Workspace-Viewers** have read-only access on the Workspace.
{% endhint %}

Adding, removing, and re-assigning users requires the **workspace admin** role, or an organization admin or owner. Workspace editors can change the contents of a workspace but not who may reach it.

## Removing users from a workspace

Users are removed from the same **Users** page. Removing someone takes away their access to this workspace only.

{% hint style="warning" %}
If the person also holds an organization role above member, they keep access to this workspace through that role, and removing them here changes nothing. In that case the role has to be changed at [organization level](https://docs.akenza.io/device-management/managing-an-organization/organization-users).
{% endhint %}

## Organization users in this list

The user list shows both the organization role and the workspace role for each person, because the two combine. Anyone with an organization role above member already has access to this workspace without ever being added to it.

{% content-ref url="/pages/2jrXgXOtAj7QPMD4wIMc" %}
[Users](https://docs.akenza.io/general/users)
{% endcontent-ref %}

{% content-ref url="/pages/-MVvnykxZJF8KQPqkfwZ" %}
[User Roles](https://docs.akenza.io/general/users/user-roles)
{% endcontent-ref %}


# Devices

The inventory of all devices in a workspace, and the detail view of a single device.

**Devices** is the inventory of a workspace. It lists every device with its current state, and it is where you create, import, search for, and open devices.

{% content-ref url="/pages/-MWEZ2jDmLrbRO0bjxqF" %}
[Device](https://docs.akenza.io/device-management/create-new-device/devices)
{% endcontent-ref %}

## The device list

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e49130c7fa3ac3bdc929ca0397adf40641590c87%2Fasset-inventory.png?alt=media" alt="The device inventory"><figcaption><p>The device inventory</p></figcaption></figure>

Each row shows the state of one device:

<table><thead><tr><th width="210">Column</th><th>What it shows</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>The device name. Opens the detail view.</td></tr><tr><td><strong>CS</strong></td><td>Connection state. Shows whether the device has sent data within its offline timeout.</td></tr><tr><td><strong>Device ID</strong></td><td>The identifier the device sends data with, such as its DevEUI.</td></tr><tr><td><strong>Tags</strong></td><td>The <a href="https://docs.akenza.io/device-management/managing-a-workspace/tags">tags</a> assigned to it, in their colors.</td></tr><tr><td><strong>SQI</strong></td><td>Signal quality of the last uplink, if the connectivity reports it.</td></tr><tr><td><strong>Data Flow</strong></td><td>The <a href="https://docs.akenza.io/device-management/your-data-flow">data flow</a> that processes its uplinks. Opens the data flow.</td></tr><tr><td><strong>Last Message Time</strong></td><td>When the last uplink arrived. This is the quickest way to check whether a device still sends data.</td></tr></tbody></table>

[Custom fields](https://docs.akenza.io/device-management/managing-a-workspace/custom-fields) can be added as additional columns.

Above the list are the search field, the filter, and the controls for selecting columns and refreshing the list. Most columns can be sorted.

## Adding devices

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-plus">:plus:</i></td><td><strong>Create a device</strong></td><td>Add one device, assign its data flow, and fill in its connectivity parameters.</td><td><a href="https://docs.akenza.io/how-to-create-a-working-environment/how-to-connect-a-device">Connect a Device</a></td></tr><tr><td><i class="fa-layer-group">:layer-group:</i></td><td><strong>Bulk import</strong></td><td>Create many devices from a CSV file, and edit, register, or delete devices in bulk.</td><td><a href="https://docs.akenza.io/device-management/create-new-device/asset-bulk-import">Bulk actions</a></td></tr><tr><td><i class="fa-flask">:flask:</i></td><td><strong>Device Simulator</strong></td><td>Generate uplinks without hardware to build and test a data flow.</td><td><a href="https://docs.akenza.io/device-management/create-new-device/device-simulator">Device Simulator</a></td></tr><tr><td><i class="fa-qrcode">:qrcode:</i></td><td><strong>Device Setup Assistant</strong></td><td>Configure devices on site by scanning a QR code.</td><td><a href="https://docs.akenza.io/device-setup-assistant/device-setup-assistant">Overview</a></td></tr></tbody></table>

## The device detail view

The detail view shows everything akenza has recorded about a device: its identifiers, its data flow, its tags and custom fields, the data it has sent, and the uplink metrics of its last message.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-d9ec25ea76c346bc846d03272f28c410e36f29fc%2Fdevice-detail-page.png?alt=media" alt="The device detail view"><figcaption><p>The device detail view</p></figcaption></figure>

### Connectivity details

What is shown under **Connectivity Details** depends on the connectivity, and for LoRaWAN on the carrier. All carriers show the standard LoRaWAN details. Devices on Swisscom Actility and generic Actility networks also show:

<table><thead><tr><th width="230">Detail</th><th>What it is</th></tr></thead><tbody><tr><td><strong>Motion Indicator</strong></td><td>The movement expected of the sensor. In most cases this is <em>Near static</em>.</td></tr><tr><td><strong>Connectivity Plan</strong></td><td>The plan the device is billed under on the carrier.</td></tr><tr><td><strong>Data Route</strong></td><td>How an uplink is forwarded and who can send a downlink. It is set automatically if the device is created with a data flow.</td></tr><tr><td><strong>Boot Profile</strong></td><td>Information about the device model.</td></tr></tbody></table>

### Downlinks

Downlinks can be sent manually from the detail view, or triggered by a [rule action](https://docs.akenza.io/device-management/rule-engine/rule-actions/downlink).

**LoRaWAN downlinks** require a port and a payload. The port has to be zero or positive, and most carriers require it to be positive. The payload is a hex string. The *confirmed* toggle requests a confirmation that the downlink was sent.

If the data flow of the device uses a [device type](https://docs.akenza.io/device-management/your-data-flow/device-type) with a downlink script, the hex payload is replaced by a JSON object. The script translates it into a hex string during processing, and it can also override the port and the confirmed flag.

**MQTT downlinks** require a JSON object as the payload and can have an optional topic. The topic has to start with `/` and is appended to the default downlink topic. The payload can be any valid JSON. A downlink script in the device type can override the topic.


# Device

What a device is in akenza, how it is identified, and which fields it has.

A **device** represents hardware in the field, such as a sensor, a meter, or a tracker. It sends data to akenza as **uplinks**, and depending on its connectivity it can also receive **downlinks**. Devices belong to a [workspace](https://docs.akenza.io/device-management/managing-a-workspace) and are managed in the device inventory.

## What a device carries

akenza stores the following information for each device:

<table><thead><tr><th width="220">Group</th><th>What it holds</th></tr></thead><tbody><tr><td><strong>Identity</strong></td><td>The name and description you give it, the physical device ID it sends data with, and the akenza device ID used for API calls.</td></tr><tr><td><strong>Assignment</strong></td><td>The organization and workspace it belongs to.</td></tr><tr><td><strong>Processing</strong></td><td>The <a href="https://docs.akenza.io/device-management/your-data-flow">data flow</a> assigned to it, which includes the device connector and the device type that decodes its payloads.</td></tr><tr><td><strong>Connectivity</strong></td><td>How it reaches akenza, and for networked connectivity the network parameters and the <a href="https://docs.akenza.io/device-management/integrations">integration</a> it was provisioned through.</td></tr><tr><td><strong>Your metadata</strong></td><td>The <a href="https://docs.akenza.io/device-management/managing-a-workspace/tags">tags</a> and <a href="https://docs.akenza.io/device-management/managing-a-workspace/custom-fields">custom fields</a> you assign.</td></tr><tr><td><strong>State</strong></td><td>Whether it is online, its offline timeout, whether it is registered on the network, and whether it is included in the <a href="https://docs.akenza.io/device-management/managing-a-workspace/general-settings/device-lifecycle-reports">lifecycle report</a>.</td></tr><tr><td><strong>Last uplink</strong></td><td>The uplink metrics, updated with every message.</td></tr></tbody></table>

{% hint style="info" %}
The [REST API documentation](https://docs.akenza.io/reference/api-documentation) lists every field of a device. This page explains what they mean.
{% endhint %}

## Identifiers

A device has two identifiers:

* The **device ID** is set when the device is created. It is usually the physical identifier of the device, the DevEUI for LoRaWAN devices, or any suitable identifier for HTTP, MQTT, and CoAP. akenza matches incoming data on it.
* The **akenza device ID** is assigned by akenza and never changes.

You can change the device ID during the lifetime of a device, for example when you replace a sensor. The akenza device ID stays the same, so the device keeps its history, tags, custom fields, and dashboards. All REST API operations use the akenza device ID.

## Fields depend on connectivity

The [device connector](https://docs.akenza.io/device-management/your-data-flow/device-connector) in the data flow decides which fields a device has:

* **Networked connectivity**, such as [LoRaWAN](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan) or [NB-IoT](https://docs.akenza.io/device-management/your-data-flow/device-connector/nb-iot), requires the parameters of the network. For LoRaWAN these are the DevEUI, the application EUI and key, the activation mode (OTAA or ABP), the device class, the frequency plan, and the LoRaWAN version. Carriers can require more. An Actility-based network also has a connectivity plan, a device profile, and a motion indicator.
* **IP-based connectivity**, such as [HTTP](https://docs.akenza.io/device-management/your-data-flow/device-connector/http), [MQTT](https://docs.akenza.io/device-management/your-data-flow/device-connector/mqtt), and [CoAP](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap), has no network parameters. The device connects over the internet and authenticates with the secret of its connector.

The last step of the creation wizard asks for these parameters, which is why its content changes with the connector. For a walkthrough of creating a device, see:

{% content-ref url="/pages/-MUICr3a0-fo8AuI\_EKB" %}
[Connect a Device](https://docs.akenza.io/how-to-create-a-working-environment/how-to-connect-a-device)
{% endcontent-ref %}

## Online state

A device is **online** if its last uplink is newer than its **offline timeout**, which is set when the device is created. akenza only tracks whether a device has sent data, not whether it works correctly.

Set the timeout according to how often the device sends. A sensor that sends every 15 minutes with a timeout of 24 hours can stop sending for almost a day before it shows as offline. A sensor that sends once a day with a timeout of two hours shows as offline every day.

{% hint style="info" %}
Exclude test devices and spares from the [device lifecycle report](https://docs.akenza.io/device-management/managing-a-workspace/general-settings/device-lifecycle-reports) so that they are not reported as problems.
{% endhint %}

## Data

Devices send data to akenza as uplinks, either at a fixed interval or when an event occurs. Each uplink runs the data processing pipeline defined by its [data flow](https://docs.akenza.io/device-management/your-data-flow).

Data can be split into **topics** by purpose or schema, which keeps the structure of the data. One data point is a **sample**, identified by the akenza device ID, the topic, and the timestamp.

{% hint style="warning" %}
Historical device data is only available if the data flow contains an **akenzaDB** output connector. Without it, data is processed but not stored.
{% endhint %}

## Uplink metrics

**Uplink metrics** are recorded with every uplink. They describe the transmission rather than its content: the size of the payload, when it arrived, and, if the network reports it, how well it was received.

{% hint style="info" %}
Which metrics are recorded depends on the connectivity and the provider.
{% endhint %}

For HTTP, MQTT, and CoAP, only the size and the time are recorded:

```javascript
{
    "uplinkSize": 478,
    "timestamp": "2021-09-17T07:10:16Z"
}
```

A LoRaWAN uplink also contains radio and network information:

```javascript
{
    "uplinkSize": 246,
    "timestamp": "2026-09-25T14:18:44Z",
    "port": 5,
    "frameCountUp": 46897,
    "frameCountDown": 1048,
    "rssi": -119.0,
    "snr": -5.75,
    "sf": 7,
    "txPower": 2.0,
    "numberOfGateways": 1,
    "esp": -125.77,
    "sqi": 2,
    "signalQuality": "MEDIUM",
    "batteryLevel": 100.0,
    "batteryLevelStatus": "GOOD"
}
```

### Battery level

akenza reads the battery level from the sample after the device type script has run. The sample has to contain either `batteryLevel` or `batteryPercent`.

If several samples in the same uplink contain a battery value, the lowest one is stored. For passthrough data flows, the value is read directly from the uplink payload.

### Signal quality indicator (SQI)

LoRaWAN uplinks usually contain enough information to calculate the **SQI**. It is based on `snr` and `rssi` and rates the signal quality from 1 (weak) to 3 (strong).

akenza also reads it from the sample after the script has run, from `sqi`, `signalQuality`, or `signalQualityIndicator`, in that order. Values have to be between 1 and 3. Decimals are rounded down, and values outside the range are ignored. If several samples in the same uplink contain a value, the lowest one is stored. For passthrough data flows, the value is read directly from the uplink payload.

{% hint style="info" %}
The [device lifecycle report](https://docs.akenza.io/device-management/managing-a-workspace/general-settings/device-lifecycle-reports) is based on battery level and signal quality, so make sure your device type emits them.
{% endhint %}


# Device Simulator

This page explains the device simulator in more detail

The **device simulator** allows you to send data to your **HTTP device** on akenza without the need of a physical device.

The following steps are required to make use of the device simulator:

### 1. Create a Data Flow

* **Device Connector:** HTTP
* **Device Type:** Akenza Device Simulator
* **Output Connector:** Akenza DB

### 2. Create a device

Go to *Assets* and start with *Create device*. Proceed with the creation of an HTTP device.

{% hint style="info" %}
Find out more about [here](#2.-create-a-device) how to create an HTTP device.
{% endhint %}

### 3. Use of the Device Simulator

Select your HTTP device in *Assets*. The device detail page will be shown. The data generator is displayed in the header of your device detail page. Select *Edit* and the sidebar of the **data generator** will appear.

You can choose to have data generated automatically or manually specify the sensor values. Send it in intervals or manually.\
The following values are currently available for simulation:

* Temperature
* Humidity
* CO2
* Noise level
* Illuminance
* Occupancy

![Data Generator](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-fe9b008373f192bdd2befbbb20df1ee3c45ad07d%2Fdevice-simulator-data-generator.png?alt=media)


# Filter

{% hint style="info" %}
Work in progress
{% endhint %}


# Bulk actions

This page describes the asset bulk actions in more detail

The functionality of **Asset Bulk Actions** allows managing the fleet by importing, editing, or deleting multiple assets at once. Asset bulk actions are managed in the **Asset Inventory**.

### Bulk import

Bulk import allows importing multiple assets at once to the **Asset Inventory**. Assets can be imported to an existing **Data Flow** or to an **Integration (no data processing (LoRa only))**. **HTTP,** **MQTT** **& CoAP** devices can also be bulk uploaded.

To import multiple assets at once, *+ Bulk import* has to be selected on the **Asset Inventory Overview**.

![Bulk import on the Asset Inventory Overview](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e49130c7fa3ac3bdc929ca0397adf40641590c87%2Fasset-inventory.png?alt=media)

Data processing either to an existing **Data Flow** or to a **Connectivity integration** has to be defined. The CSV file needs to be uploaded accordingly. Find more details of how to use **CSV templates** [here](https://docs.akenza.io/device-management/create-new-device/bulk-import-csv-templates).

![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-fe2dbda60bccbd2cbd815f5760272ab2b5f89c09%2Fasset-bulk-import.png?alt=media)

Once the CSV file is uploaded, the file validation can be started. If the validation is successful, the import can start. All imported assets will be displayed now on the **Asset Inventory Overview**.

If further assistance is required, please contact us at <support@akenza.io>

### Bulk edit

Bulk edit allows editing the common set of properties of the current selection of Assets. Single or multi-select of Assets is possible. Only one field can be edited at a time. Fields that have not been selected will not be changed.

Editable fields are supported for:

* Name
* Description
* LoRa properties
* Custom field values

Bulk edit is possible via filter or by selecting single device ID's.

### Bulk register & deregister

Bulk register allows registering multiple Assets at once. A Data Flow can be assigned and edited to a set of Assets.

{% hint style="info" %}
This will remove the Assets from the LNS and require a rejoin upon registration.
{% endhint %}

Bulk deregister allows deregistering multiple Assets at once. Deregistering is possible via filter or by selecting single device ID's.

### Bulk delete

Bulk delete allows deleting a set of Assets. Deleting is possible via filter or by selecting single device ID's.

{% hint style="info" %}
Optionally: Assets can be deleted on the LNS (LoRaWAN Network Server).
{% endhint %}


# Bulk import CSV templates

This page provides CSV templates and additional descriptions for Bulk imports

On this page, **bulk import CSV templates** are ready to be downloaded for:

* Connectivity Management only & LoRa Data flows
  * For OTAA- activation mode
  * For ABP- activation mode
* HTTP, MQTT & CoAP Data Flow

### OTAA- activation mode (Over-the-Air Activation)

**General field descriptions:**

<table data-header-hidden><thead><tr><th width="233.33333333333331">Field</th><th>mandatory or optional</th><th>Description</th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>mandatory or optional</strong></td><td><strong>Description</strong></td></tr><tr><td>name</td><td>mandatory</td><td>Name example of device eg. Humidity Sensor 1</td></tr><tr><td>onlineTimeout</td><td>optional</td><td>Interval in seconds, how long a device appears (green) online in akenza after last sample eg. 86400 (= 24 hours)</td></tr><tr><td>applicationKey</td><td>mandatory</td><td>Provided from the device. 16 byte eg. 1213456789012345612134567890123456</td></tr><tr><td>applicationEui</td><td>mandatory</td><td>Provided from the device. 8 byte eg. 12134567890123456</td></tr><tr><td>deviceClass</td><td>mandatory</td><td>Provided from the device. eg. A, B or C</td></tr><tr><td>loraVersion</td><td>mandatory</td><td>Provided from the device. eg. 1.0.3</td></tr><tr><td>deviceEui</td><td>mandatory</td><td>Provided from the device. 8 byte eg. 12134567890123456</td></tr><tr><td>description</td><td>optional</td><td>Free text field. eg. Humidity Sensor 1 on floor A</td></tr><tr><td>frequencyPlan</td><td>optional</td><td>provided from the device and integration e.g. EU_863_870</td></tr></tbody></table>

**Bulk import template - OTAA:**

{% file src="/files/8EUNfj5PDXR17IWnt22p" %}

**General field descriptions LoRa 1.1:**

| Field          | mandatory or optional | Description                                                                                                      |
| -------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------- |
| name           | mandatory             | Name example of device eg. Humidity Sensor 1                                                                     |
| onlineTimeout  | optional              | Interval in seconds, how long a device appears (green) online in akenza after last sample eg. 86400 (= 24 hours) |
| deviceClass    | mandatory             | Provided from the device. eg. A, B or C                                                                          |
| loraVersion    | mandatory             | 1.1.0                                                                                                            |
| deviceEui      | mandatory             | Provided from the device. 8 byte eg. 12134567890123456                                                           |
| joinEui        | mandatory             | Provided from the device. 8 byte eg. 12134567890123456                                                           |
| networkKey     | mandatory             | Provided from the device. 16 byte eg. 12345678901234561234567890123456                                           |
| applicationKey | mandatory             | Provided from the device. 16 byte eg. 12345678901234561234567890123456                                           |
| description    | optional              | Free text field. eg. Humidity Sensor 1 on floor A                                                                |
| frequencyPlan  | optional              | provided from the device and integration e.g. EU\_863\_870                                                       |

**Bulk import template - OTAA actility:**

{% file src="/files/BHCK2eniYk6QOz4VK1YE" %}

**Applies only for Swisscom and Actility connectivity carrier:**

| **Field**          | **mandatory or optional** | **Description**                                                                 |
| ------------------ | ------------------------- | ------------------------------------------------------------------------------- |
| motionIndicator    | mandatory                 | Valid values: NEAR\_STATIC, WALKING\_SPEED, VEHICLE\_SPEED, BIKE\_SPEED, RANDOM |
| activationMode     | mandatory                 | Activating a device with Over-the-Air Activation (OTAA)                         |
| deviceProfileId    | mandatory                 | LoRa/GenericA.1.0.3a\_ETSI                                                      |
| connectivityPlanId | optional                  | eg. swisscom-cs/swisscom-cp-nb-trial                                            |

**Bulk import template - OTAA actility:**

{% file src="/files/s0XvjcRBwJzikpUWncC3" %}

### ABP- activation mode (Activation by Personalization)

**General field descriptions:**

| **Field**             | **mandatory or optional** | **Description**                                                                                                  |
| --------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| name                  | mandatory                 | Name example of device eg. Temperature Sensor 2                                                                  |
| onlineTimeout         | optional                  | Interval in seconds, how long a device appears (green) online in akenza after last sample eg. 86400 (= 24 hours) |
| applicationSessionKey | mandatory                 | Provided from the device. 16 byte eg. 1213456789012345612134567890123456                                         |
| deviceClass           | mandatory                 | Provided from the device. A, B or C                                                                              |
| loraVersion           | mandatory                 | Provided from the device. eg. 1.0.3                                                                              |
| deviceEui             | mandatory                 | Provided from the device. 8 byte eg. 12134567890123456                                                           |
| deviceAddress         | mandatory                 | Provided from the device. 4 byte device address (8 characters)                                                   |
| networkSessionKey     | mandatory                 | 16 byte eg. 1213456789012345612134567890123456                                                                   |
| description           | optional                  | Free text field. eg. Temperature Sensor 2 on floor B                                                             |

**Bulk import template - ABP:**

{% file src="/files/PIizfTwdupG0IKLNBqdt" %}

**General field descriptions 1.1:**

| Field                                | mandatory or optional | Description                                                                                                      |
| ------------------------------------ | --------------------- | ---------------------------------------------------------------------------------------------------------------- |
| name                                 | mandatory             | Name example of device eg. Temperature Sensor 2                                                                  |
| onlineTimeout                        | optional              | Interval in seconds, how long a device appears (green) online in akenza after last sample eg. 86400 (= 24 hours) |
| deviceEui                            | mandatory             | Provided from the device. 4 byte device address (8 characters)                                                   |
| loraVersion                          | mandatory             | 1.1.0                                                                                                            |
| deviceClass                          | mandatory             | Provided from the device. A, B or C                                                                              |
| deviceAddress                        | mandatory             | Provided from the device. 4 byte eg. 121345678                                                                   |
| applicationSessionKey                | mandatory             | Provided from the device. 16 byte eg. 12345678901234561234567890123456                                           |
| forwardingNetworkSessionIntegrityKey | mandatory             | Provided from the device. 16 byte eg. 12345678901234561234567890123456                                           |
| networkSessionEncryptionKey          | mandatory             | Provided from the device. 16 byte eg. 12345678901234561234567890123456                                           |
| servingNetworkSessionIntegrityKey    | mandatory             | Provided from the device. 16 byte eg. 12345678901234561234567890123456                                           |
| frequencyPlan                        | optional              | provided from the device and integration e.g. EU\_863\_870                                                       |
| description                          | optional              | Free text field. eg. Temperature Sensor 2 on floor B                                                             |

**Bulk import template - ABP 1.1:**

{% file src="/files/UcE5ESIrCJYANOimMOIc" %}

**Applies only for Swisscom and Actility connectivity carrier:**

| **Field**          | **mandatory or optional** | **Description**                                                                 |
| ------------------ | ------------------------- | ------------------------------------------------------------------------------- |
| motionIndicator    | mandatory                 | Valid values: NEAR\_STATIC, WALKING\_SPEED, VEHICLE\_SPEED, BIKE\_SPEED, RANDOM |
| activationMode     | mandatory                 | Activating a device with Activation by Personalization (ABP)                    |
| deviceProfileId    | mandatory                 | LoRa/GenericA.1.0.3a\_ETSI                                                      |
| connectivityPlanId | optional                  | eg. swisscom-cs/swisscom-cp-nb-trial                                            |

**Bulk import template - ABP actility:**

{% file src="/files/JesqKQXJBVxrhFKDihY7" %}

### HTTP, MQTT & CoAP Data Flow

**General field descriptions:**

| **Field**     | **mandatory or optional** | **Description**                                                                                                  |
| ------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| name          | mandatory                 | Name example of device eg. Brightness Sensor 3                                                                   |
| onlineTimeout | optional                  | Interval in seconds, how long a device appears (green) online in akenza after last sample eg. 86400 (= 24 hours) |
| deviceId      | mandatory                 | Provided from the device. 16 character hex string eg. 1234567890123456                                           |
| description   | optional                  | Free text field. eg. Brightness Sensor 3 on floor C                                                              |

**Bulk import template - HTTP, MQTT & CoAP:**

{% file src="/files/xeBy5mYXbBuH22Xtmbco" %}

### Additional values Custom Fields and Tags

**General field descriptions:**

| **Field**           | **mandatory or optional** | **Description**                                                                                                                                                                                |
| ------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tags                | optional                  | Tag name or id formatted as list separated with spaces                                                                                                                                         |
| {{CustomFieldName}} | optional                  | The custom field name or id is used as column name. The value has to be set based on custom field type. JSON example: `{"someKey":"someValue"}` GPS example: `{"latitude":90, "longitude":20}` |

**Bulk import template - custom fields and tags:**

{% file src="/files/j9fsgo0bfvUlcKQayukX" %}

Note that custom fields to be added using the bulk import need to exist in your workspace. There is a bulk import feature to [create custom fields](https://docs.akenza.io/pages/-MlEhwpEH6NIKG23tvAR#id-2.-adding-custom-fields-in-custom-fields-management-section).

Once the CSV file is uploaded, the file validation can be started. If the validation is successful, the import can start. All imported assets will be displayed now on the **Asset Inventory Overview**.

If you need further assistance, please contact us at <support@akenza.io>


# Rules

How rules apply business logic to incoming device data to send alerts, call external systems, and send downlinks.

**Rules** apply business logic to incoming device data. When a condition is met, a rule triggers an action, such as sending an alert, calling an external system, or sending a downlink to a device.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-da91661d72543f06b47d8e493742eeec8d98140c%2Frule-overview.png?alt=media" alt="A rule with a device input, a comparison logic block, and two actions"><figcaption><p>A rule linking an input, a logic block, and two actions</p></figcaption></figure>

## Common use cases

### Logic

<table><thead><tr><th width="230">Use case</th><th>Example</th></tr></thead><tbody><tr><td><strong>No-code business logic</strong></td><td>Compare a value to a threshold or to the last sample of another device with a <a href="https://docs.akenza.io/device-management/rule-engine/logic-blocks/rule-logic">Comparison</a> logic block, without writing code.</td></tr><tr><td><strong>Combine several inputs</strong></td><td>Sum the people counts of several occupancy sensors with a <a href="https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic">Custom Logic</a> block, and store the total on a separate device with the <a href="https://docs.akenza.io/device-management/rule-engine/rule-actions#akenza-db-action">akenza DB action</a>.</td></tr><tr><td><strong>Scheduled checks</strong></td><td>Run a rule every few minutes, every few hours, or at a fixed time with a <a href="https://docs.akenza.io/device-management/rule-engine/timed-rules">timer</a>, instead of on every new sample.</td></tr><tr><td><strong>Geofencing</strong></td><td>Trigger an action when a device enters or leaves a defined area with the Geofence logic block.</td></tr></tbody></table>

### Actions

<table><thead><tr><th width="230">Use case</th><th>Example</th></tr></thead><tbody><tr><td><strong>Alerts</strong></td><td>Notify users by <a href="https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/email">email</a>, <a href="https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/sms">SMS</a>, <a href="https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/microsoft-teams">Microsoft Teams</a>, or <a href="https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/slack">Slack</a> when a value crosses a threshold.</td></tr><tr><td><strong>Device commands</strong></td><td>Configure or control a device with a <a href="https://docs.akenza.io/device-management/rule-engine/rule-actions/downlink">downlink</a> when a condition is met.</td></tr><tr><td><strong>External systems</strong></td><td>Call a REST API with a <a href="https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/webhook">webhook</a>.</td></tr><tr><td><strong>Data management</strong></td><td>Store or forward data only when it matches certain business logic.</td></tr></tbody></table>

## How a rule works

A rule consists of three parts, which you link to each other in the rule editor:

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-microchip">:microchip:</i></td><td><strong>Input</strong></td><td>The devices, tags, or tag combinations whose data samples trigger the rule.</td><td><a href="https://docs.akenza.io/device-management/rule-engine/rule-input">Input</a></td></tr><tr><td><i class="fa-code-branch">:code-branch:</i></td><td><strong>Logic</strong></td><td>The condition applied to the data: a comparison, or a custom script.</td><td><a href="https://docs.akenza.io/device-management/rule-engine/logic-blocks">Logic blocks</a></td></tr><tr><td><i class="fa-bolt">:bolt:</i></td><td><strong>Action</strong></td><td>What happens when the condition is true.</td><td><a href="https://docs.akenza.io/device-management/rule-engine/rule-actions">Rule Actions</a></td></tr></tbody></table>

To link two parts, click the dot on one block. The possible destinations are shown, and a blue line connects the blocks once they are linked.

### Input

An input is a **device** that has sent a data sample to akenza. Each new sample triggers the logic the input is linked to. A rule can have several inputs.

You can also select a [**tag**](https://docs.akenza.io/device-management/managing-a-workspace/tags) as input. The rule then runs for every device with that tag. A **tag combination** selects the devices that match a logic expression of several tags.

### Logic

The logic defines the condition that is evaluated when the rule is triggered.

* The [**Comparison**](https://docs.akenza.io/device-management/rule-engine/logic-blocks/rule-logic) logic block compares device data to a constant value, to the last sample of the same device, or to the last sample of another device. You can add more data sources and conditions to extend it.
* A [**Custom Logic**](https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic) block runs a JavaScript script for logic that a comparison cannot express. Custom logic blocks are managed at organization level and are available in all workspaces.

### Action

An action runs when the logic evaluates to true. Rule actions use the same [output connectors](https://docs.akenza.io/device-management/your-data-flow/connectors) as data flows, plus [downlinks](https://docs.akenza.io/device-management/rule-engine/rule-actions/downlink). Once a rule is saved, its actions can be reused in other rules.

{% hint style="warning" %}
A **deactivated** rule is not triggered by new data.
{% endhint %}


# Input

The devices, tags, or tag combinations whose data samples trigger a rule.

The **input** of a rule defines which devices trigger its logic. Each time an input device sends a data sample to akenza, the linked logic block is evaluated with that sample.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-143cd2b684107c48a68838ef90d00b6d61e64fab%2Frule-input-types.png?alt=media" alt="The Select input type dialog with the options Device, Tag, and Tag combination"><figcaption><p>Selecting the input type</p></figcaption></figure>

A rule can have one or more inputs of three kinds:

<table><thead><tr><th width="200">Input</th><th>Triggers the rule for</th></tr></thead><tbody><tr><td><strong>Device</strong></td><td>One device. Any device can be selected, regardless of its connectivity.</td></tr><tr><td><strong>Tag</strong></td><td>Every device that has the <a href="https://docs.akenza.io/device-management/managing-a-workspace/tags">tag</a> assigned.</td></tr><tr><td><strong>Tag combination</strong></td><td>Every device that matches a logic expression of several tags.</td></tr></tbody></table>

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-5eeac44a8422212cc9d97e9bc5c2e35a62561a40%2Frule-input-devices.png?alt=media" alt="The rule input section with a device search field and a list of selected devices"><figcaption><p>Selecting the input devices of a rule</p></figcaption></figure>

Use the search field to find devices by name. A device can only be added once per rule, so devices that are already added cannot be selected again.

{% hint style="info" %}
All devices selected by a tag or tag combination should send data with the same schema. The logic block reads the same topic and data key from every device, so a device with a different schema cannot be evaluated.
{% endhint %}

{% hint style="warning" %}
[Timed rules](https://docs.akenza.io/device-management/rule-engine/timed-rules) only support devices as input. A rule with a tag or tag combination input is aborted when its timer triggers it.
{% endhint %}


# Logic blocks

The condition a rule evaluates when it is triggered.

A **logic block** defines the condition a rule evaluates each time it is triggered. When the condition is true, the rule runs the [actions](https://docs.akenza.io/device-management/rule-engine/rule-actions) linked to it.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-scale-balanced">:scale-balanced:</i></td><td><strong>Comparison</strong></td><td>Compare device data to a constant or to the last sample of a device. No code required.</td><td><a href="https://docs.akenza.io/device-management/rule-engine/logic-blocks/rule-logic">Comparison</a></td></tr><tr><td><i class="fa-code">:code:</i></td><td><strong>Custom Logic</strong></td><td>Run a JavaScript script for logic that a comparison cannot express, including stateful logic.</td><td><a href="https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic">Custom Logic</a></td></tr></tbody></table>

Start with a comparison. Use custom logic when the condition needs a calculation, or a state kept between runs.


# Comparison

Compare device data to a constant or to the last sample of a device.

The **Comparison** logic block compares values from device data samples. It needs no code and consists of two sections:

* **Data sources** define which values the block reads.
* **Conditions** define how those values are compared.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-844c3c0b5d2e1e30241bba6a179db30064c2f673%2Frule-logic-comparison.png?alt=media" alt="A comparison logic block with a data source and a condition comparing it to a constant value"><figcaption><p>A comparison logic block</p></figcaption></figure>

## Data sources

A data source selects a **topic** of the incoming data samples and the **data key** to read from them. Only samples with that topic trigger the block. Use `*` to match all topics.

If the data flow of the device has a [device type](https://docs.akenza.io/device-management/your-data-flow/device-type) with a schema, you can choose the data key from the schema. Otherwise, enter the topic and data key by hand.

A comparison needs at least one data source. Add more if the conditions need more values. The same device can be assigned to several data sources, one for each key you want to evaluate.

{% hint style="info" %}
To find the topic and data key of a sample, open the **Message Logs** on the [device detail view](https://docs.akenza.io/device-management/create-new-device/devices).
{% endhint %}

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-cd1783ff36589d5081ee99a94b1ebb81acf47be6%2Frule-logic-message-logs.png?alt=media" alt="The message logs of a device showing the topic and the data keys of a sample"><figcaption><p>Topic and data keys in the message logs</p></figcaption></figure>

## Conditions

A condition compares a data source, with a comparison operator, to either:

* a **constant number**, or
* the **latest sample** of another data source.

Click the blue text to switch between `is` and `is not`. Use the **plus** button to nest another comparison inside a condition.

Conditions are independent of each other. Each condition that evaluates to true triggers the actions linked to it.

{% hint style="info" %}
If a comparison is not enough, use a [Custom Logic](https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic) block.
{% endhint %}


# Custom Logic

Evaluate rule logic with a JavaScript script.

A **Custom Logic** block runs a JavaScript script each time a rule is triggered. Use it for logic that a [comparison](https://docs.akenza.io/device-management/rule-engine/logic-blocks/rule-logic) cannot express. Scripts can be stateless, or keep a [state](https://docs.akenza.io/reference/scripting/stateful-operations) between runs.

Custom logic blocks are created at organization level. They are available in all workspaces and can be selected when you create a rule.

A custom logic block consists of:

<table><thead><tr><th width="160">Part</th><th>What it is</th></tr></thead><tbody><tr><td><a href="#inputs"><strong>Inputs</strong></a></td><td>The device data the script evaluates, such as a sensor value.</td></tr><tr><td><a href="#parameters"><strong>Parameters</strong></a></td><td>Constant values, such as thresholds, set when the block is used in a rule.</td></tr><tr><td><a href="https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic/logic-block-scripting"><strong>Script</strong></a></td><td>The logic that runs and emits actions.</td></tr></tbody></table>

{% hint style="info" %}
Inputs and parameters cannot be edited while the block is used in an **active** rule.
{% endhint %}

## Inputs

Inputs define the data sources of the block. They hold the dynamic data of a device. A block needs at least one input.

<table><thead><tr><th width="230">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Display name</strong></td><td>The name of the input.</td></tr><tr><td><strong>Description</strong></td><td>An optional description.</td></tr><tr><td><strong>Variable name</strong></td><td>The name used to access the value in the script, as <code>event.inputs.&#x3C;name></code>.</td></tr><tr><td><strong>Default topic</strong></td><td>An optional topic that is preselected when the block is used.</td></tr><tr><td><strong>Default data key</strong></td><td>An optional data key that is preselected when the block is used.</td></tr></tbody></table>

## Parameters

Parameters are static values available while the script runs.

<table><thead><tr><th width="230">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Display name</strong></td><td>The name of the parameter.</td></tr><tr><td><strong>Variable name</strong></td><td>The name used to access the value in the script, as <code>event.properties.&#x3C;name></code>.</td></tr><tr><td><strong>Type</strong></td><td>Numerical, String, or Boolean.</td></tr><tr><td><strong>Default value</strong></td><td>The value used unless the rule sets another one.</td></tr></tbody></table>

## Script

{% content-ref url="/pages/DGfTlO2tnmhTAEX595bu" %}
[Logic Block Scripting](https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic/logic-block-scripting)
{% endcontent-ref %}

## Examples

The example repository contains ready-made logic blocks:

{% embed url="<https://github.com/akenza-io/akenza-logic-block-examples>" %}

This webinar shows how to create a custom rule:

{% embed url="<https://www.youtube.com/watch?t=4s&v=weoSqm7Ugao>" %}
Webinar about how to create custom rules
{% endembed %}


# Logic Block Scripting

How to write the script of a Custom Logic block.

The script of a [Custom Logic](https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic) block defines the logic that is evaluated each time the rule runs.

{% hint style="info" %}
For general scripting concepts, see [Scripting](https://docs.akenza.io/reference/scripting).
{% endhint %}

## Script structure

The script defines a `consume` function. It is called with the [event object](#event-object) and emits an action when the condition is met:

```javascript
function consume(event) {
  var temperature = event.inputs.temperature;
  var threshold = event.properties.tempThreshold;

  if (temperature < threshold) {
    emit("action", {
      message: `it is too cold: the temperature is ${temperature}°C`,
    });
  }
}
```

Once the block is saved, it can be selected as a logic block when creating a rule. In the rule:

1. Link each input to an input device or tag.
2. Set the parameters.
3. Add one or more actions. Access the emitted values with `{{result.*}}`, for example `{{result.message}}` for the script above.

To share data between runs of a rule, see [Stateful Operations](https://docs.akenza.io/reference/scripting/stateful-operations).

## Event object

The `consume` function receives the event object with these properties:

<table><thead><tr><th width="180">Property</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>inputs</code></td><td>object</td><td>The values of the inputs, by variable name.</td></tr><tr><td><code>properties</code></td><td>object</td><td>The parameters of the block, by variable name.</td></tr><tr><td><code>state</code></td><td>object</td><td>The rule state set by the script.</td></tr><tr><td><code>type</code></td><td>string</td><td>How the rule was invoked: <code>uplink</code> or <code>timer</code>.</td></tr><tr><td><code>dataSources</code></td><td>object</td><td>The data sources of the rule. See <a href="#data-source-properties">Data source properties</a>.</td></tr><tr><td><code>device</code></td><td>object</td><td>The device that triggered the rule. See <a href="#device-properties">Device properties</a>.</td></tr><tr><td><code>timer</code></td><td>object</td><td>Only for timer runs. Contains the <code>meta</code> of an <a href="#emitting-a-timer">emitted timer</a>.</td></tr></tbody></table>

If `type` is `timer`, there is no triggering sample:

* the values in `inputs` are `null`,
* `dataSources` is an empty object,
* `device` is undefined.

### Device properties

Access device properties with the `device.` prefix, for example `device.name`.

<table><thead><tr><th width="180">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>The akenza device ID.</td></tr><tr><td><code>deviceId</code></td><td>The unique device ID, such as the DevEUI.</td></tr><tr><td><code>name</code></td><td>The device name.</td></tr><tr><td><code>description</code></td><td>The device description.</td></tr><tr><td><code>connectivity</code></td><td>The connectivity of the device.</td></tr><tr><td><code>integrationId</code></td><td>The integration ID. Only for LoRaWAN devices.</td></tr><tr><td><code>workspaceId</code></td><td>The ID of the workspace.</td></tr><tr><td><code>dataFlowId</code></td><td>The ID of the data flow.</td></tr></tbody></table>

### Data source properties

Access a data source with `dataSources.X.`, where `X` is the number of the data source in the rule, starting at 1. For example, `dataSources.1.data.temperature`.

<table><thead><tr><th width="180">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>correlationId</code></td><td>The correlation ID. Only set if this data source triggered the rule.</td></tr><tr><td><code>device</code></td><td>The complete device object. See <a href="#device-properties">Device properties</a>.</td></tr><tr><td><code>deviceId</code></td><td>The unique device ID.</td></tr><tr><td><code>akenzaDeviceId</code></td><td>The akenza device ID.</td></tr><tr><td><code>topic</code></td><td>The topic of the sample.</td></tr><tr><td><code>timestamp</code></td><td>The timestamp of the sample.</td></tr><tr><td><code>data.*</code></td><td>The values of the sample.</td></tr><tr><td><code>meta.*</code></td><td>The values of the meta object.</td></tr><tr><td><code>uplinkMeta</code></td><td>The uplink meta object. See <a href="#uplink-meta-properties">Uplink meta properties</a>.</td></tr><tr><td><code>trigger</code></td><td><code>true</code> if this data source triggered the rule.</td></tr><tr><td><code>deviceInput</code></td><td><code>true</code> if the input is a device.</td></tr><tr><td><code>tagInput</code></td><td><code>true</code> if the input is a tag.</td></tr><tr><td><code>tagCombinationInput</code></td><td><code>true</code> if the input is a tag combination.</td></tr></tbody></table>

The sample values (`correlationId`, `topic`, `timestamp`, `data`, `meta`, and `uplinkMeta`) come from the triggering uplink if `trigger` is `true`. Otherwise, they come from the most recent stored sample.

Some properties, such as `correlationId` or `device`, can be `null`, for example when the rule was triggered by a timer or the data source reads the last sample.

### Uplink meta properties

Access uplink meta properties with the `uplinkMeta.` prefix. Timestamps are in ISO 8601 format, and durations are ISO 8601 durations.

<table><thead><tr><th width="220">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>dataReceived</code></td><td>When the data was received.</td></tr><tr><td><code>bytesReceived</code></td><td>The number of bytes in the uplink request.</td></tr><tr><td><code>processingStart</code></td><td>When processing started.</td></tr><tr><td><code>scriptRunUplinkStart</code></td><td>When the script run started.</td></tr><tr><td><code>scriptRunUplinkEnd</code></td><td>When the script run ended.</td></tr><tr><td><code>processingEnd</code></td><td>When processing ended.</td></tr><tr><td><code>outputProduced</code></td><td>When all outputs were produced.</td></tr><tr><td><code>uplinkDuration</code></td><td>The duration of the whole uplink flow.</td></tr><tr><td><code>processingDuration</code></td><td>The duration of processing.</td></tr><tr><td><code>scriptRunningDuration</code></td><td>The duration of the script run.</td></tr></tbody></table>

## Emitting actions

Emit an action to run the rule actions linked to the block:

```javascript
if (currentTemperature > threshold) {
  emit("action", {
    message: `temperature (${currentTemperature} °C) is above threshold (${threshold} °C)`,
  });
}
```

### Re-invoking the rule engine

If the [akenza DB action](https://docs.akenza.io/device-management/rule-engine/rule-actions#akenza-db-action) has **Invoke Rule engine** enabled, its stored message is evaluated by the rules again. This applies another rule to the output of the block.

In this case, the emitted action needs the same structure as a sample emitted by a device type script: `topic`, `data`, and optionally `timestamp`. See [Emit Function](https://docs.akenza.io/reference/scripting#emit-function).

```javascript
if (currentTemperature > threshold) {
  emit("action", {
    topic: "alert",
    data: {
      temperature: currentTemperature,
      threshold,
      message: `temperature (${currentTemperature} °C) is above threshold (${threshold} °C)`,
    },
  });
}
```

A `topic` in the emitted action overrides the topic set in the akenza DB rule action.

To also send the message to the outputs of the target device, see [Invoke target data flow](https://docs.akenza.io/device-management/rule-engine/rule-actions#invoke-target-data-flow).

### Custom payload templates

In a [custom payload template](https://docs.akenza.io/reference/message-templating), use `{{result.*}}` to access the emitted values. For example, use `{{result.data}}` to store only the data of an action that re-invokes the rule engine. Without it, the whole result is stored as the sample, so `topic`, `timestamp`, `data`, and `meta` all end up in the data object.

#### Mustache templating

If you would like format data as a list inside an email or sms-output you can implement the following structure.\
`{{#result.data.messages}}`\
`{{paragraph}}`\
`{{/result.data.messages}}`

Example Code:

```javascript
let messages = [];
for (const [key, value] of Object.entries(ruleState.devices)) {
  if (value.present === true) {
    messages.push({ paragraph: value.name });
  }
}

if (messages.length > 0) {
  emit("action", { data: { messages } });
}
```

## Emitting a timer

Emit a timer to run the rule again at a later time:

```javascript
function consume(event) {
  // run again tomorrow at midnight
  const runAt = new Date();
  runAt.setDate(runAt.getDate() + 1);
  runAt.setHours(0, 0, 0, 0);

  emit("timer", { runAt, meta: { foo: "bar" } });
}
```

<table><thead><tr><th width="120">Parameter</th><th width="120">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>runAt</code></td><td>Yes</td><td>A date at least 15 seconds in the future.</td></tr><tr><td><code>meta</code></td><td>No</td><td>An object with any values.</td></tr></tbody></table>

When the timer runs the rule, `meta` is available as `event.timer.meta`. Use it to pass information to the next run, or to tell several timers apart.

## Event examples

The `state` in these examples is set by the script. See [Stateful Operations](https://docs.akenza.io/reference/scripting/stateful-operations).

<details>

<summary>Uplink event</summary>

A decoded uplink that triggers a custom logic block:

```json
{
  "inputs": {
    "occupied": false
  },
  "state": {
    "devices": {
      "00000000000000ff": {
        "lastOccupiedTimestamp": 1716553293784,
        "currentlyOccupied": false,
        "lastMessageTimestamp": 1716553385376,
        "sent": true
      }
    }
  },
  "type": "uplink",
  "dataSources": {
    "1": {
      "correlationId": "77777777-7777-7777-7777-77777777",
      "device": {
        "connectivity": "LORA",
        "customFields": {
          "FloorNumber": 1,
          "SiteId": "ZURICH",
          "IsWarmDeskEnabled": "true",
          "SpaceId": "1OGR35"
        },
        "name": "Meeting Room R35",
        "description": "",
        "id": "00000000000000ff",
        "deviceId": "1234567891012131",
        "workspaceId": "2900000000000000",
        "tags": ["occupancy", "climate"]
      },
      "deviceId": "1234567891012131",
      "akenzaDeviceId": "00000000000000ff",
      "topic": "occupancy",
      "timestamp": "2024-05-24T12:38:06.122Z",
      "data": {
        "occupied": false,
        "motionCount": 0
      },
      "trigger": true,
      "deviceInput": false,
      "tagInput": true,
      "tagCombinationInput": false,
      "triggerOnUplink": true,
      "lastSample": false
    }
  },
  "device": {
    "connectivity": "LORA",
    "customFields": {
      "FloorNumber": 1,
      "SiteId": "ZURICH",
      "SpaceId": "1OGR35"
    },
    "name": "Meeting Room R35",
    "description": "",
    "id": "00000000000000ff",
    "deviceId": "1234567891012131",
    "workspaceId": "2900000000000000",
    "tags": ["occupancy", "climate"]
  },
  "numberOfInvocations": 0,
  "properties": {}
}
```

</details>

<details>

<summary>Timer event</summary>

A run triggered by a timer that the script emitted with a `meta` object:

```json
{
  "inputs": {
    "occupied": null
  },
  "state": {
    "devices": {
      "00000000000fffff": {
        "lastOccupiedTimestamp": 1716553293784,
        "currentlyOccupied": false,
        "lastMessageTimestamp": 1716560583110,
        "sent": false
      }
    }
  },
  "type": "timer",
  "dataSources": {},
  "numberOfInvocations": 0,
  "properties": {},
  "timer": {
    "meta": {
      "id": "00000000000fffff",
      "alarmId": 1,
      "value": 1500
    }
  }
}
```

</details>

<details>

<summary>Timer event with last sample</summary>

A run triggered by a timer where the data source reads the last sample of its device:

```json
{
  "inputs": {
    "temperature": 23.84
  },
  "state": {},
  "type": "timer",
  "dataSources": {
    "1": {
      "correlationId": "77777777-7777-7777-7777-777777777777",
      "device": {
        "connectivity": "LORA",
        "customFields": {},
        "name": "Watteco Senso",
        "description": null,
        "id": "1998877667788991",
        "deviceId": "000000000000ffff",
        "workspaceId": "2929292929292929",
        "tags": []
      },
      "deviceId": "000000000000ffff",
      "akenzaDeviceId": "1998877667788991",
      "topic": "default",
      "timestamp": "2024-05-24T13:20:14.869Z",
      "data": {
        "temperature": 23.84,
        "humidity": 51.3,
        "voc": 553,
        "co2": 518
      },
      "meta": null,
      "uplinkMeta": {
        "dataReceived": "2024-05-24T13:20:14.150224453Z",
        "bytesReceived": 952,
        "processingStart": "2024-05-24T13:20:14.220414139Z",
        "scriptRunUplinkStart": null,
        "scriptRunUplinkEnd": null,
        "processingEnd": "2024-05-24T13:20:14.259641209Z",
        "outputProduced": null,
        "ruleResolutionStart": "2024-05-24T13:20:14.805071863Z",
        "ruleResolutionEnd": null,
        "ruleExecutionStart": null,
        "ruleExecutionEnd": null,
        "uplinkDuration": "PT0S",
        "processingDuration": "PT0.03922707S",
        "ruleResolutionDuration": "PT0S",
        "ruleExecutionDuration": "PT0S",
        "scriptRunningDuration": "PT0S"
      },
      "trigger": false,
      "deviceInput": true,
      "tagInput": false,
      "tagCombinationInput": false,
      "triggerOnUplink": false,
      "lastSample": true
    }
  },
  "numberOfInvocations": 0,
  "properties": {}
}
```

</details>


# Geofence

{% hint style="info" %}
Work in progress
{% endhint %}


# Timed Rules

Run a rule on a fixed schedule instead of on every new data sample.

A **timer** runs a rule on a fixed schedule. The rule logic is then evaluated at set times, in addition to when new data arrives.

To add a timer, click **Add timer** at the bottom of the rule detail view.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-0ed7c77d09acd5d396a22dad939ddb85e94afe65%2Ftimed-rules-add-timer.png?alt=media" alt="The Add timer button at the bottom of the rule detail view"><figcaption><p>Adding a timer to a rule</p></figcaption></figure>

{% hint style="warning" %}
Timed rules only support devices as [input](https://docs.akenza.io/device-management/rule-engine/rule-input). A rule with a tag or tag combination input is aborted when its timer triggers it.
{% endhint %}

## Timer modes

The timer configuration offers three modes:

{% tabs %}
{% tab title="Interval" %}
Runs the rule every few minutes, hours, or days. The next run is always the next upcoming interval.

<table><thead><tr><th width="140">Interval</th><th>Aligned to</th><th>Example</th></tr></thead><tbody><tr><td><strong>Minutes</strong></td><td>The hour</td><td>A 10 minute interval runs at XX:00, XX:10, XX:20, and so on.</td></tr><tr><td><strong>Hours</strong></td><td>The day</td><td>A 6 hour interval runs at 00:00, 06:00, 12:00, and 18:00.</td></tr><tr><td><strong>Days</strong></td><td>Midnight UTC</td><td>Runs every day at 00:00 UTC.</td></tr></tbody></table>
{% endtab %}

{% tab title="Fixed" %}
Runs the rule every day at the selected time, starting on the day after the selected start date.
{% endtab %}

{% tab title="Advanced" %}
Runs the rule on a [Quartz cron expression](https://www.freeformatter.com/cron-expression-generator-quartz.html) in UTC. Use it for schedules the other modes cannot express.
{% endtab %}
{% endtabs %}

## Output templating

A timer is not a device, so a timed run has no current data sample. The `{{data.*}}` property and all other properties of the current sample are not available in the [payload templates](https://docs.akenza.io/reference/message-templating) of the rule actions.

Use `{{dataSources.X.*}}` instead. Data sources always resolve to the latest stored sample of their device. A data source whose device has not stored any data yet is not resolved.

See [Data Source Properties](https://docs.akenza.io/reference/message-templating#data-source-properties) for all available properties.


# Rule Actions

What a rule does when its condition is true.

An **action** runs when the [logic block](https://docs.akenza.io/device-management/rule-engine/logic-blocks) it is linked to evaluates to true. A rule can have several actions, and a saved action can be reused in other rules.

Rule actions use the same output connectors as [data flows](https://docs.akenza.io/device-management/your-data-flow), plus downlinks:

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-bell">:bell:</i></td><td><strong>Notifications</strong></td><td>Alert users by email, SMS, Microsoft Teams, or Slack.</td><td><a href="https://docs.akenza.io/device-management/your-data-flow/connectors/notifications">Notifications</a></td></tr><tr><td><i class="fa-arrow-right-arrow-left">:arrow-right-arrow-left:</i></td><td><strong>Streaming</strong></td><td>Forward data to a webhook, a message broker, or a cloud service.</td><td><a href="https://docs.akenza.io/device-management/your-data-flow/connectors/streaming">Streaming</a></td></tr><tr><td><i class="fa-database">:database:</i></td><td><strong>Databases</strong></td><td>Store data in the akenza DB or an external database.</td><td><a href="https://docs.akenza.io/device-management/your-data-flow/connectors/databases">Databases</a></td></tr><tr><td><i class="fa-tower-broadcast">:tower-broadcast:</i></td><td><strong>Downlink</strong></td><td>Send a command or configuration to a device.</td><td><a href="https://docs.akenza.io/device-management/rule-engine/rule-actions/downlink">Downlink</a></td></tr></tbody></table>

The content an action sends can be customized with [payload templating](https://docs.akenza.io/reference/message-templating), for example to include the value that triggered the rule.

## akenza DB action

The **akenza DB** action of a rule stores the rule result as a message on a device. It has two options that pass the result on, which are only available on this action.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2b91a9672f05113a57096b2156172295db2fcd06%2Frule-action-akenza-db.png?alt=media" alt="The akenza DB rule action with connector name, topic, the Invoke Rule engine and Invoke target data flow toggles, the target device options, and the custom payload toggle"><figcaption><p>The akenza DB rule action</p></figcaption></figure>

<table><thead><tr><th width="220">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Topic</strong></td><td>The topic of the stored message.</td></tr><tr><td><strong>Invoke Rule engine</strong></td><td>Evaluate the rules again with the stored message. See <a href="#invoke-rule-engine">below</a>.</td></tr><tr><td><strong>Invoke target data flow</strong></td><td>Also send the stored message to the outputs of the target device's data flow. See <a href="#invoke-target-data-flow">below</a>.</td></tr><tr><td><strong>Target device</strong></td><td>The device the message is stored on: <strong>Input device</strong>, the device that triggered the rule, <strong>Select device</strong>, a device you choose, or <strong>Dynamic</strong>.</td></tr><tr><td><strong>Use custom payload</strong></td><td>Store a <a href="https://docs.akenza.io/reference/message-templating">payload template</a> instead of the rule result.</td></tr></tbody></table>

### Invoke Rule engine

When enabled, the stored message is evaluated by the rules again, so another rule can be applied to the result of this one.

If the result comes from a [Custom Logic](https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic) block, the emitted action needs the structure of a sample. See [Re-invoking the rule engine](https://docs.akenza.io/device-management/rule-engine/logic-blocks/custom-logic/logic-block-scripting#re-invoking-the-rule-engine).

The rule engine can be invoked at most 3 times in a row.

### Invoke target data flow

When enabled, the message stored on the target device is also sent to the outputs of that device's data flow, such as Kafka, a webhook, or an email. Use it to pass a rule result on through the integrations of the target device.

The option is only available when:

* **Invoke Rule engine** is enabled, and
* the target device is set to **Select device** or **Dynamic**.

It is not available with **Input device**, because the triggering message would be sent to the outputs twice.

The same limit of 3 consecutive invocations applies. After the third, the outputs of the target device are not invoked either.

{% hint style="info" %}
The outputs of the target device receive the rule result, not the custom payload. The custom payload only applies to the message stored on the device.
{% endhint %}


# Downlink

Send a downlink to one or more devices when a rule condition is true.

A **downlink** action sends a command or configuration to devices when a rule condition is true. For example, close the blinds when the temperature exceeds a threshold.

Select one or more devices that use the same [data flow](https://docs.akenza.io/device-management/your-data-flow) as targets.

{% hint style="info" %}
Downlinks are supported for **LoRaWAN**, **MQTT**, and **CoAP** devices. HTTP devices cannot receive downlinks.
{% endhint %}

## Downlink fields

{% tabs %}
{% tab title="LoRaWAN" %}

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-ce2af181c3e47b450777f6fd6aff4d490cbf06ad%2Frule-action-downlink-lorawan.png?alt=media" alt="A downlink action with port, confirmed flag, and payload fields"><figcaption><p>A LoRaWAN downlink action</p></figcaption></figure>

<table><thead><tr><th width="160">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Port</strong></td><td>An integer.</td></tr><tr><td><strong>Confirmed</strong></td><td>Whether the device has to confirm the downlink.</td></tr><tr><td><strong>Payload</strong></td><td>A hex string. A JSON object is also accepted if the <a href="https://docs.akenza.io/device-management/your-data-flow/device-type">device type</a> has a downlink encoder.</td></tr></tbody></table>
{% endtab %}

{% tab title="MQTT" %}

<table><thead><tr><th width="160">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Topic</strong></td><td>Optional. Appended to the downlink topic of the device. For example, <code>myTopic</code> publishes to <code>/down/&#x3C;secret>/id/&#x3C;deviceID>/myTopic</code>.</td></tr><tr><td><strong>Payload</strong></td><td>A JSON object.</td></tr></tbody></table>

The payload can use [payload templating](https://docs.akenza.io/reference/message-templating) to include data from the rule:

```json
{
  "key": "{{data.temperature}}"
}
```

{% endtab %}

{% tab title="CoAP" %}

<table><thead><tr><th width="200">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Raw</strong> or <strong>Encoder</strong></td><td>With <strong>Raw</strong>, the payload is sent to the device as entered and the encoder of the <a href="https://docs.akenza.io/device-management/your-data-flow/device-type">device type</a> is bypassed. With <strong>Encoder</strong>, the device type encoder converts the payload first.</td></tr><tr><td><strong>Payload</strong></td><td>A JSON object.</td></tr><tr><td><strong>Confirmed downlink</strong></td><td>The device confirms delivery with a CoAP acknowledgment. Without it, the device has to confirm the command in a later uplink.</td></tr><tr><td><strong>Clear queue</strong></td><td>Removes all pending commands of the device before this one is queued. When off, the command is added to the end of the queue.</td></tr></tbody></table>

CoAP downlinks are queued. The device fetches pending commands when it wakes up, one command per request, and only over DTLS. See [CoAP downlinks](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap#downlinks) for the delivery details.
{% endtab %}
{% endtabs %}


# Data Flows

This page describes the basic functionality and principles of data flows

**Data Flows** define how the device data is processed and stored in akenza.

There are three basic components that all together form the **Data Flow:**

* Device Connectors
* Device Types
* Output Connectors

### Device Connectors

Device connectors hold the information on how a device communicates with akenza. They define the secret, which is used to authenticate the received data of a device.

If an **Integration** is available, a device connector has already been created during the setup of an integration. The connectivity provider platform also has been configured to correctly send the data to akenza.

{% content-ref url="/pages/-MQI9E7aPT1CHWVEN5qe" %}
[Device Connectors](https://docs.akenza.io/device-management/your-data-flow/device-connector)
{% endcontent-ref %}

### Device Types

Device types define how the received uplink is structured, parsed, and finally stored in the akenza database. A variety of predefined **Device Types** are available.\
A **Custom Device Type** can be created, if not the right device type is available for the desired device.

{% content-ref url="/pages/-MQI9SygRqYDEMCJEXAm" %}
[Device Types](https://docs.akenza.io/device-management/your-data-flow/device-type)
{% endcontent-ref %}

### Output Connectors

Output connectors define the behavior after the device type has parsed the uplink payload. There are a variety of predefined actions that can be chosen from.\
Webhooks can be used to communicate with 3rd party **REST APIs**.

{% content-ref url="/pages/-MQICL3-1RzGgsAcos2h" %}
[Output Connectors](https://docs.akenza.io/device-management/your-data-flow/connectors)
{% endcontent-ref %}

![Data Flow](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-68305c2628e793008e17396b9b950be54e42b6e9%2Fdata-flow-overview.png?alt=media)


# Device Connectors

This page describes Device Connectors in more detail

Device connectors define the protocol and authorization the device communicates with akenza. The authorization secret can only be viewed for **HTTP,** **MQTT & CoAP** connectors after they have been selected.

![Device connector](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-c60d936a0ee9fe1ad25e5ae07e2036e297b337a1%2Fdata-flow-device-connector.png?alt=media)


# Device Security

This page describes the device security features available in akenza.

Securing devices is one of the main concerns when rolling out an IoT deployment and requires careful consideration in order to minimize the attack surface.

akenza supports the following authentication schemes per connectivity:

| Authentication scheme                                                                                                                     | Scope                 | HTTP | MQTT | CoAP |
| ----------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | :--: | :--: | :--: |
| [Device credentials with JWTs](#device-credentials-with-jwts)                                                                             | Per device            |      |   ✓  |      |
| [Shared Access Signature (SAS) tokens](#shared-access-signatures)                                                                         | Per device or gateway |   ✓  |      |      |
| [DTLS client certificates](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/dtls-device-client-certificates) | Per device            |      |      |   ✓  |
| [DTLS pre-shared keys](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/dtls-pre-shared-keys)                | Per device            |      |      |   ✓  |
| [Uplink secret](#uplink-secret)                                                                                                           | Per device connector  |   ✓  |   ✓  |   ✓  |

{% hint style="info" %}
Missing an authentication scheme for your connectivity? Contact us at <support@akenza.io>.
{% endhint %}

## Device Credentials with JWTs

This authentication method is based on public/private key authentication using JSON Web Tokens and limits the attack surface because a compromised key only affects a single device and not the whole fleet. As JWTs define an expiration, any compromised key will only be valid for a limited duration.

Currently, this authentication method is only available for MQTT devices.

### Device provisioning process

The "provisioner" (typically the hardware manufacturer) is required to create a public/private key pair that is distributed to the device during the provisioning process.

1. Create a new key pair (public/private key)
2. Distribute the key to the device and securely store it
3. Upload the public key to akenza (see [here](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials/using-json-web-tokens-jwts))
4. Authenticate with a JSON Web token that is signed by the private key, while establishing an MQTT connection
5. Start sending telemetry and receiving commands

Notably, the key can be stored on the device before the device has been created in akenza.

### Security Standards

akenza provides support for both RSA and Elliptic Curve signed tokens.

#### Algorithms

The following algorithms are supported:

* JWT `RS256` (RSASSA-PKCS1-v1\_5 using SHA-256 [RFC 7518 sec 3.3](https://tools.ietf.org/html/rfc7518#section-3.3))
* JWT `ES256` (ECDSA using P-256 and SHA-256 [RFC 7518 sec 3.4](https://tools.ietf.org/html/rfc7518#section-3.4)), defined in OpenSSL as the prime256v1 curve

The RSA algorithm has a wider adoption, however keys and signatures tend to be large (\~1-2 kB) and the algorithm has higher resource requirements (key length and CPU).

The Elliptic Curve algorithm is well supported but not as widely used as RSA. The generated keys and signatures are significantly smaller compared to RSA, which can be useful for devices with constrained resources.

#### Key Strength <a href="#key_strength" id="key_strength"></a>

A minimum of 112 bits of security is required by akenza (also refer to the [NIST recommendations](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r4.pdf), section 5.6.2, pages 55-56). This translates to a minimum 2048-bit key size for RS256.

ES256 has a preset level of 128 bits of security (the key size is fixed).

#### Public Key Format

The following key formats are supported in akenza

* **RSA PEM:** An RSA public key encoded in base64.
* **RSA X509 PEM:** An RSA PEM key, encoded in base64, wrapped in an X.509 certificate.
* **ES256 PEM:** A public key for the ECDSA algorithm (using P-256 and SHA-256), encoded in base64.
* **ES256 X509 PEM:** An ES256 PEM key, encoded in base64, wrapped in a X.509 certificate.

### Key rotation

akenza supports multiple active keys (up to 3 per device) to allow for uninterrupted rotation. If more than one key is in use, the JWT must include the fingerprint of the key used to sign the JWT (kid claim).

### Generating and Signing JWTs

The JWT needs to be generated with the following reserved claim fields and signed using the private key. Refer to our [Tutorials](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials) for practical examples on how to generate private/public keys and sign a JWT.

**Required JWT contents:**

* `kid` must be the fingerprint of a public key or certificate associated with the device. The kid is optional if there’s only one public key or certificate associated with a device
* `alg` required, contains the appropriate signing algorithm based on signature
* `aud` required, must be in the following format: `https://akenza.io/devices/{deviceId}`(for enterprise deployments the base url of the deployment needs to be used instead of akenza.io)
* `exp` required, a valid date in the future. A 10-minute clock-skew allowance applies.
* `iat` optional, a valid date in the past. A 10-minute clock-skew allowance applies.

The expiration (`exp`) and issued at (`iat`) claims are relevant to check whether the JWT is valid during uplink processing. In no cases should the device use an (almost) never expiring JWT, as it could be used to send unauthorized data.

Other claims (standard and custom ones) can be set, but will have no impact on the uplink processing.

#### MQTT

uplink topic: `/up/device/id/{deviceId}`

downlink topic: `/down/device/id/{deviceId}`

The MQTT authentication needs to include the following properties:

* `username` arbitrary username (not used). depending on framework this needs to be set in order for the password to be sent as well
* `password` must be a valid JWT signed with the private key
* `clientId` must be the deviceId

#### HTTP

Not supported yet.

#### CoAP

Not supported yet.

### Best Practices

* Keep the private key secret
* Use TLS 1.2 when communicating on ports 8883
  * Verify that the server certificate
  * Perform regular security-related firmware updates to keep server certificates up-to-date
* Each device should have a unique public/private key pair

## Shared Access Signatures

SAS tokens are an authentication mechanism for HTTP device connectors that allow generating a unique time-bound authentication token for each device. When creating the device connector a signing key is generated that can then be used to create a Shared Access Signature Token (SAS) for a specific device or on device-connector level (e.g. for edge gateways with multiple devices). You can either do so yourself during provisioning or you can use the akenza device management UI to generate a token (device detail page).

While providing a great balance between security and ease-of-use, this authentication scheme has the drawback that token revocation is not easily possible and can only be done by rotating the signing key for a device connector or by temporarily suspending a device. Therefore it is suggested to set a limited expiration based on your device management lifecycle.

**Device provisioning process (customer):**

* Generate a new token for a device by signing its resource URI and specifying an expiration
* Distribute the token to the device and securely store it
* Authenticate with the token (signature) when sending an HTTP uplink

**Verification process during uplinks (akenza):**

* Verify that the signature was signed by a valid signing key
* Verify that the signature includes the target device
* Verify the expiration

### Security Standards

akenza provides support for HMAC SHA256 signatures with a 256-bit key length.

### Generating SAS Tokens

SAS tokens can be generated in the akenza device management on a device connector level (all devices using the connector can use the token - e.g. for a gateway) or a device-level.

Refer to our [Tutorials](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials) for practical code examples on how to generate SAS tokens.

**Token format**

The shared access signature should have the following format `base64(sig={signature-string}&exp={expiry}&aud={resourceURI})`

* sig: An HMAC-SHA256 signature string of the form: `"deviceConnectorId=<deviceConnectorId>" + "\n" + "deviceId=<physicalDeviceId>" + "\n" + expiry=<expiry>`. The signing key is used to perform the HMAC-SHA256 computation.
* expiry: UTF8 string for the number of seconds since the epoch 00:00:00 UTC on 1 January 1970.
* resourceURI: SAS tokens granted to edge gateways are scoped to the device connector level; for example, `https://akenza.io/device-connectors/{deviceConnectorId}`. SAS tokens granted to devices must be scoped to an individual device; for example, `https://akenza.io/device-connectors/{deviceConnectorId}/devices/{physicalDeviceId}`
* aud: Lower case URL-encoding of the lower case resourceURI

### Key rotation

akenza supports two signing keys (primary and secondary) to allow for uninterrupted rotation. Both keys can be used to generate a valid signature token.

### Using SAS Tokens

#### HTTP

When using HTTPS the SAS token should be sent as the `x-access-signature` request header:

URL: `/v3/capture?deviceId={deviceId}&topic=default&...`

Query Parameters:

* `deviceId` - the physical device ID (only required for a device connector token, otherwise it is directly inferred from the token)
* `sasToken` (optional) - alternative way of providing the shared access signature token

HTTP headers:

* `x-access-signature` - the shared access signature token used for authenticating requests (recommended)
* `x-device-id` - the physical device ID (only required for a device connector token)

#### MQTT

Not supported yet.

#### CoAP

Not supported yet.

### Best Practices

* Protect the signing keys and store them safely
* Limit the token expiration
* Each device should use its own token

## Uplink secret

This form of authentication is the easiest. It is most commonly used for HTTP-based integrations.

When a data flow is created, the device connector specifies the secret to use as password when making an uplink.

Authenticating an uplink with basic auth requires the device connector id and the uplink secret. If the device connector is assigned, via data flow, to the device and the uplink secret matches, the uplink request is authenticated.

#### HTTP

URL: `/v3/capture?deviceId={deviceId}&topic=default&...`

Query Parameters:

* `secret` - it is recommended to use the `x-uplink-secret` HTTP header instead
* `deviceId` - the physical device ID

HTTP headers:

* `x-uplink-secret` - the uplink secret of the device connector used for authenticating requests
* `x-device-id` - the physical device ID

{% hint style="info" %}
The uplink secret should, if possible, be sent as an HTTP header as it doesn’t expose the uplink-secret in the URL. For devices that do not support that, it can also be sent as a query-param named `secret`.
{% endhint %}

**MQTT**

uplink topic: `/up/{uplinkSecret}/id/{deviceId}`

downlink topic: `/down/{uplinkSecret}/id/{deviceId}`

The MQTT authentication needs to include the following properties:

* `username` must be the device connector id
* `password` must be the uplink secret
* `clientId` can be anything/left blank

#### CoAP

url: `udp://{host}:{port}?deviceId={deviceId}&secret={secret}&topic={topic}&...`


# Using Device Credentials

This page provides examples on how to generate credentials for MQTT devices

{% content-ref url="/pages/ZGdaAipiaavj93IerWwt" %}
[Creating Public/Private Key Pairs](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials/creating-public-private-key-pairs)
{% endcontent-ref %}

{% content-ref url="/pages/f7GMMbFVwgSPPvP2VMXr" %}
[Using JSON Web Tokens (JWTs)](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials/using-json-web-tokens-jwts)
{% endcontent-ref %}


# Creating Public/Private Key Pairs

This page explains how to generate public/private key pairs using [OpenSSL](https://www.openssl.org/) command-line tools.

### **Generating an RSA Key**

Use the following commands to generate an RSA key pai&#x72;**.**

```bash
$ openssl genpkey -algorithm RSA -out rsa_private.pem -pkeyopt rsa_keygen_bits:2048
$ openssl rsa -in rsa_private.pem -pubout -out rsa_public.pem
```

These commands create the following public/private key pair:

* `rsa_private.pem`: The private key that must be securely stored on the device and used to sign the JWT.
* `rsa_public.pem`: The public key that must be uploaded in akenza and is used to verify the signature of the JWT.

### **Generating Elliptic Curve Keys**

Use the following commands to generate a P-256 Elliptic Curve key pai&#x72;**.**

```bash
$ openssl ecparam -genkey -name prime256v1 -noout -out ec_private.pem 
$ openssl ec -in ec_private.pem -pubout -out ec_public.pem
```

These commands create the following public/private key pair:

* `ec_private.pem`: The private key that must be securely stored on the device and used to sign the JWT.
* `ec_public.pem`: The public key that must be uploaded in akenza and is used to verify the signature of the JWT.

### **Self-Signed RSA X509 Certificate**

Use the following commands to generate a 2048-bit RSA private key and a self-signed x.509 certificate with a SHA-256 signatur&#x65;**.**

```bash
$ openssl req -x509 -nodes -newkey rsa:2048 -keyout rsa_private.pem -out rsa_cert.pem -subj "/CN=<deviceID>"
```

The subject claim must be set to the device ID used during provisioning in akenza (e.g. MAC address or other hardware identifier).

By default, X.509 certificates expire 30 days after creation. To set the number of days until the certificate expires, add the `-days <n>` flag at creation time.

### **Self-Signed EC X509 Certificate**

Use the following commands to generate an elliptic curve private key and a self-signed x.509 certificate.

```bash
$ openssl req -x509 -new -key ec_private.pem -out ec_cert.pem
```

The subject claim must be set to the device ID used during provisioning in akenza (e.g. MAC address or other hardware identifier).

By default, X.509 certificates expire 30 days after creation. To set the number of days until the certificate expires, add the `-days <n>` flag at creation time.


# Using JSON Web Tokens (JWTs)

## Set up a JWT MQTT data flow

If you are planning to use JWT as authorization method the MQTT data flow needs to be configured accordingly at creation time. Create a new MQTT device connector and select the device authentication **device credentials**.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-72bf5d15395f636185d90e350f515aa9861df720%2Fjwt-mqtt-device-connector.png?alt=media" alt=""><figcaption><p>JWT MQTT Device Connector</p></figcaption></figure>

## Add your public key to Akenza

Create a device and attach it to your JWT MQTT data flow. After that you'll find the option to add your public key file under the tab. Please ensure the key you upload is a **public** key.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-3e35f5621172e29bde3bdfca318e45e95fb2528c%2Fjwt-device-credentials.png?alt=media" alt=""><figcaption><p>Adding Device Credentials (Public Key)</p></figcaption></figure>

## Examples how to create a JWT and upload a datapoint

Select your preferred language:

* [Java](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials/using-json-web-tokens-jwts/java)
* [Python](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials/using-json-web-tokens-jwts/python)


# Python

To authenticate to the akenza MQTT broker using device credentials, a device must send a JSON Web Token (JWT, [RFC 7519](https://tools.ietf.org/html/rfc7519)).

Each JWT is composed of three components: a header, a payload (containing a claim set), and a signature.

The following python modules need to be installed in order for the scripts to work.

* [paho-mqtt](https://pypi.org/project/paho-mqtt/) for sending mqtt messages
* [pycryptodome](https://pypi.org/project/pycryptodome/) for reading public key PEM files and creating the fingerprint
* [PyJWT](https://pyjwt.readthedocs.io/en/stable/) s a Python library which allows you to encode and decode JSON Web Tokens (JWT).

### Using an RSA Private Key

<pre class="language-python" data-line-numbers><code class="lang-python"><strong>import paho.mqtt.publish as publish
</strong>import jwt
import datetime
import ssl
import hashlib
from Crypto.PublicKey import RSA

device_id = "&#x3C;deviceId>"
topic = f"/up/device/id/{device_id}"
host = "mqtt.akenza.io"
port = 8883
payload = '{"temperature":22}'

public_key_file_path = "./rsa_public.pem"
private_key_file_path = "./rsa_private.pem"


def create_jwt(device_id, private_key_file, public_key_file, algorithm="RS256"):
    token = {
        "iat": datetime.datetime.now(tz=datetime.timezone.utc),
        "exp": datetime.datetime.now(tz=datetime.timezone.utc) + datetime.timedelta(minutes=20),
        "aud": f"https://akenza.io/devices/{device_id}"
    }
    headers = {
        "kid": get_public_key_fingerprint(public_key_file)
    }
    with open(private_key_file, "r") as f:
        private_key = f.read()

    return jwt.encode(token, private_key, algorithm=algorithm, headers=headers)


def get_public_key_fingerprint(public_key_file):
    with open(public_key_file, "r") as f:
        public_key = RSA.import_key(f.read())

    return hashlib.sha256(public_key.export_key(format="DER")).hexdigest()


tls_config = {
    "cert_reqs": ssl.CERT_REQUIRED,
    "tls_version": ssl.PROTOCOL_TLSv1_2
}

mqtt_password = create_jwt(device_id, private_key_file_path, public_key_file_path)
auth = {
    "username": "unused",
    "password": mqtt_password
}

publish.single(topic, payload, hostname=host, port=port, tls=tls_config, auth=auth, client_id=device_id)

</code></pre>

### Using an EC Private Key

```python
import paho.mqtt.publish as publish
import jwt
import datetime
import ssl
import hashlib
from Crypto.PublicKey import ECC

device_id = "<deviceId>"
topic = f"/up/device/id/{device_id}"
host = "mqtt.akenza.io"
port = 8883
payload = '{"temperature":22}'

public_key_file_path = "./ec_public.pem"
private_key_file_path = "./ec_private.pem"


def create_jwt(device_id, private_key_file, public_key_file, algorithm="ES256"):
    token = {
        "iat": datetime.datetime.now(tz=datetime.timezone.utc),
        "exp": datetime.datetime.now(tz=datetime.timezone.utc) + datetime.timedelta(minutes=20),
        "aud": f"https://akenza.io/devices/{device_id}"
    }
    headers = {
        "kid": get_public_key_fingerprint(public_key_file)
    }
    with open(private_key_file, "r") as f:
        private_key = f.read()

    return jwt.encode(token, private_key, algorithm=algorithm, headers=headers)


def get_public_key_fingerprint(public_key_file):
    with open(public_key_file, "r") as f:
        public_key = ECC.import_key(f.read())

    return hashlib.sha256(public_key.export_key(format="DER")).hexdigest()


tls_config = {
    "cert_reqs": ssl.CERT_REQUIRED,
    "tls_version": ssl.PROTOCOL_TLSv1_2
}

mqtt_password = create_jwt(device_id, private_key_file_path, public_key_file_path)
auth = {
    "username": "unused",
    "password": mqtt_password
}

publish.single(topic, payload, hostname=host, port=port, tls=tls_config, auth=auth, client_id=device_id)

```


# Java

To authenticate to the akenza MQTT broker using device credentials, a device must send a JSON Web Token (JWT, [RFC 7519](https://tools.ietf.org/html/rfc7519)).

Each JWT is composed of three components: a header, a payload (containing a claim set), and a signature.

The full example can be found [here](https://github.com/akenza-io/akenza-java-examples/blob/main/src/main/java/io/akenza/examples/mqtt/MqttExample.java).

### Using an RSA Private Key

{% code lineNumbers="true" %}

```java
/**
 * Create a JWT for the given device id, signed with the given RSA private key.
 */
private static String createJwtRS(String privateKeyFile, String audience, String deviceId, int tokenExpMinutes) throws JOSEException, IOException {
    String keyString = Files.readString(Paths.get(privateKeyFile));
    JWK jwk = JWK.parseFromPEMEncodedObjects(keyString);
    RSAKey rsaKey = jwk.toRSAKey();
    
    JWTClaimsSet claimsSet = new JWTClaimsSet.Builder()
            .subject(deviceId)
            .audience(String.format("https://%s/devices/%s", audience, deviceId))
            .expirationTime(Date.from(Instant.now().plus(Duration.ofMinutes(tokenExpMinutes))))
            .issueTime(Date.from(Instant.now()))
            .build();

    var header = new JWSHeader.Builder(JWSAlgorithm.RS256)
            .build();

    SignedJWT signedJWT = new SignedJWT(header, claimsSet);
    JWSSigner signer = new RSASSASigner(rsaKey);
    signedJWT.sign(signer);

    return signedJWT.serialize();
}
```

{% endcode %}

### Using an EC Private Key

```java
/**
 * Create a JWT for the given device id, signed with the given elliptic curve private key.
 */
private static String createJwtES(String privateKeyFile, String audience, String deviceId, int tokenExpMinutes) throws JOSEException, IOException {
    String keyString = Files.readString(Paths.get(privateKeyFile));
    JWK jwk = JWK.parseFromPEMEncodedObjects(keyString);
    ECKey ecKey = jwk.toECKey();

    JWTClaimsSet claimsSet = new JWTClaimsSet.Builder()
            .subject(deviceId)
            .audience(String.format("https://%s/devices/%s", audience, deviceId))
            .expirationTime(Date.from(Instant.now().plus(Duration.ofMinutes(tokenExpMinutes))))
            .issueTime(Date.from(Instant.now()))
            .build();

    var header = new JWSHeader.Builder(JWSAlgorithm.ES256)
            //TODO if multiple certificates are in use, provide the fingerprint
            //.keyID(getFingerPrint(publicKeyPEM))
            .build();

    SignedJWT signedJWT = new SignedJWT(header, claimsSet);
    JWSSigner signer = new ECDSASigner(ecKey);
    signedJWT.sign(signer);
    
    return signedJWT.serialize();
}
```


# Generating SAS Tokens

## Prerequisites

To use Shared Access Signature tokens as authorization method, create a new HTTP device connector and select the device authentication **Shared Access Signature.**

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-38b4dbfc82ddacb93773420369e116aa4bfb668f%2Fsas-token-http-device-connector.png?alt=media" alt=""><figcaption></figcaption></figure>

Setup a new device with the data flow and copy the deviceId, the primary signing key and use it in the following code example to generate a token.

## Generating tokens

{% tabs %}
{% tab title="JavaScript" %}

```javascript
import crypto from "crypto";
import axios from "axios";

const generateSasToken = (
  signingKey,
  resourceUri,
  expiryInSeconds,
  deviceConnectorIdAudience,
  deviceIdAudience
) => {
  let query = `deviceConnectorIdAudience=${deviceConnectorIdAudience}\n`;
  if (deviceIdAudience !== null) {
    query += `deviceIdAudience=${deviceIdAudience}\n`;
  }
  query += `expiry=${expiryInSeconds}`;
  const encodedQuery = encodeURIComponent(query);

  let hmac = crypto.createHmac("sha256", Buffer.from(signingKey, "base64url"));
  hmac.update(encodedQuery);

  let signature = encodeURIComponent(hmac.digest("base64"));
  let token = `sig=${signature}&exp=${expiryInSeconds}&aud=${encodeURIComponent(
    resourceUri
  )}`;
  return Buffer.from(token).toString("base64");
};

// generate the token
const baseUrl = "https://data-gateway.akenza.io"
const expiry = Math.ceil(Date.now() / 1000 + 60 * 60 * 24); // 1d
const signingKey = "<primaryOrSecondarySigningKey>";
const deviceConnectorId = "<yourDeviceConnectorId>";
const deviceId = "<yourPhysicalDEviceId>";
const resourceUri = `https://akenza.io/device-connectors/${deviceConnectorId}/devices/${deviceId}`;
const token = generateSasToken(
    signingKey,
    resourceUri,
    expiry,
    deviceConnectorId,
    deviceId
  );
  
// send the uplink
const url = `${baseUrl}/v3/capture?deviceId=${deviceId}&topic=default`;
const options = {
    headers: {
      "Content-Type": "application/json",
      "x-access-signature": token,
    },
  };
const body = { param1: "value" };
const response = await axios.post(url, body, options);
```

{% endtab %}

{% tab title="Python" %}

```python
from base64 import b64encode, urlsafe_b64decode
from hashlib import sha256
from time import time
from urllib import parse
from hmac import HMAC
import os
import requests


def generate_sas_token(signing_key, resource_uri, expiry_in_seconds, device_connector_id, device_id):
    query = f"deviceConnectorIdAudience={device_connector_id}\n"
    if device_id:
        query += f"deviceIdAudience={device_id}\n"
    query += f"expiry={expiry_in_seconds}"
    query = parse.quote_plus(query).encode('utf-8')

    padded_signing_key = signing_key
    missing_padding = len(signing_key) % 4
    if missing_padding:
        padded_signing_key += '=' * (4 - missing_padding)
    padded_signing_key = urlsafe_b64decode(padded_signing_key)

    signature = b64encode(HMAC(padded_signing_key, query, sha256).digest()).decode("utf-8")
    encoded_signature = parse.quote_plus(signature.encode('utf-8'))
    token = f"sig={encoded_signature}&exp={expiry_in_seconds}&aud={parse.quote_plus(resource_uri)}"

    return b64encode(token.encode('utf-8')).decode("utf-8")


if __name__ == "__main__":
    base_url = "https://data-gateway.akenza.io"
    signing_key = "<primaryOrSecondarySigningKey>"
    device_id = "<yourPhysicalDEviceId>"
    device_connector_id = "<yourDeviceConnectorId>"
    expiry = round(time() + 60 * 60 * 24)
    resource_uri = f"https://akenza.io/device-connectors/{device_connector_id}/devices/{device_id}"
    token = generate_sas_token(signing_key, resource_uri, expiry, device_connector_id, device_id)

    headers = {
        'Content-Type': 'application/json',
        "x-access-signature": token
    }

    body = {
        "param1": "value"
    }

    response = requests.request("POST", f"{base_url}/v3/capture", headers=headers, json=body, timeout=10)
    response.raise_for_status()

    print("uplink sent")
```

{% endtab %}

{% tab title="Java" %}

```java
/**
 * Generates a SAS signature
 *
 * @param query the query to hash
 * @param key   the recommended key length is 32 bytes (256 bits)
 * @return the shared access signature
 */
public static String generateSignature(String query, String key) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
    String stringToSign = URLEncoder.encode(query, StandardCharsets.UTF_8);

    byte[] decodedKey = Base64.getUrlDecoder().decode(key);

    Mac sha256HMAC = Mac.getInstance("HmacSHA256");
    SecretKeySpec secretKey = new SecretKeySpec(decodedKey, "HmacSHA256");
    sha256HMAC.init(secretKey);
    Base64.Encoder encoder = Base64.getEncoder();

    String signature = new String(encoder.encode(
        sha256HMAC.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8))), StandardCharsets.UTF_8);

    return URLEncoder.encode(signature, StandardCharsets.UTF_8);
}
```

{% endtab %}
{% endtabs %}


# HTTP

This page describes HTTP Connectivity in more detail

If a device communicates over **HTTP** with akenza, an HTTP connector has to be setup and assigned to a data flow.

After creation, a secret is generated which has to be provided in the request. Both the secret and the device ID are set as query params in the HTTP request.

## Send an HTTP Uplink

<mark style="color:green;">`POST`</mark> `https://data-gateway.akenza.io/v3/capture?secret={uplinkSecret}&deviceId={deviceId}`

The body can be any **JSON** object.

#### Query Parameters

| Name                 | Type   | Description                                                                                                      |
| -------------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
| timestamp (optional) | string | The timestamp of the event (ISO-8601 formatted), defaults to the current time if not provided                    |
| topic (optional)     | string | The data topic ("default" will be used if not provided)                                                          |
| uplinkSecret         | string | The uplink secret used to authenticate the request (it is recommended to use the x-uplink-secret header instead) |
| deviceId             | string | The physical device ID                                                                                           |

#### Headers

| Name            | Type   | Description                                        |
| --------------- | ------ | -------------------------------------------------- |
| Content-Type    | string | application/json                                   |
| x-uplink-secret | string | The uplink secret used to authenticate the request |
| x-device-id     | string | The physical device ID                             |

{% tabs %}
{% tab title="200 " %}

```
{
    "id": "UUID",
    "timestamp": "ISO-8601 date string",
    "message": "uplink received"
}
```

{% endtab %}
{% endtabs %}

### Array Uplinks

The HTTP connectivity also supports the processing of array uplinks (not just a JSON property which is an array but the whole request body).

There are minimal differences when processing such an uplink in the script.

{% hint style="info" %}
Refer to the [example event for array uplinks](https://docs.akenza.io/reference/scripting#example-array-uplink-event) in the Scripting section for more details.
{% endhint %}

### Support for using secret and device id in the header

Requests can be submitted by using secret and device id in the header. The header key should be `x-uplink-secret` and `x-device-id`. The value of the header is the secret of the device connector and the physical device id. Both values can be found on the **Device Detail Page** within *API-Configuration* or in the uplink URL.

### DeviceId Templating

The device id can be parsed from the request body using a JSON path by enabling the setting when creating an HTTP device connector.

* `$` The root element to query. This starts all path expressions.
* `$.<propertyName>` dot-notated property names

Examples:

* `$.macAddress`
* `$.sensorMessages[0].sensorId`

Note that always the first match is used from the body template: e.g. using a template like `$.sensorMessages[0].sensorId`, multiple messages in the same uplink by different devices are therefore not supported.

### Plain HTTP endpoint

Use the endpoint `http://plain.data-gateway.akenza.io` if your device does not support HTTPS. We do not recommend to use this option as your data will be transmitted in plain text.


# MQTT

This page describes MQTT Connectivity in more detail

[MQTT](https://mqtt.org/) (Message Queuing Telemetry Transport) is a lightweight and widely adopted messaging protocol well-suited for resource-constrained devices.

If a device communicates over **MQTT** with akenza, an MQTT data flow has to be set up.

### Endpoints

* `mqtts://mqtt.akenza.io:8883` (recommended)
* `wss://mqtt.akenza.io:443/mqtt`
* `mqtt://mqtt.akenza.io:1883` (unencrypted, not recommended)

### Authentication

There are two ways to authenticate: **device credentials with JWTs** use a per-device public/private key pair with JSON Web Tokens (JWTs, [RFC 7519](https://www.rfc-editor.org/rfc/rfc7519)) and **uplink secrets** use a shared key per device connector that is passed as a password to the MQTT broke&#x72;**.** The authentication type can be selected during creation of the device connector.

Refer to [Device Security](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security) for a more in-depth introduction into the authentication options.

**Using device credentials**

Using the private key, a JWT has to be generated that is sent as the MQTT password when setting up connection to the akenza MQTT broker.

* MQTT username: arbitrary username (not used). Depending on framework this needs to be set in order for the password to be sent as well
* MQTT password: must be a valid JWT signed with the private key. Refer to [Using JSON Web Tokens (JWTs)](https://docs.akenza.io/device-management/your-data-flow/device-connector/device-security/using-device-credentials/using-json-web-tokens-jwts)
* MQTT client id: the `clientId` must be the deviceId
* MQTT topic: a topic with the following structure
  * uplink topic: `/up/device/id/{deviceId}`
  * downlink topic: `/down/device/id/{deviceId}/#`

**Using uplink secret**

After the creation of the **MQTT device connecto**r, a secret is generated which needs to be provided in the topic structure of the uplink request.

* MQTT username: the device connector id
* MQTT password: the device connector secret
* MQTT topic: a topic with the following structure
  * uplink topic: `/up/<deviceConnectorSecret>/id/<deviceID>`
  * downlink topic: `/up/<deviceConnectorSecret>/id/<deviceID>/#`

### Sending data with MQTT

{% code title="uplink.py" %}

```python
import paho.mqtt.publish as publish

topic ="<copy from Akenza Device Api configuration>"
host = "mqtt.akenza.io"
mqtt_username = "<copy from Akenza Device Api configuration>"
mqtt_password = "<copy from Akenza Device Api configuration>"
payload = '{"foo":"bar"}'

publish.single(topic, payload, hostname=host, port=1883, auth={'username':mqtt_username, 'password':mqtt_password})
```

{% endcode %}

```bash
pip3 install paho-mqtt
python3 uplink.py
```

#### MQTT Sub Topics

It is possible to additionally specify a sub topic by appending it to the uplink topic, e.g. `/up/device/id/{deviceId}/alerts` will result in the akenza topic `alerts`. The subtopic will be used as the topic under which data is stored in akenza and is available in the uplink decoder script of the device type. If multiple levels of subtopics are specified, the resulting topic will be separated by underscores, e.g. `/up/device/id/{deviceId}/alerts/critical` will result in `alerts_critical`.

### **Receiving Downlinks with MQTT**

Subscribing to downlinks is possible by providing the following info:

* MQTT username: the device connector id
* MQTT password: the device connector secret
* MQTT topic: a topic with the following structure `/down/<deviceConnectorSecret>/id/<deviceID>`

{% code title="downlink.py" %}

```python
import paho.mqtt.client as mqtt
from paho.mqtt.client import error_string

host = "mqtt.akenza.io"
mqtt_username = "<copy from Akenza Device Api configuration>"
mqtt_password = "<copy from Akenza Device Api configuration>"
device_id= "<copy from Akenza Device Api configuration>"
topic = "/down/{0}/id/{1}/#".format(mqtt_password, device_id)

def on_connect(client, userdata, flags, rc):  # The callback for when the client connects to the broker
    print("Connected with result code {0}".format(error_string(rc)))

def on_message(client, userdata, message):
    print("Received message '" + str(message.payload) + "' on topic '"
        + message.topic + "' with QoS " + str(message.qos))

def on_disconnect(client, userdata, rc):
    print("Unexpected disconnection. " + error_string(rc))
    if rc != 0:
        print("Unexpected disconnection. " + error_string(rc))

client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1, "mqtt-test-client")
client.username_pw_set(mqtt_username, mqtt_password)
client.on_message = on_message
client.on_connect = on_connect
client.on_disconnect = on_disconnect
client.connect(host, 1883)
client.subscribe(topic)  # Subscribe to the topic, receive any messages published on it

client.loop_forever()  # Start networking daemon
```

{% endcode %}

```
pip3 install paho-mqtt
python3 downlink.py
```

The downlink topic added in akenza will be appended to the topic subscribed to e.g. when providing "myTopic" the resulting downlink topic will look as follows: /down/{0}/id/{1}/myTopic.

{% hint style="info" %}
Use the [device configuration feature](https://docs.api.akenza.io/#330a150e-a7be-476b-90a8-050364477516) to receive a downlink with the newest configuration when connecting your device with akenza.
{% endhint %}

### Using TLS

akenza allows sending data using transport layer security (TLS). For this the port 8883 has to be used.

```python
import paho.mqtt.publish as publish
import ssl

topic ="<copy from Akenza Device Api configuration>"
host = "mqtt.akenza.io"
mqtt_username = "<copy from Akenza Device Api configuration>"
mqtt_password = "<copy from Akenza Device Api configuration>"
payload = '{"foo":"bar"}'

tls_config = {
    "cert_reqs": ssl.CERT_REQUIRED,
    "tls_version": ssl.PROTOCOL_TLSv1_2
}
publish.single(topic, payload, hostname=host, port=8883, tls = tls_config, auth={'username':mqtt_username, 'password':mqtt_password})
```

Refer to the [paho-mqtt ](https://pypi.org/project/paho-mqtt/)documentation for more information.

**Why am I getting a certificate expired error?**

Akenza is using an Sectigo Public Server Authentication Root R46 root certificate provided by ZeroSSL to sign certificates. If your device is older, it might not contain an up to date root certificate. Aquire the root certificate from [here](https://zerossl.com/) and update your trust store accordingly.

### Sending data with MQTT v5

```python
import paho.mqtt.client as client
import ssl

topic ="<copy from Akenza Device Api configuration>"
host = "mqtt.akenza.io"
mqtt_username = "<copy from Akenza Device Api configuration>"
mqtt_password = "<copy from Akenza Device Api configuration>"
payload = '{"foo":"bar"}'

tls_config = {
    "cert_reqs": ssl.CERT_REQUIRED,
    "tls_version": ssl.PROTOCOL_TLSv1_2
}

publish.single(topic, payload, hostname=host, port=8883, tls = tls_config, auth={'username':mqtt_username, 'password':mqtt_password}, protocol=client.MQTTv5)
```

### MQTT v5 Content Types

With MQTT v5 it is possible to send different content types by setting the ContentType property. The supported MIME types are:

* `application/json`
* `text/plain`
* `application/octet-stream`
* `application/xml`
* `text/csv`

If this property is not set, a published message will be interpreted as a JSON message.

```python
import paho.mqtt.client as client
from paho.mqtt.properties import Properties
from paho.mqtt.packettypes import PacketTypes 

topic ="<copy from Akenza Device Api configuration>"
host = "mqtt.akenza.io"
mqtt_username = "<copy from Akenza Device Api configuration>"
mqtt_password = "<copy from Akenza Device Api configuration>"
client_id = "<an arbitrary client id>"
payload = '<?xml version=\'1.0\' encoding=\'UTF-8\'?><data><foo>bar</foo></data>'

properties=Properties(PacketTypes.PUBLISH)
properties.ContentType="application/xml"

client = client.Client(client_id, protocol=mqtt_client.MQTTv5)
client.username_pw_set(username, password)
client.connect(host, port)

client.publish(topic, payload, properties=properties)
```

### Limits

The maximum message size is 1MB.

### Examples

A set of examples for using MQTT with akenza can be found here:

* [Java](https://github.com/akenza-io/akenza-java-examples/blob/main/src/main/java/io/akenza/examples/mqtt/MqttExample.java)
* [JavaScript](https://github.com/akenza-io/akenza-examples/blob/main/examples/uplink/mqtt-send-data-tls.mjs)


# CoAP

This page describes the CoAP connectivity in more detail

The **Constrained Application Protocol (CoAP)** ([RFC 7252](https://datatracker.ietf.org/doc/html/rfc7252)) is a specialized web transfer protocol designed for resource-constrained devices and networks. Operating over UDP, CoAP provides a low-overhead alternative to TCP/HTTP, making it ideal for IP-based IoT devices that require minimal power and bandwidth consumption.

To connect a CoAP-enabled device to **akenza**, you must first create a CoAP Device Connector and assign it to a Data Flow (Create Data Flow > Start with empty Data Flow > + Device Connector > CoAP > New CoAP Device Connector).

The device authentication of the connector defines how devices authenticate:

* **Shared Uplink Secret:** a unique secret is generated upon creating the connector. Your device must pass this secret and the Device ID as query parameters in every CoAP request.
* **DTLS with client certificates:** devices authenticate with X.509 certificates via DTLS. You must submit your Custom Certificate Authority (CA) to akenza and provision devices matching the certificates, see [DTLS Device Client Certificates](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/dtls-device-client-certificates).
* **DTLS with Pre-Shared Keys:** devices authenticate with a per-device symmetric key via DTLS. The device ID is the PSK identity, the key can be created in akenza or provided by the user, see [DTLS Pre-Shared Keys](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/dtls-pre-shared-keys).

{% hint style="warning" %}
By default CoAP communication without DTLS is insecure. Even if data transmission over a NB-IoT network is inherently encrypted within the cellular network, once the data leaves the carrier network for the public internet, additional measures are required to maintain security.

Therefore, we recommend using DTLS to secure the connection (see below). If your device does not support DTLS, the following alternative architecture can be implemented.

**Fallback Architecture: Secure Tunnel**

1. **Private APN:** Use a private APN configured by your network operator.
2. **VPN Tunnel:** Establish a secure VPN tunnel between the operator's APN and akenza.
3. **Result:** Data remains in its lightweight UDP format for the device, while the "hop" over the public internet is protected from eavesdropping by the tunnel.

[Contact](mailto:support@akenza.io) akenza for more information regarding transport security.
{% endhint %}

## Secure Transport (DTLS)

To secure communication over unencrypted UDP networks, akenza supports Datagram Transport Layer Security (DTLS). This ensures confidentiality, data integrity, and secure device authentication.

#### X.509 Certificate Authentication

Devices can authenticate securely with akenza using *X.509* Certificates. During the DTLS handshake, the device presents its cryptographic certificate to verify its identity, establishing an encrypted channel before any CoAP requests are transmitted. akenza will automatically extract the deviceId from the common name (CN) in the certificate.

To utilize X.509 certificate authentication, you must generate a **Device Certificate Authority (CA)** and individual **Device Client Certificates** for your devices. For more information, refer to [DTLS Device Client Certificates](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/dtls-device-client-certificates).

#### Pre-Shared Key Authentication

Devices can also authenticate with a pre-shared key (PSK). The device sends its device ID as PSK identity in the DTLS handshake. Each device has its own key, which akenza generates or you supply when creating the device or on the device details tab. PSK needs no certificates, so the handshake stays small.

For the setup and the supported cipher suites, refer to [DTLS Pre-Shared Keys](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/dtls-pre-shared-keys).

If a DTLS request is not authorized after the handshake (e.g. the device does not exist, its connector uses a different device authentication, or its key was deleted), akenza responds with `4.01 Unauthorized`.

#### Verifying the server identity

For certificate based cipher suites, akenza uses server certificates issued by ZeroSSL. Make sure your devices trust the [Sectigo Root Certificates](https://www.sectigo.com/knowledge-base/detail/Access-New-Sectigo-Certificate-Chain) specifically [ZeroSSLECCDVSSLCA2.crt](http://crt.sectigo.com/ZeroSSLECCDVSSLCA2.crt).

#### DTLS with Connection ID (CID)

To avoid costly DTLS handshakes after periods of inactivity, the protocol uses DTLS Connection IDs (as defined in [RFC 9146](https://www.rfc-editor.org/rfc/rfc9146)). The CID allows the DTLS session to be resumed without a full handshake even when the device's IP address or UDP port changes (e.g., after a network sleep cycle).

The device aims to perform as few handshakes as possible. The DTLS session is kept alive across transmission intervals by using the CID, so a new handshake is only required when the session cannot be resumed.

## Uplinks

#### Content Format

The akenza CoAP connector supports multiple payload formats. Ensure your device includes the correct `Content-Format` option header in its requests to match the transmitted data type:

<table data-header-hidden><thead><tr><th width="206.4375">CoAP Content-Format ID</th><th>Format</th><th>Behaviour</th><th data-hidden></th></tr></thead><tbody><tr><td><code>50</code></td><td><code>application/json</code></td><td><p>Standard JSON payload, parsed directly into a structured JSON object.<br><br>If JSON parsing fails:</p><ul><li><em>Valid UTF-8 payload:</em> Converted to plain text (<code>value</code>) plus Hex (<code>payloadHex</code>) and Base64 representations (<code>payloadBase64</code>).</li><li><em>Invalid UTF-8 payload:</em> Converted to Hex (<code>payloadHex</code>) and Base64 representations (<code>payloadBase64</code>).</li></ul></td><td><code>application/json</code></td></tr><tr><td><code>60</code></td><td><code>application/cbor</code></td><td>Concise Binary Object Representation (CBOR). Parsed and converted into standard JSON.</td><td><code>application/cbor</code></td></tr><tr><td><code>41</code></td><td><code>application/xml</code></td><td>XML payload, automatically converted into a JSON structure.</td><td><code>application/xml</code></td></tr><tr><td><code>42</code></td><td><code>application/octet-stream</code></td><td>Raw binary data. Automatically converted into both Hex (<code>payloadHex</code>) and Base64 (<code>payloadBase64</code>) string representations for the decoder.</td><td><code>application/octet-stream</code></td></tr><tr><td><code>0</code></td><td><code>text/plain</code></td><td>Plain text. The raw string is placed into a JSON object under the key <code>value</code>. Note that the string is expected to have utf-8 format.</td><td><code>text/plain</code></td></tr></tbody></table>

### Sending a CoAP Uplink

<mark style="color:green;">`POST`</mark> `coap://coap.akenza.io:5683/v3/capture?secret={uplinkSecret}&deviceId={deviceId}`

The body can be any **JSON** object.

Devices that authenticate via DTLS (client certificates or pre-shared keys) send uplinks to `coaps://coap.akenza.io:5684/v3/capture` without the `secret` and `deviceId` query parameters. The device is identified by the certificate or the PSK identity.

#### Query Parameters

| Name         | Type   | Description                                                                                     |
| ------------ | ------ | ----------------------------------------------------------------------------------------------- |
| timestamp    | string | The timestamp of the event (ISO-8601 formatted - the current time will be used if not provided) |
| topic        | string | The data topic ("default" will be used if not provided)                                         |
| uplinkSecret | string | The uplink secret used to authenticate the request                                              |
| deviceId     | string | The device ID                                                                                   |

#### Headers

| Name            | Type   | Description      |
| --------------- | ------ | ---------------- |
| content\_format | number | application/json |

{% tabs %}
{% tab title="201 Note that the actual response code is 2.01 for CoAP" %}

```
{
    "id": "UUID",
    "timestamp": "ISO-8601 date string",
    "message": "uplink received"
}
```

{% endtab %}
{% endtabs %}

### Sample NodeJS Script

The below sample nodeJS script allows sending a CoAP uplink. It requires the node module [coap](https://www.npmjs.com/package/coap) to be installed.

```javascript
const coap = require('coap');

// define connection options
const options = {
    hostname: "coap.akenza.io",
    port: 5683,
    method: "POST",
    pathname: "/v3/capture",
    query: "secret={secret}&deviceId={deviceId}",
    options: {
        "Content-Format": "application/json",
    },
};
// create the request object
const req = coap.request(options);
// set the payload
const payload = {
    temperature: Math.random() * 100,
};
req.write(JSON.stringify(payload));
// handle success response
req.on('response', function (res) {
    res.pipe(process.stdout);
});
// handle error response
req.on('error', function (err) {
    console.log("error while sending coap request", err);
});
// send the request
req.end();
```

## Downlinks

CoAP downlinks enable cloud-to-device command delivery CoAP devices. All downlink interactions enforce a secure connection, support persistent queuing, and adhere to [RFC 7252](https://datatracker.ietf.org/doc/html/rfc7252#section-5.2) delivery mechanics.

### Security & Encryption

* **Enforced Encryption:** Plain CoAP downlinks over UDP is prohibited. All interactions must be wrapped in DTLS (CoAPs) to prevent command spoofing and replay attacks.
* **Replay Protection:** Devices must track transaction sequence IDs to identify and suppress duplicate frames.

### Queue Handling Strategies

Commands are stored in a persistent queue prior to transmission. When new commands are dispatched from the backend, the queue applies one of two policies:

| **Queue Policy** | **Description**                                                               |
| ---------------- | ----------------------------------------------------------------------------- |
| `ADD`            | Appends the incoming command to the target device's existing command queue.   |
| `REPLACE`        | Purges all pending, unacknowledged commands before inserting the new command. |

### Delivery Patterns

Because CoAP runs over UDP and devices are typically sleeping, akenza never pushes commands; instead devices retrieve pending commands when they wake up, via either a dedicated **command pull** or **piggy-backed** on a regular uplink. Commands are delivered strictly FIFO, one command per request.

**Command Pull:** a dedicated `GET /v3/commands` request:

<table><thead><tr><th width="367">Queue state</th><th>Response</th></tr></thead><tbody><tr><td>Commands pending</td><td><code>2.05 Content</code> with the command payload, in the content format chosen at enqueue time (JSON by default)</td></tr><tr><td>Queue empty</td><td><p><code>2.05 Content</code> with an empty response based on Accept header:</p><ul><li>JSON (default): <code>{}</code></li><li>CBOR: <code>0xA0</code></li><li>XML: <code>""</code></li></ul></td></tr></tbody></table>

**Piggy-Backed Uplink:** a pending command replaces the response of a standard `POST /v3/capture` uplink (requires the `downlinkOnUplink` feature on the device connector):

| Queue state      | Response                                                                                                                                          |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Commands pending | `2.05 Content` with the command payload in the content format chosen at enqueue time (JSON by default) instead of the usual uplink acknowledgment |
| Queue empty      | `2.01 Created` with the normal uplink acknowledgment                                                                                              |

Devices using piggy-back must therefore branch on the response code: `2.05` carries a command, `2.01` is a plain uplink acknowledgment.

Each command contains a transaction id (`tx_id`) that is used to confirm receipt on the application-layer (see [#piggy-backed-execution-flow](#piggy-backed-execution-flow "mention")):

```json
{
  "tx_id": "tx_987654",
  ...
}
```

#### Command Pull Execution Flow (confirmed command)

Confirmed commands (`confirmed=true`, the default) are delivered as a **separate response** ([RFC 7252 §5.2.2](https://datatracker.ietf.org/doc/html/rfc7252#section-5.2.2)) so that the device's transport-level ACK can serve as the delivery confirmation:

```
IoT Device (Client)               Akenza Server                        Queue
    |                                   |                                |
    |--- DTLS Handshake --------------->|                                |
    |--- CON GET /v3/commands --------->|                                |
    |                                   |--- Fetch & Lock (Device ID) -->|
    |                                   |<-- Head command (IN_FLIGHT) ---|
    |<-- Empty ACK (0.00) --------------|                                |
    |<-- CON 2.05 Content (new MID) ----|   (retransmitted w/ backoff)   |
    |--- Empty ACK -------------------->|                                |
    |                                   |--- Purge command ------------->|
    | (Execute Command & Sleep)         |                                |
```

#### Piggy-Backed Execution Flow

A piggy-backed response travels inside the CoAP ACK itself, so **no transport-level delivery confirmation exists**. The command stays `IN_FLIGHT` until the device confirms it with a `completed_tx_id` in a later uplink (or the command expires):

```
IoT Device (Client)               Akenza Server                        Queue
    |                                   |                                |
    |--- DTLS Handshake --------------->|                                |
    |--- CON POST /v3/capture --------->|                                |
    |                                   |--- Fetch & Lock (Device ID) -->|
    |                                   |<-- Head command (IN_FLIGHT) ---|
    |<-- ACK 2.05 Content (piggy-back) -|                                |
    | (Execute Command & Sleep)         |                                |
    |                                   |                                |
    |--- POST /v3/capture with -------->|                                |
    |    completed_tx_id                |--- Purge command ------------->|
```

Unconfirmed command pulls (`confirmed=false`) are delivered as a **piggy-backed response** and also require a separate acknowledgement in a later uplink (not recommended):

```
IoT Device (Client)               Akenza Server                        Queue
    |                                   |                                |
    |--- DTLS Handshake --------------->|                                |
    |--- CON GET /v3/commands --------->|                                |
    |                                   |--- Fetch & Lock (Device ID) -->|
    |                                   |<-- Head command (IN_FLIGHT) ---|
    |<-- ACK 2.05 Content (piggyback) --|                                |
    | (Execute Command & Sleep)         |                                |
    |                                   |                                |
    |--- POST /v3/capture with -------->|                                |
    |    completed_tx_id                |--- Purge command ------------->|
```

#### Transport Reliability & Response Mechanics

The server uses the two response patterns:

* **Piggy-backed response:** response code and payload travel inside the ACK, sharing the request's Message ID (1 RTT). Used for empty-queue replies, `confirmed=false` commands, and all piggy-backed uplink deliveries. Fast, but provides no delivery confirmation. Use this strategy for fleets that require the 1-RTT/RAI pattern and acknowledge at the application layer.
* **Separate response:** used for confirmed commands (`confirmed=true`) on the pull endpoint. This is a deliberate choice to obtain a delivery confirmation.
  * **Empty ACK (`0.00`):** sent immediately with the request's Message ID; the device stops its request retransmission timer. The ACK is a promise that a response follows.
  * **Separate CON delivery:** the command follows in a new CON message with a **new Message ID** and the **original Token**, retransmitted with standard Stop-and-Wait ARQ and exponential backoff until the device acknowledges or rejects it.
  * **Delivery confirmation:** the device answers the CON with an empty ACK of its own - this is what purges the command from the queue.

> **Critical requirement:** devices must stay awake after receiving an Empty ACK. The follow-up CON leaves the server within milliseconds; a device that sleeps immediately misses it (and its retransmissions), and the command is requeued after the backoff.

#### Failure Handling & Crash Recovery

* **Re-queuing:** any failed delivery attempt returns the command to `QUEUED` for the next pull or uplink window. All three transport failure signals are handled: retransmission **timeout**, device **rejection** (`RST` the server stops retransmitting immediately, per RFC 7252), and **send errors** (e.g. the DTLS session is gone).
* **In-flight lock:** fetching a command moves it from `QUEUED` to `IN_FLIGHT` with an attempt counter and a 60-second lock. An `IN_FLIGHT` head is intentionally re-delivered on the device's next request: if the server restarts mid-delivery, the device's retransmitted request receives the same command again. Devices must therefore track received `tx_id`s and suppress duplicates.
* **Expiry:** commands not delivered within the item TTL (default 7 days) are dropped.
* **Application-level ACK (`completed_tx_id`):** independent of all transport events (retransmissions, DTLS re-handshakes, server restarts), a device can purge a command by reporting its transaction ID at the root of a subsequent uplink payload. This is the **only** way to clear a piggy-backed / unconfirmed command:

```json
{
  "completed_tx_id": "tx_987654",
  ...
}
```

## Queuing a CoAP Downlink

```
curl --location 'https://api.akenza.io/v3/devices/{{akenzaDeviceId}}/downlink' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{
        "coapDownlink": {
            "payload": {
                ...
            }, 
            "contentType": "JSON",
            "confirmed": true,
            "clearQueue": true
        },
        "raw": false
}'
```

#### Body Parameters

<table><thead><tr><th width="245">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>coapDownlink.payload</td><td>object</td><td>A json object containing the command payload. If a device type encoder is present this will be first encoded.</td></tr><tr><td>coapDownlink.clearQueue</td><td>boolean</td><td>Whether to replace any pending downlinks.</td></tr><tr><td>coapDownlink.contentType</td><td>string</td><td>The command encoding type. Can be one of JSON (default), CBOR or XML.</td></tr><tr><td>coapDownlink.confirmed</td><td>boolean</td><td>Whether the downlink is confirmable (only relevant for command pull).</td></tr><tr><td>raw</td><td>boolean</td><td>Whether to skip the device type encoder, this value has no effect for passthrough data flows.</td></tr></tbody></table>

## Additional devices

akenza provides dedicated support for [Efento](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap/efento) devices.


# DTLS Device Client Certificates

This guide walks through generating a Custom **Device Certificate Authority (CA)** and individual **Device Client Certificates** for your devices to achieve mutual DTLS authentication.

#### Prerequisites

* `openssl` 3.x (Verify using `openssl version`)
* A dedicated working directory for your PKI files (e.g., `~/coap-pki/`)

#### Constraints & Requirements

* **Private Key Format:** Private keys must be in PKCS#8 format (`-----BEGIN PRIVATE KEY-----`). OpenSSL generates PKCS#1 by default for RSA -an extra conversion step is required.
* **Device Identity:** The device client certificate's Common Name (CN) is used as the device identity identifier in akenza. Set it to the exact device identifier (e.g. serial number) you want to authenticate. It must match the deviceId used to provision a device in akenza.
* **Cipher Suites:** Both RSA 2048 and ECDSA P-256 are supported. ECDSA produces significantly smaller certificates and is highly recommended for constrained IoT devices.

#### Option A - ECDSA (P-256, recommended)

**1. Create the Device Certificate Authority (CA)**

{% hint style="warning" %}
Never store your Root CA private key on an internet-facing device. Keep it in an offline, air-gapped environment or within a hardware security module (HSM). If the CA key is leaked, an attacker can issue valid certificates for any device identity.
{% endhint %}

{% hint style="info" %}
[Submit](mailto:support@akenza.io) the Device CA certificate file to akenza and also include the akenza device connector id(s) that are in scope for this CA.
{% endhint %}

```
mkdir -p ~/coap-pki && cd ~/coap-pki

# CA private key (PKCS#8 unencrypted)
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out ca.key

# Self-signed CA certificate (10-year validity)
openssl req -new -x509 -key ca.key -sha256 -days 3650 \
  -subj "/CN=akenza CoAP CA" \
  -out ca.crt
```

**2. Create a Device Client Certificate**

The CN becomes the device identifier in akenza. Repeat this block for each device.

{% hint style="warning" %}
Store device private keys securely on the hardware (e.g., inside a Secure Element, TPM, or hardware-backed keystore) rather than in plain-text application files where they might be extracted during a physical or remote firmware breach.
{% endhint %}

```
DEVICE_ID="B6.EC.9C.9C.6E.E2"   # <- Must match the device ID in akenza

# Generate client key
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 \
  -out "client-${DEVICE_ID}.key"

# Generate certificate signing request (CSR)
openssl req -new -key "client-${DEVICE_ID}.key" -sha256 \
  -subj "/CN=${DEVICE_ID}" \
  -out "client-${DEVICE_ID}.csr"

# Sign with your CA
openssl x509 -req -in "client-${DEVICE_ID}.csr" \
  -CA ca.crt -CAkey ca.key -CAcreateserial -sha256 -days 825 \
  -out "client-${DEVICE_ID}.crt"

# Verify validity
openssl verify -CAfile ca.crt "client-${DEVICE_ID}.crt"
```

#### Option B - RSA 2048

**1. Create the Device Certificate Authority (CA)**

{% hint style="warning" %}
Never store your Root CA private key on an internet-facing gateway, server, or device. Keep it in an offline, air-gapped environment or within a hardware security module (HSM). If the CA key is leaked, an attacker can issue valid certificates for any device identity.
{% endhint %}

{% hint style="info" %}
[Submit](mailto:support@akenza.io) the Device CA certificate file to akenza and also include the akenza device connector id(s) that are in scope for this CA.
{% endhint %}

```
mkdir -p ~/coap-pki && cd ~/coap-pki

# CA private key — RSA default output is PKCS#1, convert to PKCS#8
openssl genrsa -out ca-pkcs1.key 2048
openssl pkcs8 -topk8 -nocrypt -in ca-pkcs1.key -out ca.key
rm ca-pkcs1.key

openssl req -new -x509 -key ca.key -sha256 -days 3650 \
  -subj "/CN=akenza CoAP CA" \
  -out ca.crt
```

**2. Create a Device Client Certificate**

{% hint style="warning" %}
Store device private keys securely on the hardware (e.g., inside a Secure Element, TPM, or hardware-backed keystore) rather than in plain-text application files where they might be extracted during a physical or remote firmware breach.
{% endhint %}

```
DEVICE_ID="B6.EC.9C.9C.6E.E2"   # <- Must match the device ID in akenza

# Generate RSA key and convert to PKCS#8
openssl genrsa -out "client-${DEVICE_ID}-pkcs1.key" 2048
openssl pkcs8 -topk8 -nocrypt \
  -in "client-${DEVICE_ID}-pkcs1.key" \
  -out "client-${DEVICE_ID}.key"
rm "client-${DEVICE_ID}-pkcs1.key"

openssl req -new -key "client-${DEVICE_ID}.key" -sha256 \
  -subj "/CN=${DEVICE_ID}" \
  -out "client-${DEVICE_ID}.csr"

openssl x509 -req -in "client-${DEVICE_ID}.csr" \
  -CA ca.crt -CAkey ca.key -CAcreateserial -sha256 -days 825 \
  -out "client-${DEVICE_ID}.crt"

openssl verify -CAfile ca.crt "client-${DEVICE_ID}.crt"
```

### Test the Connection

You can verify the connection utilizing `coap-client` (from the `libcoap` [package](https://libcoap.net/install.html)):

```
# Install via: 'brew install libcoap' or 'apt install libcoap2-bin'
coap-client -m post \
  -e '{"sensor":"temp","value":23.5}' \
  -t "application/json" \
  --cert "client-${DEVICE_ID}.crt" \
  --key  "client-${DEVICE_ID}.key" \
  --ca-file ca.crt \
  "coaps://coap.akenza.io:5684/v3/capture"
```

* **Success Response:** Returns a payload structure like `{"message":"ok","id":"<uuid>"}`.
* **Handshake Failure:** If the certificate validation or handshake fails, the client will timeout without a response, as the gateway silently drops unauthorized requests at the TLS layer.

### Utility Tools

#### Bulk Device Client Certificate Generation

Save this automation script as `gen-certs.sh` to quickly issue device credentials:

```
#!/usr/bin/env bash
set -euo pipefail

CA_CERT=ca.crt
CA_KEY=ca.key
VALIDITY_DAYS=825

for DEVICE_ID in "$@"; do
  echo "Generating certificate for device: ${DEVICE_ID}"

  openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 \
    -out "client-${DEVICE_ID}.key" 2>/dev/null

  openssl req -new -key "client-${DEVICE_ID}.key" -sha256 \
    -subj "/CN=${DEVICE_ID}" \
    -out "client-${DEVICE_ID}.csr" 2>/dev/null

  openssl x509 -req -in "client-${DEVICE_ID}.csr" \
    -CA "${CA_CERT}" -CAkey "${CA_KEY}" -CAcreateserial -sha256 \
    -days "${VALIDITY_DAYS}" \
    -out "client-${DEVICE_ID}.crt" 2>/dev/null

  rm "client-${DEVICE_ID}.csr"
  echo "  -> client-${DEVICE_ID}.crt / client-${DEVICE_ID}.key"
done
```

Usage: `./gen-certs.sh dev-abc123 dev-def456 dev-ghi789`

#### Inspection Commands

```
# Confirm the Common Name (CN) mapping to a device ID
openssl x509 -in "client-${DEVICE_ID}.crt" -noout -subject

# Confirm client key algorithm details and underlying format structures
openssl pkey -in "client-${DEVICE_ID}.key" -noout -text | head -5

# Verify that the device certificate chains back cleanly to your CA
openssl verify -CAfile ca.crt "client-${DEVICE_ID}.crt"
```


# DTLS Pre-Shared Keys

Authenticate CoAP devices over DTLS with a per-device pre-shared key

With DTLS pre-shared keys (PSK), each device shares a symmetric key with akenza. The device proves that it knows the key during the DTLS handshake, and the connection is encrypted with keys derived from it. No certificates are needed, which keeps the handshake small for constrained devices.

* **PSK identity:** the device ID of the device in akenza. The device sends it in the DTLS handshake.
* **Key:** one key per device, stored encrypted in akenza. akenza generates a 32-byte key, or you supply your own key of 16 to 64 bytes.

## Setup

### 1. Create the device connector

Create a CoAP device connector and select **DTLS with Pre-Shared Keys** as device authentication (Create Data Flow > Start with empty Data Flow > + Device Connector > CoAP > New CoAP Device Connector).

### 2. Create the device and its key

Create a device on a data flow with this device connector. The device ID is the PSK identity, so set it to the identifier the device sends in the handshake (e.g. its serial number or IMEI).

Add the key in the **Device Credentials** section, either in the device creation wizard or later on the device details tab:

* **Generate key** (default): akenza generates a random 32-byte key.
* **Use my own key:** enter a key of 16 to 64 bytes, as hex or base64. Use this for keys that were provisioned on the device at the factory. A value with hex digits only is read as hex.

Optionally set a validity date. The device can no longer connect with the key after this date.

{% hint style="warning" %}
The key is shown only once, in hex and base64, right after the credential is created. akenza can't display it again. Store it in your provisioning system before you confirm with **I've stored the key**. If the key gets lost, delete the credential and create a new one.
{% endhint %}

### 3. Provision the device

Configure the device with:

| Setting      | Value                                          |
| ------------ | ---------------------------------------------- |
| Endpoint     | `coaps://coap.akenza.io:5684`                  |
| PSK identity | The device ID                                  |
| PSK          | The key from step 2                            |
| Cipher suite | See [#cipher-suites](#cipher-suites "mention") |

Store the key securely on the device, e.g. in a secure element or a hardware-backed keystore, not in plain-text application files.

## Sending uplinks

<mark style="color:green;">`POST`</mark> `coaps://coap.akenza.io:5684/v3/capture`

The device is identified by the PSK identity, so the `secret` and `deviceId` query parameters are not needed. If `deviceId` is passed, it must match the PSK identity. Content formats, the `timestamp` and `topic` query parameters and the responses are the same as for plain CoAP (see [CoAP](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap)).

Downlinks work the same way as with client certificates: the device pulls commands with `GET /v3/commands` over the DTLS connection, or receives them piggy-backed on an uplink.

## Cipher suites

akenza offers the recommended PSK and ECDHE\_PSK cipher suites, including:

| Cipher suite                              | Notes                                                                                                                                    |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `TLS_PSK_WITH_AES_128_CCM_8`              | Mandatory to implement for CoAP ([RFC 7252 §9.1.3.1](https://datatracker.ietf.org/doc/html/rfc7252#section-9.1.3.1)), smallest handshake |
| `TLS_ECDHE_PSK_WITH_AES_128_CCM_8_SHA256` | Adds forward secrecy: a leaked key does not decrypt previously recorded traffic                                                          |

Use `TLS_ECDHE_PSK_WITH_AES_128_CCM_8_SHA256` if the device can afford the additional elliptic curve computation.

With PSK cipher suites, akenza does not present a server certificate. The device knows it talks to akenza because only akenza knows the key.

DTLS Connection IDs are supported as for certificates, see [CoAP](https://docs.akenza.io/device-management/your-data-flow/device-connector/coap#dtls-with-connection-id-cid).

## Key rotation and revocation

A device has only one active key. To rotate it, delete the credential on the device details tab, create a new one and provision the device with the new key. The device can't connect between the deletion and the re-provisioning.

Deleting the credential also revokes existing DTLS sessions: the next request of the device is answered with `4.01 Unauthorized`, and new handshakes fail.

## Troubleshooting

| Symptom                                | Cause                                                                                                                                                                                                                      |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The DTLS handshake fails               | Unknown PSK identity, wrong key, no active key (deleted or expired), or the device's connector does not use **DTLS with Pre-Shared Keys**                                                                                  |
| `4.01 Unauthorized` after a handshake  | The key was deleted or expired after the session was established, the connector's auth type was changed, or `deviceId` does not match the PSK identity                                                                     |
| The server never answers the handshake | The device's first handshake message (ClientHello) is larger than one UDP datagram and is split in two. akenza drops split ClientHello messages. Offer fewer cipher suites and extensions, e.g. only the PSK cipher suites |

## Test the connection

### With OpenSSL

The following script checks the key and sends one uplink with `openssl s_client`. It offers only `TLS_PSK_WITH_AES_128_CCM_8`, which keeps the handshake small:

```bash
DEVICE_ID="B6.EC.9C.9C.6E.E2"   # <- the device ID in akenza
PSK_HEX="<key in hex>"          # <- the key shown when the credential was created
PAYLOAD='{"sensor":"temp","value":23.5}'

# CoAP POST /v3/capture with Content-Format application/json (50), followed by the payload
{ printf '\x41\x02\x12\x34\x01\xb2v3\x07capture\x11\x32\xff'; printf '%s' "${PAYLOAD}"; } > request.bin

(sleep 3; cat request.bin; sleep 5) | openssl s_client -dtls1_2 -quiet \
  -connect coap.akenza.io:5684 \
  -psk_identity "${DEVICE_ID}" \
  -psk "${PSK_HEX}" \
  -cipher 'PSK-AES128-CCM8:@SECLEVEL=0' \
  | xxd
```

A successful uplink returns a response starting with the bytes `61 41` (`ACK`, `2.01 Created`), followed by a payload like `{"id":"<uuid>","message":"ok"}`.

To check only the handshake, run the `openssl s_client` command without `-quiet` and without input. A working handshake prints `Cipher is PSK-AES128-CCM8`.

### With libcoap

You can also use `coap-client` from [libcoap](https://libcoap.net/install.html). Prefix a hex key with `0x`:

```bash
# Install via: 'brew install libcoap' or 'apt install libcoap2-bin'
DEVICE_ID="B6.EC.9C.9C.6E.E2"   # <- the device ID in akenza
PSK_HEX="<key in hex>"          # <- the key shown when the credential was created

coap-client -m post \
  -e '{"sensor":"temp","value":23.5}' \
  -t "application/json" \
  -u "${DEVICE_ID}" \
  -k "0x${PSK_HEX}" \
  "coaps://coap.akenza.io:5684/v3/capture"
```

A successful uplink returns `2.01 Created` with a payload like `{"message":"ok","id":"<uuid>"}`.

{% hint style="warning" %}
`coap-client` builds that use OpenSSL 4 (e.g. the current Homebrew package) don't work with akenza. Their ClientHello is too large for one UDP datagram and gets split in two, which akenza drops. The request times out with `cannot send CoAP pdu`. Check the DTLS library of your build with `coap-client -h | grep "TLS Library"`. If it uses OpenSSL 4, test with OpenSSL as described above.
{% endhint %}


# Efento

Efento devices transmit data using the [Protobuf](https://protobuf.dev/) format. To simplify integration, Akenza provides native handling for Efento within the **CoAP Device Connector**. This built-in logic automatically processes uplink authentication (uplink secret) and device identifiers directly from the encoded payload.

## Set up an Efento device to send data to akenza

### Create a Data Flow

Before configuring your hardware, establish the cloud infrastructure:

* Log in to Akenza.
* Create a new **Data Flow**.
* Select the **CoAP Device Connector** as the entry point.
* Note the **Uplink Secret** generated by the connector; you will need this for the device configuration.

### Create a Device

* Create a new Device
* Select the previously created Data Flow.
* Use the Efento Device Identifier as Device ID, but remove the colons
  * Example: `28:2C:02:40:AB:CD` -> `282C0240ABCD`

### Configure the Efento Device

To configure the device, you must use the Efento mobile application.

1. **Enable Power User Mode:** Open the app menu and quickly tap the Efento Logo five times.
2. **Access Settings:** Navigate to the device configuration section.
3. **Endpoint Configuration:** Apply the following settings to ensure compatibility with the Akenza CoAP endpoint:
   * Set the Authentication to custom token, use the `uplinkSecret` from the CoAP device connector (Enable sending the token in the payload)
   * Endpoint configuration
     * Data: `efento/m`
     * Configuration `efento/c`
     * Device Info `efento/i`
     * Timestamp `efento/t`
   * Set the IP address to `coap.akenza.io:5683`

### Transport Security & Optimization

Data transmission over NB-IoT is inherently encrypted within the cellular network. However, once the data leaves the carrier network for the public internet, additional measures are required to maintain security without draining the device battery.

> The Challenge: Standard encryption (like DTLS) increases UDP frame size, which significantly raises power consumption and shortens the device's battery life.

**Recommended Architecture: Secure Tunnel**

To balance security and energy efficiency, Akenza recommends the following setup:

1. **Private APN:** Use a private APN configured by your network operator.
2. **VPN Tunnel:** Establish a secure VPN tunnel between the operator's APN and akenza.
3. **Result:** Data remains in its lightweight UDP format for the device, while the "hop" over the public internet is protected from eavesdropping by the tunnel.

{% hint style="info" %}
Contact akenza for more information regarding transport security.
{% endhint %}

### Links

* <https://getefento.com/library/iot-protocols-coap-and-protocol-buffer-protbuf/>
* <https://docs.efento.io/nb-iot-loggers/security>


# LoRaWAN

For using a LoRaWAN device connector either a connectivity account needs to be linked (see [Connectivity Management](https://docs.akenza.io/device-management/your-data-flow/device-connector/lorawan/your-integration)) or an akenza provided connector can be used. In both cases, the necessary configurations are already done on the connectivity provider's platform and do not require any further setup in order to use it.

When a **LoRaWAN Connector** receives an uplink message, it extracts the hex payload from the request, alongside some uplink metric information which is then passed on to the **Device Type** for further processing. If the creation of a **Custom Device Type** is enabled in the subscription, the scripting guidelines can be followed to access the hex payload and meta information in the scripts (see [Scripting](https://docs.akenza.io/reference/scripting)).

**Device Connectors** that have LoRaWAN Connectivity cannot be created, edited, or deleted. They are bound to their respective integrations and will be removed if the integration is deleted.

### Activation

Over-the-Air Activation (OTAA) is the preferred and most secure way to activate LoRaWAN devices. With OTAA the device performs a join-procedure with the network, during which a dynamic `DevAddr` is assigned and security keys are negotiated.

In some cases the `DevAddr` as well as the security keys need to be hardcoded in the device, which requires activation by personalization (ABP). ABP end-devices are not provisioned with the root keys, instead, they are provisioned with a set of session keys. The session keys remain the same throughout the lifetime of an ABP end device.

{% hint style="info" %}
Find out more about [TTN Addressing & Activation](https://www.thethingsnetwork.org/docs/lorawan/addressing.html).
{% endhint %}

### Security Keys

LoRaWAN 1.0 specifies a number of security keys: `NwkSKey`, `AppSKey` and `AppKey`. All keys have a length of 128 bits (16 bytes).

The **Network Session Key** (`NwkSKey`) is used for interaction between the Node and the Network Server. This key is used to validate the integrity of each message by its Message Integrity Code (MIC check). This MIC is similar to a checksum, except that it prevents intentional tampering with a message. For this, LoRaWAN uses AES-CMAC.

The **Application Session Key** (`AppSKey`) is used for encryption and decryption of the payload. The payload is fully encrypted between the Node and the Application Server component.

Dynamically activated devices (OTAA) use the **Application Key** (`AppKey`) to derive the two session keys during the activation procedure.

Devices using ABP require both the **Network Session Key** (`NwkSKey`) and the **Application Session Key** (`AppSKey`) to be provided.

{% hint style="info" %}
Find out more about [TTN LoRaWAN Security](https://www.thethingsnetwork.org/docs/lorawan/security.html).
{% endhint %}

### Supported versions per carrier

<table><thead><tr><th></th><th data-type="checkbox">LoRa 1.0.x</th><th data-type="checkbox">LoRa 1.1.x</th></tr></thead><tbody><tr><td>Swisscom / Generic Actility</td><td>true</td><td>false</td></tr><tr><td>TTN</td><td>true</td><td>true</td></tr><tr><td>Loriot</td><td>true</td><td>true</td></tr><tr><td>Everynet</td><td>true</td><td>false</td></tr></tbody></table>

### Classes

The LoRaWAN specification defines three device types. All LoRaWAN devices must implement Class A, whereas Class B and Class C are extensions to the specification of Class A devices.

**Class A** devices support bi-directional communication between a device and a gateway. Uplink messages (from the device to the server) can be sent at any time (randomly). The device then opens two receive windows at specified times (1s and 2s) after an uplink transmission. If the server does not respond in either of these receive windows, the next opportunity will be after the next uplink transmission from the device. The server can respond either in the first receive window, or in the second receive window, but should not use both windows.

**Class B** devices extend Class A by adding scheduled receive windows for downlink messages from the server. Using time-synchronized beacons transmitted by the gateway, the devices periodically open receive windows.

**Class C** devices extend Class A by keeping the receive windows open unless they are transmitting. This allows for low-latency communication but is many times more energy-consuming than Class A devices.

{% hint style="info" %}
Find out more about[ TTN LoRaWAN Classes](https://www.thethingsnetwork.org/docs/lorawan/classes.html).
{% endhint %}


# Connectivity Management

This page describes the basic functionality and principles of akenza's connectivity management

On akenza, two options are possible to make use of **LPWAN network providers** for device connectivity:

1. [Connectivity-as-a-Service](#connectivity-as-a-service)
2. [Integrations](#integrations)

## 1. Connectivity-as-a-Service

With [Connectivity-as-a-Service](https://akenza.io/features/connectivity-as-a-service) (CaaS), akenza offers a selected number of network providers which can be used out of the box on [Data Flow](https://docs.akenza.io/device-management/your-data-flow) level as [device connector](#device-connectors).

{% hint style="success" %}
CaaS allows one to quickly get started with an IoT project without the need of setting up an individual account for a network provider.
{% endhint %}

Akenza currently offers CaaS for the following integration providers:

* Swisscom LoRaWAN
* Loriot
* The Things Network
* EWZ

![CaaS provider on Data Flow](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-16874036c61d0c1a6729941c720db56fe27624bb%2Fcaas-provider-data-flow.png?alt=media)

## 2. Integrations

{% content-ref url="/pages/6qtMobMJjtbtv5c2ykpO" %}
[Integrations](https://docs.akenza.io/device-management/integrations)
{% endcontent-ref %}


# Swisscom LoRaWAN

This page describes the use of Swisscom LoRaWAN as connectivity provider in akenza

{% hint style="success" %}
Swisscom provides a swiss wide Low Power Network (LPN) over LoRaWAN. It already covers more than 96% of the area of switzerland, making it one of the biggest public available LoRa networks in Switzerland.
{% endhint %}

On akenza, two options are available to make use of the **Swisscom LoRaWAN network**:

1. [Connectivity-as-a-Service](#connectivity-as-a-service)
2. [Connecting own account](#connecting-own-account)

### 1. Connectivity-as-a-Service

The **Swisscom LoRaWAN network** can be chosen on akenza as [Connectivity-as-a-Service](https://akenza.io/features/connectivity-as-a-service) (CaaS). Therefore, *Swisscom CaaS* needs to be selected on a [Data Flow](https://docs.akenza.io/device-management/your-data-flow) as [device connector](#device-connectors).

{% hint style="success" %}
CaaS allows one to quickly get started with an IoT project without the need of setting up an individual account for a network provider. The LoRaWAN account gets managed through akenza. Device connectivity prices will be invoiced automatically through akenza. **Additional connectivity costs** will occur by using Swisscom LoRaWAN.
{% endhint %}

### 2. Connecting own account

The seamless integration from the LoRa network into akenza makes the management of already connected IoT devices and new projects effortless.

In order to manage a Swisscom LoRaWAN account, you will need to create a service account first. Click on Administration and then on Service Accounts in your Swisscom portal. There you should be able to create a new one. The service account needs to be able to modify Devices, groups and connections so give it those rights while creating it.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-0545df14af45e15683bd763dce9c2942e778593e%2Fswisscom-lpn-service-account.png?alt=media" alt=""><figcaption><p>Service account creation</p></figcaption></figure>

Next you will need to enter your generated credentials into akenza.

{% hint style="warning" %}
The Client secret is never stored in akenza!
{% endhint %}

![Integration login](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-018cae8f0404112618b675cb782e0ec7bc9c21f2%2Fswisscom-lpn-integration-login.png?alt=media)

Once the credentials are entered, the integration name and how the data is processed can be specified in the next step.

If the checkbox *Process Data in akenza* is selected, the data will be forwarded to akenza. This only affects devices created through akenza and has no impact on already registered devices.\
If this option is unselected, the data will not be forwarded to akenza. Instead, devices created through akenza will have the default data route assigned, which can be configured on the Swisscom system.\
Alternatively, during the setup of the integration, a new data route can be created. If this option is chosen, the newly created data route will be assigned to all devices created through akenza (in addition to the data route forwarding the data to akenza, if specified).

![Account details](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-08a52b856974deafc5a8397bdfa70c3c81365349%2Fswisscom-lpn-account-details.png?alt=media)

When creating a data route, the content type and destination can be specified.<br>

{% hint style="warning" %}
**It is highly encouraged to use uplink and downlink security.** Otherwise, IoT devices and applications can be compromised.
{% endhint %}

The **Application Server ID** can be any string, however, it would be best if a long and random generated string is used instead.

The **Application Server Key** needs to be a HEX string consisting of 32 characters. The functionality to generate such a random key is provided by akenza.

![Creation of Data Route](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-578b2dea013cd5ac55c5e0a51043381837df40bc%2Fswisscom-lpn-data-route.png?alt=media)

After the setup, the integration gets created and the initial synchronization will start. Depending on how many devices are registered, the process can take a few minutes.

Once the synchronization succeeds, all devices will be displayed in the overview of the tab *Assets*. The devices can now be managed on akenza.


# The Things Network

This page describes the use of The Things Network as connectivity provider in akenza

{% hint style="success" %}
TTN is an **open global LoRaWAN network** and **community** provided in various countries around the world. Their network servers are **free of charge** without any restrictions. TTN also offers paid services and self-hosting options.
{% endhint %}

On akenza, two options are available to make use of **The Things Network**:

1. [Connectivity-as-a-Service](#connectivity-as-a-service)
2. [Connecting own account](#connecting-own-account)

## 1. Connectivity-as-a-Service

**The Things Network** can be chosen on akenza as [Connectivity-as-a-Service](https://akenza.io/features/connectivity-as-a-service) (CaaS). Therefore, *TTN CaaS* needs to be selected on a [Data Flow](https://docs.akenza.io/device-management/your-data-flow) as [device connector](#device-connectors).

{% hint style="success" %}
CaaS allows one to quickly get started with an IoT project without the need of setting up an individual account for a network provider. The LoRaWAN account gets managed through akenza. Device connectivity prices will be invoiced automatically through akenza. **No connectivity costs** will occur by using The Things Network.
{% endhint %}

## 2. Connecting own account

The seamless integration from the LoRa network into akenza makes the management of already connected IoT devices and new projects effortless.

{% hint style="warning" %}
**Please note that the integration of TTN requires an account from The Things Stack**. Old accounts can no longer be used to integrate with akenza. To check how to migrate the existing IoT deployment into The Things Stack, please contact their support.
{% endhint %}

### 2.1 Authentication

The authentication of a TTN account is offered in multiple ways in the tab of *Integrations*:

[2.1.1 Organization ID and API key](#2.1-organization-id-and-api-key)

[2.1.2 Application ID and API key](#2.2-application-id-and-api-key)

[2.1.3 User ID and API key](#2.3-user-id-and-api-key)

![TTN Integration login](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-b6dc41cfebeb238be6b8619227d428e459e04b08%2Fttn-integration-login.png?alt=media)

#### 2.1.1 Organization ID and API key

The appropriate **organization ID** and **API key** need to be provided in order to connect the akenza integration to a specific TTN organization. The API key has to have all current and further access rights.\
The authentication requires an **organization API key** or **personal API key** which can be deleted once the integration setup on akenza has been completed.\
This method will create a **new application, a webhook, and an API key**. The newly created API key will be stored encrypted in akenza for further communication.

{% hint style="warning" %}
The API key and webhook in the TTN application should not be modified nor deleted, as this may result in breaking the integration that has been set up in akenza.
{% endhint %}

#### 2.1.2 Application ID and API key

The appropriate **organization ID** and **API key** with the necessary permissions need to be provided in order to connect the akenza integration to a specific TTN organization.\
Please note that either a **personal API key** or an **application API key** to authorize using this method can be used.\
This method will create a **new webhook only**. The API key will be stored encrypted in akenza for further communication.

{% hint style="warning" %}
The API key and webhook in the TTN application should not be modified nor deleted, as this may result in breaking the integration that has been set up in akenza.
{% endhint %}

#### 2.1.3 User ID and API key

To create a new application for the akenza integration, a **TTN user ID** is necessary to authorize selectively. The API key has to have all current and further access rights.

A **personal API key** is needed for authentication, which can be deleted once the integration is completely set up on akenza. The permissions for the **personal API key** can be seen below.\
This method will create a **new application, a webhook,** and an **API key**. The newly created API key will be stored encrypted in akenza for further communication.

{% hint style="warning" %}
The API key and webhook in the TTN application should not be modified nor deleted, as this may result in breaking the integration that has been set up in akenza.
{% endhint %}

![API key on TTN account](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-18c9ad9948e1ff422803841eb95fac4899b29347%2Fttn-api-key.png?alt=media)

### **2.2 Integration login on akenza**

After verification of provided credentials, the integration name can be specified.

If *Create Integration* gets selected, everything will be set up on the TTN servers by akenza automatically.

An Integration in the application or organization will be created (depending on the chosen authentication method) on the TTN servers which are used to forward the IoT device data to akenza.

After the setup, the integration gets created and the initial synchronization will start. Depending on how many devices are registered, the process can take a few minutes.

Once the synchronization succeeds, all devices will be displayed in the overview of the tab *Assets*. The devices can now be managed on akenza.


# Loriot

This page describes the use of Loriot as connectivity provider in akenza

{% hint style="success" %}
Loriot provides a global Low Power Network (LPN) over LoRaWAN. The use of the community server is offered for free. For a private LoRa network, the own server can be purchased.
{% endhint %}

On akenza, two options are available to make use of the **Loriot LoRaWAN network**:

1. [Connectivity-as-a-Service](#connectivity-as-a-service)
2. [Connecting own account](#connecting-own-account)

### 1. Connectivity-as-a-Service

The **Loriot LoRaWAN network** can be chosen on akenza as [Connectivity-as-a-Service](https://akenza.io/features/connectivity-as-a-service) (CaaS). Therefore, *Loriot CaaS* needs to be selected on a [Data Flow](https://docs.akenza.io/device-management/your-data-flow) as [device connector](#device-connectors).

{% hint style="success" %}
CaaS allows one to quickly get started with an IoT project without the need of setting up an individual account for a network provider. The LoRaWAN account gets managed through akenza. Device connectivity prices will be invoiced automatically through akenza. **No connectivity costs** will occur by using the Loriot Network.
{% endhint %}

### 2. Connecting own account

The seamless integration from the LoRa network into akenza makes the management of already connected IoT devices and new projects effortless.

Two authentication methods to set up the integration are provided:

* Username and password
* API key (to be created in *Account - API keys* of Loriot)

When authenticating with a username and password, akenza creates an API key on the Loriot server which is used for further communication.\
When authenticating with an API key, the key is stored encrypted in akenza and used for further communication with the Loriot system.

{% hint style="warning" %}
The username and password are not stored in akenza.
{% endhint %}

The appropriate host can be selected or if applicable, the URL has to be entered from the own Loriot server. Furthermore, the preferred authentication method can be chosen.

![Loriot integration setup](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-3616042519e153aee62661025e295f22b9ed1c4b%2Floriot-integration-setup.png?alt=media)

After the credentials have been verified, the integration name can be introduced and the application on the Loriot server selected. A new application can be created, or in the case of an already existing IoT project, there is the option to directly connect to the existing one.

In the case of a new application, a name and the specification of the maximal device capacity of the application are given. Whether or not to process the data in akenza and/or send it to a 3rd party system instead, can also be specified.

If processing the data in akenza is chosen, each device created through akenza will forward its data to akenza.

If the data shall be processed in a different way, the data routing can be set in the Loriot account.

When creating a new data route, the destination URL and authorization header need to be set.\
Noting that the authorization header will be in the following format:

```
curl -H "Authorization: <the field value>" https://<the-url>
```

{% hint style="info" %}
Other custom headers can't be added.
{% endhint %}

![Account details of integration setup](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-d006b4e567779670ab23c6dae6fc5f2eb8bb4ac8%2Floriot-account-details.png?alt=media)

After the setup, the integration gets created and the initial synchronization will start. Depending on how many devices are registered, the process can take a few minutes.

Once the synchronization succeeds, all devices will be displayed in the overview of the tab *Assets*. The devices can now be managed on akenza.


# Actility’s ThingPark Wireless

This page describes the use of Actility’s ThingPark Wireless as connectivity provider in akenza

{% hint style="success" %}
Actility is powering a vast majority of public LoRaWAN® networks through its **ThingPark Wireless LPWAN core network platform** for Service Providers.
{% endhint %}

The seamless integration from the LoRa network into akenza makes the management of already connected IoT devices and new projects effortless.

### Connecting own account

In order to manage an Actility’s ThingPark Wireless LoRaWAN account, only the **profile ID**, **Client ID,** and **Client secret** are required.

#### Creating a service account

First you will need to create a service account. Log into your Actility instance for this and go onto the administration panel where you will be able to add a new service account. The only rights needed for it are "Devices, multicast groups and connections manager" & "Viewer".

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2f55da68d208b3c1c31673dbfb2fb03aace0a946%2Factility-service-account.png?alt=media" alt=""><figcaption></figcaption></figure>

**Finding your Profile ID**\
The Profile ID identifies the ThingPark instance your account lives on. If you don't know your Profile ID, you can look it up directly on your ThingPark host. The endpoint is public and requires no token:

```
curl -s https://<portal-host>/thingpark/dx/admin/latest/api/profiles
```

Use the same host you see in your browser's address bar when you log in to the ThingPark portal. The response returns the Profile ID in the `id` field:

```
[
  {
    "id": "community-api",
    "description": "TPE environment",
    "homepage": "community.thingpark.io",
    "owner": "Actility",
    "operatorId": "actility-tpe-ope"
  }
]
```

**List of Profile IDs**\
This is mostly dependant on your host. Following is a list with all standard ones.

**ThingPark Enterprise SaaS**\
EU -> tpe-eu-api\
US -> tpe-us-api\
AU -> tpe-au1-api\
\
**ThingPark Community SaaS**\
community-api\
\
**Dedicated Enterprise Tenant**\
yourHostsName-api

![Actility integration setup](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-8863a9c76096c43ee8529f29175439df588bacba%2Factility-integration-setup-form.png?alt=media)

After verification of provided credentials, the integration name can be specified.

If *Create Integration* gets selected, everything will be set up on the Actility servers by akenza automatically.

If the checkbox *Process Data in Akenza* is selected, the data will be forwarded to akenza. This only affects devices created through akenza and has no impact on already registered devices.\
If this option is unchecked, the data will not be forwarded to akenza. Instead, devices created through akenza will have the default data route assigned, which can be configured on the Actility system.\
Alternatively, during the setup of the integration, a new data route can be created. If this option is checked, the newly created data route will be assigned to all devices created through akenza (in addition to the data route forwarding the data to akenza, if specified).

When creating a data route, the content type and destination can be specified.

{% hint style="warning" %}
It is highly encouraged to use uplink and downlink security. Otherwise, IoT devices and applications can be compromised.
{% endhint %}

The **Application Server ID** can be any string, however, it would be best if a long and random generated string is used instead.

The Application Server Key needs to be a **HEX string consisting of 32 characters**. The functionality to generate such a random key is provided by akenza.

After the setup, the integration gets created and the initial synchronization will start. Depending on how many devices are registered, the process can take a few minutes.

Once the synchronization succeeds, all devices will be displayed in the overview of the tab *Assets*. The devices can now be managed on akenza.


# EWZ

{% hint style="info" %}
Work in progress
{% endhint %}


# Cibicom

{% hint style="info" %}
Work in progress
{% endhint %}


# Helium

This page describes the use of Helium as connectivity provider in akenza

{% hint style="success" %}
[Helium](https://www.helium.com/) is a global, distributed network of Hotspots that creates public, long-range wireless coverage for LoRaWAN-enabled IoT devices. Hotspots produce and are compensated in HNT, the native cryptocurrency of the Helium blockchain.

You will find more information about Helium [here](https://docs.helium.com/).
{% endhint %}

This page describes how to connect the Helium console account to akenza.

The following steps are explained in more detail:

1. [Create a data flow](#1.-create-a-data-flow)
2. [Create a device](#create-a-device-on-akenza)
3. [Create integration on the Helium console](#create-integration-on-the-helium-console)

### 1. Create a data flow

Go to *Data Flow* and select *Create Data Flow*. Select **LoRa** as a device connector and Helium as a connectivity provider accordingly.

![LoRa device connector on Data Flow](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-404fa96312417cc990709064c32423c041325f6b%2Fhelium-data-flow-device-connector.png?alt=media)

Proceed with selecting your desired device type for payload parsing and the output connector to define the data destination.

{% hint style="info" %}
Find out more about output connectors [here](https://docs.akenza.io/device-management/your-data-flow/connectors).
{% endhint %}

![Output Connector on Data Flow](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-51f13e1423131bdeca123072890b63c6b693156f%2Fhelium-data-flow-output-connector.png?alt=media)

Proceed now with the creation of your device on akenza in *Assets*.

### 2. Create a device

Go to *Assets* on akenza and select *Create Device*. Give a name to your device and optionally a description, tags, or a custom field. Select your newly created HTTP Data Flow.

The final step to creating the new device is to enter the **Device EUI** from the existing device on your **Helium console**.

{% hint style="warning" %}
**Important:** This is not the ID on the Console device page, but the **Device EUI**. Copy the Device EUI on the Console device page.
{% endhint %}

![Device details on Helium console](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-3fc1862a01109a50b0bde12860401936c2205050%2Fhelium-device-details.png?alt=media)

Your device will now be displayed on akenza on the **Asset Inventory Overview**.

Copy now the **Uplink Secret** of your Helium device connector on your data flow on akenza.

### 3. Create integration on the Helium console

Go to *Integrations* on your Helium console and create a new Integration by selecting the **prebuilt integration** of *akenza*.

![Akenza Integration](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-5ce5a539238468050a72c0e055c7255565a9a436%2Fhelium-create-integration.png?alt=media)

Insert the copied **Uplink Secret** in the field of the **Endpoint Details** in Step 2 and save the Integration Connector.

#### 3.1 Connect the akenza integration to your device <a href="#connect-akenza-integration-to-device" id="connect-akenza-integration-to-device"></a>

The final step to completing the integration with a device is to create a **flow connection** on the Helium console. Navigate to *Flows* on Console, add the device and integration nodes, and finally connect both of them as shown below.

![Flows on Helium console](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-54cee63546a6843b8af1a56a697b7c0b9fe6e276%2Fhelium-flows.png?alt=media)

The Helium console integration is now connected to the **Data Flow** on akenza. The device is also created and is receiving data once the device transmits an uplink.

Incoming data can be viewed on the **Device Detail Page** on akenza by selecting the device on the **Asset Inventory Overview** within *Assets*.

![Device Detail Page](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-281d6f4a7058d411733d7af5389611883f713ae5%2Fhelium-device-detail-page.png?alt=media)


# ChirpStack


# NB-IoT

{% hint style="info" %}
Work in progress
{% endhint %}


# mioty

{% hint style="info" %}
Work in progress
{% endhint %}


# Disruptive Technologies

{% hint style="info" %}
Work in progress
{% endhint %}


# VergeSense

{% hint style="info" %}
Work in progress
{% endhint %}


# Spaceti

{% hint style="info" %}
Work in progress
{% endhint %}


# Haltian

{% hint style="info" %}
Work in progress
{% endhint %}


# Device Types

This page describes Device Types in more detail

**Device Types** extract, transform and normalize the data sent from the device.

To reduce energy consumption and keep the data packets as small as possible, **LPWAN devices** send their data via a payload encoded in **hexadecimal** format. This differs from other protocols that define standard data payload formats and communicate through structured data such as **JSON** or **XML**.\
In the case of **HTTP** or **MQTT**, the payload generally does not have a predefined structure. Therefore "passthrough" can be selected when a **Data Flow** gets created.

More information about payload decoding can be found in this [blog](https://akenza.io/blog/payload-decoding).

### Device Type Library

Akenza offers a variety of predefined **Device Types** available on the [Device Type Library](https://akenza.io/features/device-type-library). The logic is predefined based on device specifications. No additional processing logic will be required. The **Device Type Library** can be accessed when creating a Data Flow.

**Passthrough** device types pass along the data to the output connector exactly the same way it was received by the **Device Type**. This is useful for devices that already send a **JSON structure** and do not require any additional processing.

If the payload needs to be decoded of a device, which is not available on the **Device Type Library**, a [**Custom Device Type**](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type) (CDT) can be created. This CDT gets available on the organization level.

![Device Type Library within a Data Flow](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-1956e3beb4cd8eff1e6763cbe08ae7e3342f8738%2Fdevice-type-library.png?alt=media)


# Custom Device Types

This page describes the principle and functionality of Custom Device Types

### Introduction

Akenza supports two types of **Device Types** which extract, transform and normalize the data sent from and to the device, there are **Library** and **Custom** Device Types.

This webinar explains how to create **Custom Device Types** (CDT).

{% embed url="<https://www.youtube.com/watch?v=Nd5wRQ15oA0&t=473s>" %}
Webinar about how to create a custom device type
{% endembed %}

The purpose of **Custom Device Types** is to provide users with the possibility to write their own encoders and decoders for a specific device payload. This kind of device type is available on the organization level. Custom Device Types are managed on the Organization level and are available in all Workspaces within this Organization.

![Custom device type](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-74687451bc8db7f8cba96c76294b9a55021496b4%2Fcustom-device-type.png?alt=media)

In this form besides generic (name, description...) fields, the user is able to provide an **Uplink Decoder** script that decodes the code sent **from** a device and a **Downlink Encoder** script that encodes data sent **to** the device. These scripts have to be written in JavaScript language and demand that the user is somewhat knowledgeable in the technical field. Besides generic fields and the scripts, the user is able to provide some additional **advanced** fields like the type of Connectivity, Author, Manufacturer, Sensor Urls, Available Sensors, etc. and thus setting a more specific definition of a CDT.

To make the data available to the platform, **Topics** and **Data Keys** are used. A Topic is used to group Data Keys together. A Data Key is like a variable, but contains additional metadata and functionality. A Data Key can have **units**, for example cm and a **type**, for example number. They also have a field for a description, can be required and so on. Data Keys and Topics are defined in the **schema definition** of a **Device Type**.\
The name of the Data Keys and Topics used in the script has to **match** the names in the uplink or downlink **schema definition**. Adding these definitions is done in the Akenza platform, after creating a Device Type.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-42b4fb9e02b620bbbe06ac127e8a35beaa6cbae4%2Fcustom-device-type-schema.png?alt=media" alt=""><figcaption></figcaption></figure>

{% content-ref url="/pages/-MUxZzWIOcNZ9JRUUrVj" %}
[Scripting](https://docs.akenza.io/reference/scripting)
{% endcontent-ref %}

### Data Decoding

A Custom Device Type is used to decode data sent by devices and turn it into an actionable and human readable format (uplink decoder) or encode data that is used to send commands to devices (downlink encoder).

Uplink decoders are detailed here:

{% content-ref url="/pages/HIuHOWDjLX1upUUb2NFW" %}
[Uplink](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type/uplink)
{% endcontent-ref %}

Downlink encoders are detailed here:

{% content-ref url="/pages/-MUx\_4bAAuSZPyfly16s" %}
[Downlink](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type/downlink)
{% endcontent-ref %}

The data format of a device is defined by its device type (uplink decoder and downlink encoder). Once a device sends a data point the uplink decoder script of the device type will decode the raw data into a structured JSON format. Device types can either be created by akenza users (custom device type) or an akenza predefined device type can be used (akenza device type library). Alternatively, it is possible to synchronize a custom device type library, which will be available to all users of the akenza deployment (only available for enterprise customers).

#### Topics

In order to store multiple different message formats on a device, each data point is assigned to a topic (e.g. lifecycle information, configuration and measurements), which can then be used at query-time to retrieve data for a specific schema/purpose. It is advised to use one topic per payload type (i.e. always output data with the same structure to the same topic and try to prevent mixing data structures within the same topic). Generally, it is advised to use different topics for data that is not sent in the same message.

#### Data Schema

Each device type defines a data schema per topic. The data schema definition is defined in JSON schema. The schema definition is used throughout the akenza appliction to display and control data. Data types, the value range and units are managed by the data schema and do not have to be stored for every data point. A set of default measurement types is defined in `data-models`, that can be used and extended throughout JSON schemas.

A set of device types can be found here:

<https://github.com/akenza-io/device-type-library>


# Uplink

Uplink decoders are used to decode or "translate" a device-specific payload into a human-readable JSON object (e.g. HEX -> JSON object).

## Script Structure

An uplink decoder script has to implement the function `consume(object)` which takes an `event` object as argument. An error will be returned if the script doesn't implement a `consume(event)` function.

```javascript
function consume(event) {
  emit("sample", { data: {}, topic: "default" });
}
```

The `consume(event)` function is the entry point for the script and will be invoked upon execution. Each execution loads the script again, resetting any variable values which were set in previous runs.

### Decoding the Payload

Here you can see a example to decode the payload from hex to a unsigned integer in this case a counter variable. This variable is added to the data payload and emitted to the default topic.

```javascript
function consume(event) {
  let payload = event.data.payloadHex;
  let bits = Bits.hexToBits(payload);
  const data = {};
  data.counter = Bits.bitsToUnsigned(bits.substr(6, 10)) / 4;
  // emit
  emit("sample", { data: data, topic: "default" });
}
```

### Using the state to calculate increments

When creating a decoder for a device which only sends absolute values you might want to get the relative value for the recent timeframe. Following is a simple example on how to access/save historical values and how to react to them.

```javascript
function calculateIncrement(lastValue, currentValue) {
  // Check if current value exists
  if (currentValue === undefined || Number.isNaN(currentValue)) {
    return 0;
  }

  // Init state && Check for the case the counter reseted
  if (lastValue === undefined || lastValue > currentValue) {
    lastValue = currentValue;
  }
  // Calculate increment
  return currentValue - lastValue;
}

function consume(event) {
  let payload = event.data.payloadHex;
  let bits = Bits.hexToBits(payload);
  const state = event.state || {};
  const data = {};

  data.consumptionCumulative = Bits.bitsToUnsigned(bits.substr(0, 32)) / 1000;
  data.consumption = calculateIncrement(
    state.lastConsumptionCumulative,
    data.consumptionCumulative,
  );
  state.lastConsumptionCumulative = data.consumptionCumulative;

  emit("state", state);
  emit("sample", { data: data, topic: "default" });
}
```

### Uplink Event Object

The uplink event object differs slightly based on connectivity but share the same base structure. Every event contains the following structure:

```typescript
{
    "data": {
        // the data sent in the uplink request
    },
    "device": {
        // device properties
    },
    "uplinkMetrics": {
        // info about the uplink
    },
    "topic": "default", //topic sent along with the event or "default" if not specified
    "timestamp": "iso-8601-date-string"
}
```

#### Example HTTP or MQTT event

The `data` object contains everything which was sent in the request body of the uplink request.

```typescript
{
    "data": {
        "temperature": 12.4,
        "humidty": 85,
	...
    },
    "device": {
	"id": "string", // the akenza id
	"deviceId": "string", // the device id
	"name": "string",
        "description": "string"
    },
    "uplinkMetrics": { // meta information about the uplink forwarded by the carrier
        "deviceId": "string", // the device id
        "uplinkSize": 223, // recieved uplink size in bytes
        "timestamp": "iso-8601-date-string" // Either user defined or defaults to time when the uplink was received at akenza
    },
    "topic": "events",
    "timestamp": "iso-8601-date-string" // Either user defined or defaults to time when the uplink was received at akenza
}
```

#### Example LoRaWAN event

The contents of the `uplinkMetrics` object differs depending on the network provider.

```typescript
{
    "data": {
        "port": 2, // the port specified in the LoRaWAN uplink
        "payloadHex": "aabbcc112233" // the hex string sent by the device
    },
    "device": {
        "id": "string", // the akenza id
        "deviceId": "string", // the device id
        "name": "string",
        "description": "string"
    },
    "uplinkMetrics": { // meta information about the uplink forwarded by the network provider
        "deviceId": "string", // the device id
        "uplinkSize": 223, // recieved uplink size in bytes
        "timestamp": "iso-8601-date-string", // time when the uplink was registered on the gateway
        "latitude": 46.928403,
        "longitude": 7.628662,
        "port": 2,
        "frameCountUp": 14,
        "frameCountDown": 1,
        "rssi": -88.0,
        "snr": 7.75,
        "sf": 7,
        "txPower": 8.0,
        "numberOfGateways": 2,
        "esp": -88.67,
        "sqi": 3
    },
    "timestamp": "iso-8601-date-string" // time when the uplink was registered on the gateway
}
```

#### Example Array Uplink event

When processing an array uplink, the structure is slighly different to other events. The `data` object contains a single property `values` which contains the original array sent in the uplink.

```typescript
{
    "data": {
	"values": [{
            "temperature": 12.4,
	    "humidty": 85,
            ...
	},
	...
	]
    },
    "device": {
	...
    },
    "uplinkMetrics": { // meta information about the uplink forwarded by the carrier
    ...
    }
}
```

## Event examples

### LoRaWAN Device uplink event

A raw LoRaWAN uplink that invokes an uplink decoder script (Custom Device Type), looks as follows:

{% code overflow="wrap" %}

```json
{
  "data": {
    "port": 2,
    "customAttributes": null,
    "payloadHex": "810dac6c000000b010"
  },
  "uplinkMetrics": {
    "id": "8888888888888888",
    "uplinkId": "88888888-8888-8888-8888-888888888888",
    "deviceId": "0000000000000fff",
    "uplinkSize": 364,
    "timestamp": "2025-10-23T12:43:46.083Z",
    "port": 2,
    "frameCountUp": 4325,
    "frameCountDown": 115,
    "rssi": -114,
    "snr": -6,
    "sf": 7,
    "txPower": 16,
    "numberOfGateways": 1,
    "esp": -120.97,
    "sqi": 3
  },
  "topic": "default",
  "device": {
    "customFields": {
      "FloorNumber": 1,
      "SiteId": "AK_OFFICE",
      "SpaceId": "1OGR20"
    },
    "name": "Vicky",
    "description": "Balcony door",
    "id": "0000000000000fff",
    "deviceId": "1122334455667788"
  },
  "timestamp": "2025-10-23T12:43:46.083Z"
}
```

{% endcode %}

### MQTT Device uplink event

A raw MQTT uplink that invokes an uplink decoder script (Custom Device Type), looks as follows:

{% code overflow="wrap" %}

```json
{
  "data": {
    "value": 12.332
  },
  "uplinkMetrics": {
    "id": "8888888888888888",
    "uplinkId": "88888888-8888-8888-8888-888888888888",
    "deviceId": "0000000000000fff",
    "uplinkSize": 15,
    "timestamp": "2025-10-23T12:43:46.083Z"
  },
  "topic": "default",
  "state": {},
  "device": {
    "customFields": {
      "SiteId": "AK_OFFICE"
    },
    "name": "Meter",
    "description": "",
    "id": "0200000000000000",
    "deviceId": "42:D4:FF:0B:81:2E"
  },
  "timestamp": "2025-10-23T12:43:46.083Z"
}
```

{% endcode %}


# Downlink

This page describes the specifications for downlinks

Downlink encoders are used to encode or "translate" a human-readable JSON object into a device-specific payload (e.g. JSON -> HEX payload).

The downlink encoder script follows a similar notation to uplink decoders, however it uses `emit('downlink', payload)` to execute a downlink.

Using the `downlink` emit type has no effect in uplink scripts and custom logic blocks will be ignored and not further processed.

Generally, Downlinks can only be created for LoRa, NB-IoT and MQTT Devices. Downlinks for HTTP and CoAP devices are not supported at this point.

## Output Format

### LoRa Downlinks

The object needs to have a pre-defined structure as shown below.

```typescript
{
    "port": 1, // needs to 0 or any other positive integer
    "confirmed": true, // used for confirmed downlinks and is optional, default false
    "payloadHex": "hex-string" // has to be a hex-string
}
```

If this specification is not followed, an error will be thrown during the forwarding of the downlink object to the LoRaWAN carrier.

### MQTT Downlinks

The object needs to have a pre-defined structure as shown below.

```typescript
{
    "topic": "string", // the MQTT topic
    "payload": {
        // object with any properties
    }
}
```

If this specification is not followed, an error will be thrown during the publishing of the downlink to the MQTT device.

## Example downlink encoder

```javascript
function asciiToHexString(input) {
  let output = "";

  for (let i = 0; i < input.length; i += 1) {
    output += input.charCodeAt(i).toString(16);
  }

  return output;
}

function consume(event) {
  const payload = asciiToHexString(event.payload.message);
  const port = event.port ? event.port : 1;
  const confirmed = event.confirmed ? event.confirmed : false;

  emit("downlink", { payloadHex: payload, port, confirmed });
}
```


# Scripting

See scripting documentation here: [Scripting](https://docs.akenza.io/reference/scripting)


# Schema

{% hint style="info" %}
Work in Progress
{% endhint %}


# Library

You can access the akenza Device Type library on Github: <https://github.com/akenza-io/device-type-library>


# Output Connectors

{% hint style="info" %}
Output connectors are available on both **Data Flow** and **Rule Engine**.
{% endhint %}

**Output Connectors & Actions** define what is done with the results of the device types. There are several options to choose from:

### Data sink

* **AkenzaDB**
  * Store your data in the AkenzaDB to have access to historical data at anytime
* [**Webhook**](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/webhook)
  * Forward data with HTTP to a 3rd party system for further processing or storage
* [**Azure IoT Hub**](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/azure-iot-hub)
  * Select Azure IoT Hub as data entry point to build your application further with Microsoft Azure services
* [**Google Pub/Sub**](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/google-cloud-pub-sub)
  * Select Google Pub/Sub as data entry point to build your application further with Google services
* [**InfluxDB**](https://docs.akenza.io/device-management/your-data-flow/connectors/databases/influxdb)
  * Select InfluxDB as data entry point to build your application further with Influx services
* [**AWS Kinesis**](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/aws-kinesis)
  * Select Amazon Kinesis as data entry point to build your application further with Amazon Web services
* [**Kafka**](https://docs.akenza.io/device-management/your-data-flow/connectors/streaming/apache-kafka)
  * Select Apache Kafka as data sink to forward data to a compatible Apache Kafka cluster

### Notification service

* [**E-Mail**](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/email)
  * Send notifications via E-Mail to one or multiple recipients
* [**SMS**](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/sms)
  * Send notifications via SMS to one or multiple recipients
* [**Microsoft Teams**](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/microsoft-teams)
  * Send notifications to your desired Microsoft Teams channel
* [**Slack**](https://docs.akenza.io/device-management/your-data-flow/connectors/notifications/slack)
  * Send notifications to your desired Slack channel

### Additionally on Rule only

* [**Downlink**](https://docs.akenza.io/device-management/your-data-flow/device-type/device-type/downlink)
  * Downlink to trigger or configure one or multiple devices based on a rule logic

{% hint style="warning" %}
The Output Connector will only trigger the action if a sample with the selected topic is emitted by the device type. Only available topic values will be displayed in the dropdown. If no topic is selected, all data samples will trigger the selected Output Connector.
{% endhint %}

![Output connectors](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-2e12b2d39e8c7ee829305847fbd3fef1db7db97a%2Foutput-connectors.png?alt=media)

###


# Databases


# akenza DB

Use the akenza DB connector to store device data on akenza. Having the akenza DB connected is a prerequisite to profit from device management features and to visualize data using dashboards.


# InfluxDB

Send data to an InfluxDB

![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-78947eb11a2832ca9124c0e3ab535fcf4c47bba4%2Fbadge-advanced.png?alt=media) ![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e23ef25fd624d203223cbf578347111c61ea28a1%2Fbadge-expert.png?alt=media)

The **InfluxDB** Output connector can be used to forward data to an InfluxDB. The InfluxDB connector is available in both **Data Flow** and **Rule Engine**.

The InfluxDB connector requires

* the **URL or IP address** under which the database can be reached
* the Influx **Organization: ID or email**
* the **bucket** where the data should be stored
* the **Influx API Token** with **write access** to the bucket
* the **Measurement Name** is an optional value. If it is not set, the topic of the data sample is used
* the Mode which is either Event (triggered when a data sample is arriving) or Aggregation (the data is sent every 1 hour with an aggregated value (which?)).
* The last value that can be set is the custom payload. If no custom payload is set, the data part of the sample will be used. All data keys present in the sample will be saved as fields in InfluxDB.
* If a subset of the data keys or differently named data keys should be saved, the custom payload templated can be used.

The tags `akenzaDeviceId`, `deviceId` and `deviceId` are automatically created and populated.

**Standard Example**

Send a data sample to the InfluxDB without Measurement and without payload formatting:

```
// Translates to line protocol
// general format
<measurement>,[tags] <data key name>=<data key value> <timestamp>
// This example translates to
default,akenzaDeviceId=02b12aa91a7494eb,deviceId=C81758FFFE09845A,deviceName=desksensor occupancy=0 1765286099000
```

**Advanced Example**

Save a field named 'desk\_occupancy' to InfluxDB. Adapt the custom payload as follows:

```
// Custom payload
{
 "desk_occupancy": {{data.occupancy}} 
}
```

**Restrictions and Troubleshooting**

Measurement names, tags, fields must not begin with underscore (`_)`.

Be aware of duplicates, make sure a point is always structured in the same way, as conflicts or errors can arise if data types or field sets are changing. If the output connector throws an error, check in the InfluxDB console or UI where it comes from. Resolving an error might include deleting some inconsistent data first.

Be aware of changing data types. A field must always use the same types. A common error is a field saved in a different data type once and the output connector will be unable to save this field in a new data type. If the output connector is unable to write, check the affected field for a different data type. This can happen if the payload template can not be resolved completely and an error message is saved as field value.

A tutorial about "How to send data to InfluxDB" can be found [here](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-influxdb).

![InfluxDB template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-fb8240e5d89ac9e09977ab49965079899cd062a7%2Fconnector-influxdb.png?alt=media)


# SQL Databases

The follwing SQL databases are supported:

* Microsoft SQL Server
* MySQL
* MariaDB
* PostgreSQL
* timescaleDB
* OracleSQL


# Snowflake

The akenza Snowflake connector enables direct ingestion of device telemetry into the Snowflake Cloud Data Platform for large-scale analytics and cloud-native data warehousing.

The connector uses the [Snowflake Snowpipe Streaming API](https://docs.snowflake.com/en/user-guide/snowpipe-streaming/data-load-snowpipe-streaming-overview) to continuously ingest device data with low latency and high throughput (check its [high-performance architecture](https://docs.snowflake.com/en/user-guide/snowpipe-streaming/snowpipe-streaming-high-performance-overview)).

This allows sensor data processed by akenza to be written directly into Snowflake tables without intermediate storage layers.

#### Setup

Follow the steps below to configure Snowflake for use with the akenza Snowflake connector.

{% hint style="info" %}
Prerequisites:\
Before configuring the Snowflake connector, make sure you have access to a Snowflake account.\
If you do not already have a user, you will first need to create one.

Snowflake users can be created by an account administrator. The process is straightforward and can be done throught the **Snowsight** UI. Please follow the instructions in the [Snowflake documentation](https://docs.snowflake.com/en/user-guide/admin-user-management#creating-users).\
\
This guide explains how to create and manage users in Snowflake using Snowsight.
{% endhint %}

#### Create the database and table

Create a database and a table that will store the incoming device data.

{% hint style="info" %}
The table schema must match the structure of the `custom payload` defined in the akenza Snowflake output connector configuration. Each field defined in the custom payload must correspond to a column in the target Snowflake table, and the data types must be compatible.
{% endhint %}

```sql
CREATE DATABASE <database_name>;

CREATE SCHEMA <schema_name>;

CREATE TABLE <database_name>.<schema_name>.<table_name> (
    <col_name> <col_type>,
    <col_name> <col_type>,
    ...
);
```

**Example**

```sql
CREATE DATABASE TEST_DATABASE;

CREATE SCHEMA TEST_SCHEMA;

CREATE TABLE TEST_DATABASE.TEST_SCHEMA.TEST_TABLE (
    DEVICE_ID VARCHAR,
    TEMPERATURE FLOAT,
    TIMESTAMP TIMESTAMP_TZ
);
```

**Example custom payload**

```json
{
    "DEVICE_ID": {{device.id}},
    "TEMPERATURE": {{data.temperature}},
    "TIMESTAMP": {{timestamp}}
}
```

The names in the payload **must match the column names used in the Snowflake table**, as these fields are mapped directly when the data is ingested through Snowpipe Streaming.

#### Create the Snowpipe Streaming pipe

Create a pipe that reads data from the Snowpipe Streaming data source.

```sql
CREATE OR REPLACE PIPE <database_name>.<schema_name>.<pipe_name>
AS COPY INTO <database_name>.<schema_name>.<table_name>
FROM (
    SELECT
        $1:<col_name>,
        $1:<col_name,
        ...
    FROM TABLE(DATA_SOURCE(TYPE => 'STREAMING'))
);
```

**Example**

```sql
CREATE OR REPLACE PIPE TEST_DATABASE.TEST_SCHEMA.TEST_PIPE
AS COPY INTO TEST_DATABASE.TEST_SCHEMA.TEST_TABLE
FROM (
    SELECT
        $1:DEVICE_ID,
        $1:TEMPERATURE,
        $1:TIMESTAMP
    FROM TABLE(DATA_SOURCE(TYPE => 'STREAMING'))
);
```

This pipe defines how incoming streamed data is mapped to the columns of the target table.

Each field referenced with `$1:<field_name>` corresponds to a field in the JSON payload sent to Snowflake via Snowpipe Streaming. The field names must match the fields used in the custom payload described in the previous section.

#### Create a role with required privileges for Snowpipe Streaming ingestion

To follow the principle of least privilege, it is recommended to create a dedicated role that only allows the connector to ingest data through the Snowpipe Streaming pipe. This role will be assigned to a service user used by the connector.

**Create the role**

Create a dedicated role that will be used for Snowpipe Streaming ingestion. This role will have only the privileges necessary to ingest data

```sql
CREATE ROLE <role_name>;
```

**Example**

```sql
CREATE ROLE TEST_ROLE;
```

**Grant required privileges**

Grant the minimal privileges required for the role to access the database, schema, and streaming pipe.

{% hint style="info" %}
**Note:** You have two options to run the commands:

1. **Run each command separately**: place your cursor on a command and execute it. This works fine for all four commands.
2. **Run all commands at once**: **do not just copy and paste all commands and hit run**. If you paste all four and execute without selecting them, only the command where your cursor is will run (usually the last one), which can cause errors.
   {% endhint %}

```sql
GRANT USAGE ON DATABASE <database_name> TO ROLE <role_name>;
GRANT USAGE ON SCHEMA <database_name>.<schema_name> TO ROLE <role_name>;
GRANT OPERATE ON PIPE <database_name>.<schema_name>.<pipe_name> TO ROLE <role_name>;
GRANT INSERT, SELECT ON TABLE <database_name>.<schema_name>.<table_name> TO ROLE <role_name>;
```

**Example**

<pre class="language-sql"><code class="lang-sql">GRANT USAGE ON DATABASE TEST_DATABASE TO ROLE TEST_ROLE;
GRANT USAGE ON SCHEMA TEST_DATABASE.TEST_SCHEMA TO ROLE TEST_ROLE;
<strong>GRANT OPERATE ON PIPE TEST_DATABASE.TEST_SCHEMA.TEST_PIPE TO ROLE TEST_ROLE;
</strong>GRANT INSERT, SELECT ON TABLE TEST_DATABASE.TEST_SCHEMA.TEST_TABLE TO ROLE TEST_ROLE;
</code></pre>

#### Create a Snowpipe Streaming user

Create a user that will be used by the connector to authenticate with Snowflake. The akenza Snowflake connector authenticates using RSA key pair authentication, and supports two key management options: **Managed** and **BYOK** (bring your own key).

{% tabs %}
{% tab title="Managed" %}
akenza generates and manages the RSA key pair. Assign the akenza public key below to the `RSA_PUBLIC_KEY` parameter when you create the Snowflake user.

```sql
CREATE USER <user_name>
DEFAULT_ROLE = <role_name>
DEFAULT_NAMESPACE = <database_name>.<schema_name>
DEFAULT_WAREHOUSE = <warehouse_name>
RSA_PUBLIC_KEY = '<akenza_public_key>';
```

Akenza public key:

```
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvarY+sda3OZsHZGAdoc9mqiClLbs8rVs0MH/lbPYqg8e45hJ1m02vji12DOhEm/mEUzR2r/42I61osBrgBXHMgNsTHW5Mb1A3GXYrEikZv6HBrvx/6ZoVLn6QuKrdZ4dH0FUKO+6sWCu1yQ74i6ixHLqdKJbBr2Bk3ehB5YlqHb7G4TU9XMwzlzYkLMjEFP5OjLNxCMFthvIuugQ39ULcqZk7OUCbZigQdQhihF+TEbG1aDU6MxLcaQx6rB/Fq2a6iw+E9SkFxTFqQbtCi8hT1dy1pZCCKJFjQEQgMhvuLIgywYSD344RSttci/Bo8CZUjtn8prhkSEIFZaUboLN+rfhbzLzTPTfnqqP4umi5mtZRTqhIieGFmuzkOkCrhWSOuvL2l/SjEcVEHdkpIqb2kquK2EdyDZnEX0n1iaGOTe4Mtr9+wvBrMf8OaeGKro2oX4zIugDNMBzAx2duW8mr3cgyGCVX8M/BG3fdvB1cUfspwmVZNZ0IjZrPU0+69wZxgTcOze1ndXmMDTyzsI4EYeNvD02AeaVmDGY5xe57BtOVz0MQRNoCP0GCCSzjbpUXMpaMgZ/2O/UqmWFd5fMqTFtp57h/UxAHV2xln8rh2Z5JXOThK6qzuA4k8ekRfc+9seCIrPrbTAch6RguXu4sv9eHK2gLmMcOp8j6scwMdsCAwEAAQ==
```

In the akenza connector configuration, select **Managed** under **Key management**. No private key needs to be entered in akenza.

**Example**

```sql
CREATE USER AKENZA_USER
DEFAULT_ROLE = TEST_ROLE
DEFAULT_NAMESPACE = TEST_DATABASE.TEST_SCHEMA
DEFAULT_WAREHOUSE = COMPUTE_WH
RSA_PUBLIC_KEY ='MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvarY+sda3OZsHZGAdoc9mqiClLbs8rVs0MH/lbPYqg8e45hJ1m02vji12DOhEm/mEUzR2r/42I61osBrgBXHMgNsTHW5Mb1A3GXYrEikZv6HBrvx/6ZoVLn6QuKrdZ4dH0FUKO+6sWCu1yQ74i6ixHLqdKJbBr2Bk3ehB5YlqHb7G4TU9XMwzlzYkLMjEFP5OjLNxCMFthvIuugQ39ULcqZk7OUCbZigQdQhihF+TEbG1aDU6MxLcaQx6rB/Fq2a6iw+E9SkFxTFqQbtCi8hT1dy1pZCCKJFjQEQgMhvuLIgywYSD344RSttci/Bo8CZUjtn8prhkSEIFZaUboLN+rfhbzLzTPTfnqqP4umi5mtZRTqhIieGFmuzkOkCrhWSOuvL2l/SjEcVEHdkpIqb2kquK2EdyDZnEX0n1iaGOTe4Mtr9+wvBrMf8OaeGKro2oX4zIugDNMBzAx2duW8mr3cgyGCVX8M/BG3fdvB1cUfspwmVZNZ0IjZrPU0+69wZxgTcOze1ndXmMDTyzsI4EYeNvD02AeaVmDGY5xe57BtOVz0MQRNoCP0GCCSzjbpUXMpaMgZ/2O/UqmWFd5fMqTFtp57h/UxAHV2xln8rh2Z5JXOThK6qzuA4k8ekRfc+9seCIrPrbTAch6RguXu4sv9eHK2gLmMcOp8j6scwMdsCAwEAAQ==';
```

{% endtab %}

{% tab title="BYOK" %}
You generate your own RSA key pair and provide the private key directly to akenza. Snowflake only ever receives the public key, akenza only ever receives the private key.

Generate a 2048-bit RSA key pair, for example with OpenSSL:

```bash
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
```

Assign the public key to the Snowflake user with `RSA_PUBLIC_KEY`:

```sql
CREATE USER <user_name>
DEFAULT_ROLE = <role_name>
DEFAULT_NAMESPACE = <database_name>.<schema_name>
DEFAULT_WAREHOUSE = <warehouse_name>
RSA_PUBLIC_KEY = '<your_public_key>';
```

**Example**

```sql
CREATE USER CUSTOMER_USER
DEFAULT_ROLE = TEST_ROLE
DEFAULT_NAMESPACE = TEST_DATABASE.TEST_SCHEMA
DEFAULT_WAREHOUSE = COMPUTE_WH
RSA_PUBLIC_KEY='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2Tkc4Iv8JNV9TDQmxi32r25y4NZsPUQRtV12D9PuVhPbYFxDk67423/Tv6l3Aq9+JDxKy/sTGFAO6jhl/aZssiL2i9oEIITob16TiwSnPqWo1aHWbPkES9Sw3EoXw4TuI19BAWsvEQScAk5fdMPlqFslS/KsNzXIS+4QoImlSakFCDz+q6KaPzHj/lBNfq/H6Wd4061nWdLQ5wiShVDvhXTMlAUKJilKnd3vQLYfT9ECnzMtfuR7LSO5oQPC8NZeCOmYizC62DyoIAe+Yk2CsYF/QR4dE0rEB4WrDMRDLMGkaTvJBRXPdBItn5Vcql7UUtSQYQNG7pBOrTVLq36gQIDAQAB';
```

In the akenza connector configuration, select **BYOK** under **Key management**, then paste the private key in PEM format, including the `BEGIN PRIVATE KEY` and `END PRIVATE KEY` lines:

```
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHZORzgi/wk1X1
MNCbGLfavbnLg1mw9RBG1XXYP0+5WE9tgXEOTrvjbf9O/qXcCr34kPErL+xMYUA7
qOGX9pmyyIvaL2gQghOhvXpOLBKc+pajVodZs+QRL1LDcShfDhO4jX0EBay8RBJw
CTl90w+WoWyVL8qw3NchL7hCgiaVJqQUIPP6ropo/MeP+UE1+r8fpZ3jTrWdZ0tD
nCJKFUO+FdMyUBQomKUqd3e9Ath9P0QKfMy1+5HstI7mhA8Lw1l4I6ZiLMLrYPKg
gB75iTYKxgX9BHh0TSsQHhasMxEMswaRpO8kFFc90Ei2flVyqXtRS1JBhA0bukE6
tNUurfqBAgMBAAECggEAU1NW4ux/UzaHH/F347C3OHq714/7Heezlx5iYm3Gx8pf
WwBSeiut+hOAM4dYUbXNgMA1gJpE0gB8ItJnACXmQh/rzdCs2OU7BgbUQzHIz4Ar
DnQ9GOADyaiwmgtCV0LfO+so2NL0RjLeT6KTO4FFzOmFomy39CQ95Nj31Bdmv0IL
HoomZ3qU5x4HGsT5WqIM2CwhcNgb7evDs9IqK2nIClXjPAMqoLv/HwR7XrA361NC
wKwnBUmZOLXIqXmKT47MFgQGrcqOXHY389JaUI99TEbejqNWrevudgySr66T2Ze2
Lxg7ZrZcVB07O6TvGKqG3ATNd2/f+lTPbIAzHamjTwKBgQDsSzrfgzw9DySzDHrm
AcaZ8cZRIQRAJ7Aw/aFNXN1nBMtYtIcAwPXDj8GoT4q6pz7HMGitFiCwRXVCBAdD
vZ8Gxvd0BvFCDovwvBFZMyXBHjHNLYRGHk66zVpwiMywsJgGFqesHyvW4SO5B2Pv
mLeEXps0MMaCG+s1ufnt+FIJxwKBgQDYBd5t/7BKQoJUkD4bMnOz3mf66McsSxbw
jP4i2GIrLMJZFb3CcaCceKqP0nYr2hNeW1kwbBHWyL5NvzajyKgFWDyGUNhpMLpw
O4TYUiRrbyGvmw789wO/t8wT/Fgj3yLB8HLZ6xajsyeuWVz40rpWpA+2dRSvKrSl
S9ZKLbEZdwKBgDOro70amoKTnCfXE8zWGJKzTvWQrbhFtX6RB8O+CeAsKTdFirv8
dgGEnwlqE2ELj2vJRyqKSy2gkqqT7O7AOVUnDxd9KSaTvcAvr+98gsX/D07ZpDId
EIRCwYMYNwJwK14xeAroahK7+q7MUesjzwWQFopMHCx5ZG7EM0X5Zh8jAoGAdjHv
29u0h00Qplgtww+9wsKDvgMzRwbmzEM4obQnMlxREhEVPJiTOknDeOG8io3NXyk4
CYh30j8P8NYYfVDCrfnzU8JURmnE+Ld4HiwDhUzO75g1gS9eO73CyYSebTIfgGGh
VZ6NSpAxu/FlLzeNgO5PMpOo95a0NGTkIL4TUk0CgYEAutgm78tYH235XCgo0gXj
cWYEUFezQNRRYApgtx6ewjgTCo8OtGfF9QsXS9v40ElYq9HN+rlEwhLykOAbf4bU
XhzaYP7kxlw7zAUqkL4ceyMSMBh315rj9D4ScioY09r8EtsCZTxFBM7x0qR2vHMg
AHFTSHFrNF0fpGMUd9A8C/c=
-----END PRIVATE KEY-----
```

{% hint style="warning" %}
Treat the private key as a secret. Store it safely, and do not share it outside the Snowflake connector configuration in akenza.
{% endhint %}
{% endtab %}
{% endtabs %}

#### Grant the required role

Grant the necessary role to the user.

```sql
GRANT ROLE <role_name> TO USER <user_name>;
```

Example

```sql
-- Managed key
GRANT ROLE TEST_ROLE TO USER AKENZA_USER;

-- BYOK
GRANT ROLE TEST_ROLE TO USER CUSTOMER_USER;
```

#### Verify the configuration (optional step)

You can run the following commands to verify that the user, pipe, privileges, and data ingestion are configured correctly.

```sql
-- Check the user configuration
DESC USER <user_name>;

-- List pipes in the schema
SHOW PIPES IN SCHEMA <database_name>.<schema_name>;

-- Check the privileges granted to the user
SHOW GRANTS TO USER <user_name>;

-- Inspect the data in the target table
SELECT * FROM <database_name>.<schema_name>.<table_name>;

-- Check the number of ingested rows
SELECT COUNT(*) FROM <database_name>.<schema_name>.<table_name>;

-- Optionally, you can sort the query results when inspecting the table data:
SELECT * FROM <database_name>.<schema_name>.<table_name>
ORDER BY <col_name> DESC;

or

SELECT * FROM <database_name>.<schema_name>.<table_name>
ORDER BY <col_name> ASC;
```

### Finding Your Snowflake Account Identifier and URL

To configure a Snowflake output connector, you will need your **account identifier** and **URL**.

You can find both directly in the Snowflake web interface.

1. Log in to your Snowflake account.
2. Look at the account settings (bottom-left corner or as shown in the screenshot below). Navigate to `View account details`. You will see:\
   \- Account identifier - a string like `ZQPUGTG-YF50693`\
   \- Account/Server URL - a hostname like `ZQPUGTG-YF50693.snowflakecomputing.com`
3. Use these values when creating a new Snowflake output connector:\
   \- Account identifier: `<your-account-identifier>`, like `ZQPUGTG-YF50693`\
   \- URL: `<your-account-url>`, like `https://ZQPUGTG-YF50693.snowflakecomputing.com` (prepend `https://` to the hostname)

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-d148de57b3bf7f8284b724de873253771ac0edce%2Fsnowflake-account-identifier.png?alt=media" alt=""><figcaption></figcaption></figure>

### Troubleshooting

If ingestion does not work as expected, check the following link.

* [Troubleshooting Snowpipes](https://docs.snowflake.com/en/user-guide/data-load-snowpipe-ts)


# Streaming


# Webhook

This page describes webhook action in more detail

The webhook action can be used to invoke any third-party **REST API** and sends the sample in the request body.

The HTTP method, multiple custom headers, content type, and authentication method can easily be specified.<br>

Authentication flows (e.g. Oauth2) are not yet supported.

{% hint style="info" %}
The whole sample will be forwarded to the invoked endpoint. Make sure you trust the API in question and don't include sensitive data in the sample.
{% endhint %}

![Webhook template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-6706feb03ccfacb0a4d6d570f4280fe3916511d6%2Fconnector-webhook.png?alt=media)

### Templating

It is possibly the dynamically customize the webhook url by using template variables. For example `https://webhook-url.com?deviceId={{deviceId}}`. Available variables are listed [here](https://docs.akenza.io/reference/message-templating).

Notably, each template will be url encoded.

```
template: https://example.com/{{data.param1}}/{{data.param2}}
data.param1: workspaces
data.param2: devices
result: https://example.com/workspaces/devices
```

Avoid to template the full path as `/` will also be encoded:

```
template: https://example.com/{{data.param1}}
data.param1: workspaces/devices
result: https://example.com/workspaces%2Fdevices
```


# Azure IoT Hub

Process data in the Azure ecosystem

The **Azure IoT Hub connector** can be used to forward data to Azure IoT Hub. It can be applied to process e.g. LoRaWAN device data with Azure IoT Hub and use it further in the [Azure ecosystem](https://azure.microsoft.com/en-us/services/). The Azure IoT Hub connector is available on both **Data Flow** and **Rule Engine**.

Azure IoT Hub has an identity registry that stores information about the devices and modules permitted to connect to the IoT Hub. Every akenza device, using the connector, will therefore be present in the identity registry of the IoT Hub. For identifying a device in the registry the device ID is used. If a device sends data and does not yet exist in the registry of IoT Hub, it will be automatically created.

For creating an Azure IoT Hub connector, the IoT Hub **connection string** needs to be entered, with Registry Read, Registry Write, Service Connect, and Device Connect permissions. Refer to [shared access policies](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-security).

A tutorial about "How to send data to Azure IoT Hub" can be found [here](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-the-azure-iot-hub).

{% hint style="info" %}
The whole data sample will be forwarded to Azure IoT Hub.
{% endhint %}

![Azure IoT Hub template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-ba37a9e9c8256e60b8b01b20f84d1f5c4d994f28%2Fconnector-azure-iot-hub.png?alt=media)


# AWS Kinesis

Process data in the Amazon ecosystem

The **AWS Kinesis connector** can be used to forward data to AWS Kinesis. It can be applied to process e.g. LoRaWAN device data with AWS Kinesis. The AWS Kinesis connector is available on both **Data Flow** and **Rule Engine**.

For creating an AWS Kinesis connector, an IAM Access key is needed with access to a **Kinesis data stream**. Additionally, the ARN for the particular data stream is required. The data will be base 64 encoded.

{% hint style="info" %}
Optionally: The custom payload can be selected for making use of templated payload in the desired structure. If the custom payload is not selected, the whole data sample will be forwarded.
{% endhint %}

A tutorial about "How to send data to AWS Kinesis" can be found [here](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-aws-kinesis).

![AWS Kinesis template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-4fde6018c8c16a0c5b14747613f3373d0ff56e3b%2Fconnector-aws-kinesis.png?alt=media)


# Google Cloud Pub/Sub

Process data in the Google ecosystem

The **Google Cloud Pub/Sub connector** can be used to forward data to [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/docs/overview). It can be applied to process device data with Google Cloud Pub/Sub and use it further in the Google ecosystem. The Google Cloud Pub/Sub connector is available on both **Data Flow** and **Rule Engine**.

Cloud Pub/Sub is a fully managed, real-time messaging service that allows to asynchronously send and receive messages between independent applications.

In order to send data to Google Cloud Pub/Sub, you first need to setup a Pub/Sub Topic and assign the Pub/Sub Publisher role to the akenza service account `akenza-publisher@akenza-connectors.iam.gserviceaccount.com`.

{% hint style="info" %}
Optionally: The custom payload can be selected for making use of templated payload in the desired structure. If the custom payload is not selected, the whole data sample will be forwarded.
{% endhint %}

A tutorial on "How to send data to Google Cloud Pub/Sub" can be found [here](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-the-google-cloud-pub-sub).

![Google Cloud Pub/Sub template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-e3ac53af0d12241e25ba781c855768e4a5219509%2Fconnector-google-cloud-pub-sub.png?alt=media)

### Additional Resources

* Forward data to Big Query by [using a Big Query subscription](https://docs.cloud.google.com/pubsub/docs/bigquery)
* Forward data to Big Query by [using a GCP DataFlow](https://docs.cloud.google.com/dataflow/docs/tutorials/dataflow-stream-to-bigquery)


# Apache Kafka

Process data on Event Hubs as Apache Kafka compatible ecosystem

The **Apache** **Kafka Output connector** can be used to forward data to **Event Hubs**, which provides an endpoint compatible with the **Apache Kafka® producer** and **consumer APIs**. The Kafka connector is available on both **Data Flow** and **Rule Engine**.

The Kafka connector requires at least one **kafka bootstrap server** to be provided in a comma-separated list. It also requires **kafka topic** to which the data will be sent.

For the authentication, a simple username/password authentication mechanism, values for Security Protocol (SASL\_SSL) and SASL mechanism (PLAIN) are fixed and not editable.

Username ($ConnectionString) and password (value of connection string for the event hub namespace) only need to be provided in order to authenticate.

{% hint style="info" %}
Optionally: The custom payload can be selected for making use of templated payload in the desired structure. If the custom payload is not selected, the whole data sample will be forwarded.
{% endhint %}

A tutorial about "How to send data to Event Hubs with Apache Kafka" can be found [here](https://docs.akenza.io/tutorials/create-enterprise-solutions/how-to-send-data-to-event-hubs-with-apache-kafka).

![Apache Kafka template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fgit-blob-7a667e4afde2df9550870da282e5861d7022bc59%2Fconnector-apache-kafka.png?alt=media)




---

[Next Page](https://docs.akenza.io/llms-full.txt/1)

