> For the complete documentation index, see [llms.txt](https://docs.brewersfriend.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brewersfriend.com/api/fermentation.md).

# Fermentation

## Get Fermentation Data

<mark style="color:blue;">`GET`</mark> `https://api.brewersfriend.com/v1/fermentation/:brew_session_id`

This endpoint allows you to get fermentation data from a brew session.  Replace *:brew\_session\_id* ith the brew session id.

#### Path Parameters

| Name              | Type   | Description                                    |
| ----------------- | ------ | ---------------------------------------------- |
| brew\_session\_id | string | Brew Session ID found in the brew session URL. |

#### Query Parameters

| Name  | Type   | Description                      |
| ----- | ------ | -------------------------------- |
| skip  | number | Number of records to skip from 0 |
| limit | number | Number of records to limit       |
| from  | string | Date in the format YYYY-MM-DD    |
| to    | string | Date in the format YYYY-MM-DD    |

#### Headers

| Name      | Type   | Description   |
| --------- | ------ | ------------- |
| X-API-KEY | string | Your API Key. |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
  "message": "success",
  "readings": [{
    "_id": {
      "$oid": "5c5b15646ea3a6ca48726862"
    },
    "login_id": 119823,
    "api_key": "",
    "brewevent_id": 196331,
    "recipe_id": 578166,
    "ip": "::1",
    "name": "RED",
    "gravity": "1.030",
    "gravity_unit": "G",
    "temp": "67.0",
    "temp_unit": "F",
    "comment": "",
    "beer": "IPA Test",
    "interval": "43306.54155361111",
    "created_at": "2019-02-06T17:12:04+00:00",
    "source": "tilt"
  }]
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```javascript
{
  "message":"not-found",
  "detail":"no records found"
}
```

{% endtab %}
{% endtabs %}

## Import Fermentation Data

<mark style="color:green;">`POST`</mark> `https://api.brewersfriend.com/v1/fermentation/:brew_session_id/import`

This endpoint allows you to post fermentation data for a brew session.  The data is in the same format as either the JSON or CSV export in Brew Session Fermentation Export.  Replace *:brew\_session\_id* with the brew session id.

#### Path Parameters

| Name              | Type   | Description                                    |
| ----------------- | ------ | ---------------------------------------------- |
| brew\_session\_id | string | Brew Session ID found in the brew session URL. |

#### Query Parameters

| Name  | Type    | Description                                                  |
| ----- | ------- | ------------------------------------------------------------ |
| reset | boolean | set true to delete all readings for this brew session first. |

#### Headers

| Name         | Type   | Description                  |
| ------------ | ------ | ---------------------------- |
| Content-Type | string | application/json or text/csv |
| X-API-KEY    | string | Your API Key.                |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
  "message": "success",
  "imported": {
    "count": 12
  }
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```javascript
{
  "message":"not-found",
  "detail":"brew session found"
}
```

{% endtab %}
{% endtabs %}

Post an array of reading objects, the same format you will get from exporting data from a fermentation in the [Brew Session Fermentation tab](/brew-session/fermentation.md#export) or the same you would post to in the [Stream API](/api/stream.md#post-device-stream-data).

#### JSON Format

```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": "",
 "created_at": "2019-12-10T14:31:18+00:00"
}]
```

#### CSV Format

```javascript
gravity, gravity_unit, temp, temp_unit, ph, bpm, created_at, source, name, annotation, comment
14.1, "P", 22.2, "C", 4.5, ,"2019-12-10T14:31:18+00:00", , , ,
```
