Skip to main content

Publish an MQTT Message for an nRF9x Device

POST 

/v1/organizations/:organization_slug/projects/:project_slug/long-range/devices/:device_id/mqtt-message

Different API host

Send this request to https://api.nrfcloud.com, not the default Memfault API host.

Publish a message to an MQTT topic for a single Device in a given Project.

The device must be connected to nRF Cloud over MQTT. Requests are rejected if the device is connected over CoAP.

The API constructs the full MQTT topic using the device ID in the path and the subtopic in the request body:

<stage>/<tenantId>/m/d/<deviceId>/<subtopic>

The subtopic must:

  • Contain one to three topic levels separated by /.
  • Use only ASCII letters, digits, :, _, or - within each level.

The full MQTT topic, including the prefix and subtopic, must not exceed 256 bytes.

Provide exactly one of payload or payloadBase64 in the request body. Requests with both fields or neither field, or with unrecognized fields, are rejected.

FieldPayload
payloadA JSON object or array.
payloadBase64A Base64-encoded binary payload.

Use the optional contentType field to set the published message's MQTT content type property to a media type, such as application/cbor. If omitted, no content type is set.


Return Value​

Returns 202 Accepted with the full MQTT topic to which the message was published.

Request​

Responses​

Accepted