# MQTT Publish Format V2

{% hint style="success" %}
**Best for Cloud to Cloud transfers**
{% endhint %}

Publishing Data to AlphaX Cloud using is a relatively simple process. The user must format his/her data in the correct way and simply publish it to the AlphaX Cloud MQTT service. The AlphaX system will automatically take care of the rest!

{% hint style="info" %}
NOTE: The user must first enable Conduit using his/her user profile. Follow this article here for help: [**https://minnovation.com.au/knowledge-base/how-to-enable-conduit-for-a-user/**](https://minnovation.com.au/knowledge-base/how-to-enable-conduit-for-a-user/)
{% endhint %}

The user must also enable the MQTT checkbox on the Conduit feature.

The user can now Subscribe/Publish to the the MQTT service at mqtt.alphax.cloud using the credentials provided.

### Publish Topic V2

\<token>/\<device id>/pub/v2

**token \[REQUIRED]:** The unique security token for each user. This is available from the User window in AlphaX. This parameter is required to access the conduit service, if confused about how to get token, please contact the Minnovation Team.

**device id** **\[REQUIRED]**: The unique network ID that is used to register and track the device in the AlphaX system. This parameter is mandatory, if not defined, you will receive an error message.

### Publish Message V2

**payload\[REQUIRED]:** The byte array that contains the data for the publish. The data must assume the standard data format for AlphaX as documented here: <https://minnovation.com.au/knowledge-base/payload/>

#### Formatting the Payload

The data array should be an array of Objects that are configured in the following key:value pair format:

```json
data: [
 {
  channelId : integer; // the channel identifier for the value
  value : number; // the value of the data (16 digit maximum length)
  }
 ]
```

{% hint style="warning" %}
**Note:** AlphaX has several reserved channels. These are outlined in the channel plan help article. Please ensure that channel ID’s are correctly mapped to these channel numbers to take advantage of features such as battery life predictions and auto Geo-Location of devices.
{% endhint %}

{% hint style="info" %}
**Note:** AlphaX has a limit of 16 data channels per device. Should additional channels be required, we suggest splitting the data over 2 seperate data sources.
{% endhint %}

### Example Usage

Publish to mqtt.alphax.cloud

#### Topic

```
xxxxxxxxxxxxxxxxxx/mydevice1234/pub/v2
```

#### Message

```json
"data": [
   {
       "channelId": 1,
       "value": 462.467835
   },
   {
       "channelId": 255,
       "value": 3.976
   }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.alphax.cloud/mqtt/publishing-data/mqtt-publish-format-v2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
