> For the complete documentation index, see [llms.txt](https://docs.akenza.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.akenza.io/device-management/rule-engine/rule-actions/downlink.md).

# 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](/device-management/your-data-flow.md) 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%2FKTAaPb2DOtGpSZIwr08n%2Fscreely-1685093160937.png?alt=media&amp;token=da26205f-8d9e-4832-aa26-c60565d586b8" 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="/device-management/your-data-flow/device-type.md">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](/reference/message-templating.md) 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="/device-management/your-data-flow/device-type.md">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](/device-management/your-data-flow/device-connector/coap.md#downlinks) for the delivery details.
{% endtab %}
{% endtabs %}


---

# 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
If you need additional information that is not directly available in this page, you can query the documentation 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/device-management/rule-engine/rule-actions/downlink.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.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
