Skip to content

nRF Cloud MQTT topics

The MQTT API uses topics. Topics that begin with $aws are AWS reserved topics. All other topics are custom-defined by nRF Cloud.

In the following sections, ${mqttTopicPrefix} is the value of the mqttTopicPrefix JSON field in the response to the FetchAccountInfo endpoint.

Permissions to access these topics are managed by IoT security policies. See Device security for more information.

Topics used by devices running the nRF Cloud library

Devices running the nRF Cloud library, whether through Asset Tracker or a custom application, use the topics in this section.

Shadow topics

The nRF Cloud library supports the following MQTT topics for retrieving and managing the device state through the shadow. See also the AWS documentation regarding MQTT topics reserved for shadows.

Topic Publish Subscribe Purpose
${device_id}/shadow/get/accepted - X Receive a trimmed shadow that contains only essential shadow data.
$aws/things/${deviceId}/shadow/get/rejected - X Receive info about a rejected shadow request.
$aws/things/${deviceId}/shadow/update/delta - X Receive info about changes in the shadow request.
$aws/things/${deviceId}/shadow/get X - Request the device's shadow.
$aws/things/${deviceId}/shadow/update X - Update the device shadow.

After connecting and getting the shadow contents, the device looks for {"pairing":{"state":"paired"}}. If instead it finds {"state":"not_associated"}, the device waits for association. If found, the device derives and stores the c2d and d2c topics.

Message topics

Preface each of these topics with mqttTopicPrefix. nRF Cloud supports messages sent to any topic prefixed with ${mqttTopicPrefix}/m.

Schemas

The following table explains the message topic schemas used by nRF Cloud and devices.

Schema Description
c2d Cloud-to-device
d2c Device-to-cloud
c2g Cloud-to-gateway
g2c Gateway-to-cloud

The nRF Cloud portal, nRF Cloud library, and Asset Tracker application all use /d2c, /d2c/bulk and /c2d. If you want the nRF Cloud portal to work with and properly display these messages, send the data formatted according to /d2c schemas.

Topics

The following table shows supported message topics.

Topic Publish Subscribe Purpose
m/d/${deviceId}/c2d/r - X Receive messages from nRF Cloud not related to Location Services.
Deprecated m/d/${deviceId}/c2d - X This topic is deprecated. See /c2d/r. Receive messages from nRF Cloud.
m/d/${deviceId}/d2c X - Publish messages to nRF Cloud.
m/d/${deviceId}/d2c/bin X - Publish binary logs to nRF Cloud.
m/d/${deviceId}/d2c/bulk X - Publish a batch of messages to nRF Cloud as an array, which republishes each message in the array to the /d2c topic as if each message were published individually. Messages sent to /d2c/bulk are not stored. Useful for ultra-low power (ULP) scenarios. This is currently the only supported bulk processing topic.
gateways/${gatewayId}/c2g - X Receive messages from nRF Cloud. Applies to LTE gateways only.
gateways/${gatewayId}/g2c X - Publish messages to nRF Cloud. Applies to LTE gateways only.

Location Services topics

The following table shows topics related to Location Services.

Topic Publish Subscribe Purpose
/m/d/${​​​​​​deviceId}​​​​​​/agps/r - X Receive A-GPS data from nRF Cloud.
/m/d/${​​​​​​deviceId}​​​​​​/pgps/r - X Receive P-GPS data from nRF Cloud.
/m/d/${​​​​​​deviceId}​​​​​​/wifi/r - X Receive Wi-Fi data from nRF Cloud.
/m/d/${​​​​​​deviceId}​​​​​​/cell_pos/r - X Receive cell data from nRF Cloud.
/m/d/${​​​​​​deviceId}​​​​​​/ground_fix/r - X Receive ground fix data from nRF Cloud.

D2C topics

Topic Publish Subscribe Purpose Example
m/d/${deviceId}/d2c/agps X - Send A-GPS data to nRF Cloud. A-GPS example
m/d/${deviceId}/d2c/pgps X - Send P-GPS data to nRF Cloud. P-GPS example
m/d/${deviceId}/d2c/wifi X - Send Wi-Fi data to nRF Cloud. Wi-Fi example
m/d/${deviceId}/d2c/cell_pos X - Send cell data to nRF Cloud. Cell position example
m/d/${deviceId}/d2c/ground_fix X - Send ground fix data to nRF Cloud. Ground fix example

FOTA topics

These topics relate to the firmware over-the-air (FOTA) update service, which sends an update job that the target device can execute to update its firmware.

Preface each of these topics with mqttTopicPrefix.

Topic Publish Subscribe Purpose
${deviceId}/jobs/rcv - X Receive a FOTA job execution for an IP-based device.
${deviceId}/jobs/ble/rcv - X Receive a FOTA job execution for a Bluetooth® Low Energy (LE) device. Applies to LTE gateways only.
${deviceId}/jobs/req X - Request the current pending job execution for an IP-based device.
${gatewayId}/jobs/ble/req X - Request the current pending job execution for a Bluetooth LE device. Applies to LTE gateways only.
${deviceId}/jobs/update X - Update the status of a job execution for an IP-based device.
${gatewayId}/jobs/ble/update X - Update the status of a job execution for a Bluetooth LE device. Applies to LTE gateways only.

Additional topics supported by nRF Cloud

The following topics are not directly supported by the nRF Cloud library.

Preface each of these topics with mqttTopicPrefix.

Topic Publish Subscribe Purpose
m/# X X Send and receive device messages, and have them automatically stored in the cloud for later retrieval. The nRF Cloud library uses the m/# topic fragment on /d2c and /c2d. nRF Cloud processes and stores any device messages sent over topics that start with the m topic fragment, for example, m/sensor/temperature/room2.
a/connections - X Receive connection events from your devices, informing you when they connected and disconnected.