# Device Streams

## Post Device Stream Data

<mark style="color:green;">`POST`</mark> `https://log.brewersfriend.com/stream/:api_key`

This endpoint allows you to post device stream data. The request should be a JSON object. The first time you post to this endpoint a device will be created by the name you set. After that you will select this device in the Brew Session -> Fermentation tab. Replace

*:api\_key*

with your API key.

#### Headers

| Name         | Type   | Description                                         |
| ------------ | ------ | --------------------------------------------------- |
| Content-Type | string | application/json                                    |
| X-API-KEY    | string | If not in the url then it can be added as a header. |

#### Request Body

| Name            | Type   | Description                                        |
| --------------- | ------ | -------------------------------------------------- |
| bpm             | number | Bubbles Per Minute for Plaato like devices.        |
| device\_source  | string | Tilt, iSpindel, Floaty, DS18B20 Sensor, etc.       |
| report\_source  | string | MyBrewBot, Fermentrack, BrewBench, etc.            |
| heat\_state     | string | heating, cooling, off                              |
| temp\_target    | number | Target Temperature, same unit as temp\_unit.       |
| gravity\_target | number | Target Gravity, same unit as gravity\_unit.        |
| og              | number | Original Gravity, same unit as gravity\_unit.      |
| hysteresis      | number |                                                    |
| psi             | number | Fermenter PSI.                                     |
| ambient         | number | Room ambient temperature, same unit as temp\_unit. |
| name            | string | Name of your streaming device.                     |
| temp            | number |                                                    |
| temp\_unit      | string | C (default) or F for Celsius or Fahrenheit         |
| gravity         | number |                                                    |
| gravity\_unit   | string | P (default) or G for Plato or Gravity              |
| ph              | number |                                                    |
| comment         | string |                                                    |
| beer            | string |                                                    |
| battery         | number |                                                    |
| RSSI            | number |                                                    |
| angle           | number |                                                    |

{% tabs %}
{% tab title="200 Reading successfully posted." %}

```javascript
{
    "message": "success",
    "detail": "Saved 5c5b7d4f6ea3a6e58c08a702"
}
```

{% endtab %}

{% tab title="400 There is an issue with data posted.  Check fields and data types." %}

```javascript
{
    "message": "failure",
    "detail": "failed to create record"
}
```

{% endtab %}

{% tab title="401 There is an issue with your API key." %}

```javascript
{
    "message": "unauthorized",
    "detail": "invalid api key"
}
```

{% endtab %}

{% tab title="429 There is a rate limit of one request every 15 minutes per API key per brew session." %}

```javascript
{
    "message": "rate-limit",
    "detail": "device rate limit, you are only allowed to post once every 15 minutes."
}
```

{% endtab %}
{% endtabs %}

Here is an example of the data to POST.

```javascript
{
 "name": "BrewBench",
 "temp": 22.2,
 "temp_unit": "C",
 "gravity": 14.1,
 "gravity_unit": "P",
 "ph": 4.5,
 "comment": "",
 "beer": "",
 "battery": 3.588112,
 "RSSI": -57,
 "angle": ""
}
```


---

# 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://docs.brewersfriend.com/api/stream.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.
