# Data OpenStream API Quickstart

### Setup

* Install or [download](https://mosquitto.org/download/) Mosquitto.

### Credentials <a href="#credentials" id="credentials"></a>

Browse [https://sensecap.seeed.cc](https://wiolora.seeed.cc),  navigate to "User -> Organization -> Secret  Credentials", create a full access "Access Key", set down it as `<Password>`, and also "Organization ID" as `<OrgID>`.

### Receive Devices' Messages <a href="#receive-activations" id="receive-activations"></a>

Let’s listen for all of your devices' messages.

1. Open a terminal window and execute the following command.

{% code title="Shell" %}

```bash
mosquitto_sub \
    -h openstream.api.sensecap.seeed.cc \
    -t '/device_sensor_data/<OrgID>/+/+/+/+' \
    -u 'org-<OrgID>' \
    -P '<Password>' \
    -I 'org-<OrgID>-quickstart' \
    -v
```

{% endcode %}

You should replace `<OrgID>` and `<Password>` with the ones you set down from "Credentials".

2\. Power up devices, while devices keep sending messages, you should see outputs like:

{% code title="Shell" %}

```javascript
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/2CF7F13XXXXXXXXX/4105 {"value":0,"timestamp":1544151824139}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/2CF7F13XXXXXXXXX/4097 {"value":23,"timestamp":1544151900992}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/2CF7F13XXXXXXXXX/4101 {"value":101629,"timestamp":1544151901112}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/2CF7F13XXXXXXXXX/4098 {"value":71,"timestamp":1544151900992}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/2CF7F13XXXXXXXXX/4099 {"value":69.12,"timestamp":1544151902224}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/2CF7F13XXXXXXXXX/4100 {"value":437,"timestamp":1544151922137}
```

{% endcode %}

It shows each data collected by sensors, with `Device EUI` , `Device Channel`,  `Sensor EUI`, `Measurement ID`, `Measurement Value`, and  `timestamp`, see the [reference](/doc/data-openstream-api/api-reference.md#message-topic) for more details.

#### Subscribe a Specific Field

You can also subscribe a specific field in the topic, so that you could get the data from a single device, or a single channel.

{% code title="Shell" %}

```bash
mosquitto_sub \
    -h openstream.api.sensecap.seeed.cc \
    -t '/device_sensor_data/<OrgID>/2CF7F12XXXXXXXXX/#' \
    -u 'org-<OrgID>' \
    -P '<Password>' \
    -I 'org-<OrgID>-quickstart' \
    -v
```

{% endcode %}

You should replace `<OrgId>` and `<Password>` with what you got from "Credentials", and replace `2CF7F12XXXXXXXXX` with the `Device EUI` you own.

🎉 Congratulations! Now you know how to monitor and receive messages via MQTT. Go build something awesome!


---

# 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://sensecap.gitbook.io/doc/data-openstream-api/quick-start.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.
