# Custom Keg Monitor

Custom Keg Monitor is a system for keeping track of your keg content. The way this works is by registering the amount that has been tapped, and the system will automatically save this in Bar Helper.

To add a Custom Keg Monitor:

1\) Click on Settings\
2\) Click on ➕

<figure><img src="/files/VcIU1l04kriGMGctYgNe" alt=""><figcaption><p>To add a Custom Keg Monitor, clisk on Settings, then on the Plus</p></figcaption></figure>

First enter a name for the monitor. This is the name displayed inside Bar Helper. The Id Number is the one used inside the API call\
1\) Enter the name,  this will be displayed inside Bar Helper when you connect a Tap\
2\) Enter a Id Number, this will be used inside the "name" field inside the API call.

<figure><img src="/files/WcYdYYKneWvorgc1ImA8" alt=""><figcaption><p>Name will be used to display the monitor inside Bar Helper, Id is used for the API call.</p></figcaption></figure>

Custom Keg monitor works via a REST Api call. That is, we send information to Bar Helper via HTTPS POST, so the system that will send information to Bar Helper must support this.

The first thing we need to do is generate an API key. This should be used when we call Bar Helper. \
1\) Click on Settings \
2\) Click on Bar settings

![](/files/-MjJQcEket7xG2p-UmsM)

1\) Click on Generate API Key

![](/files/-MjJQo8scaaR4mEz8WNk)

1\) Copy the API Key

![](/files/-MjJQwTP1fsxkcEClpzr)

Once you have copied the API key, keep it in a safe place. It will not be possible to see this key several again, if you lose it, you will have to delete it and generate a new one. \
\
When we run the REST call, a monitor with the name you have chosen in the call will be created automatically. \
\
In the video below you can see that it is created automatically. <https://www.loom.com/share/93b54836abe24e948a12c0d07ee6d8ce> \
\
Now that we have the key, we can set up the REST call. This can be done in many ways, here we have shown it via cUrl

```
curl --location --request POST 'https://europe-west1-barhelper-app.cloudfunctions.net/api/customKegMon' \
--header 'authorization: THlGekhVlCZDpISzVRYlBDb0xBSHM4VGNwQVpzeWVLd25sYWI2UFZBNw==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "custom-1",
    "amount": 460,
    "type": "ml"
}'
```

If the monitor exists, then it will use it, so you can either add a new custom name for the montior, or you can use the one added under "Id Number" if you created the monitors beforehand.

```
curl --location --request POST 'https://europe-west1-barhelper-app.cloudfunctions.net/api/customKegMon' \
--header 'authorization: THlGekhVlCZDpISzVRYlBDb0xBSHM4VGNwQVpzeWVLd25sYWI2UFZBNw==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Custom Keg Monitor by Volume",
    "volume": 12.1,
    "type": "l"
}'
```

Type is the init type you are using in your monitor. Here you can choose from:\
'mm3' | 'cm3' | 'ml' | 'l' | 'kl' | 'm3' | 'km3' | 'cl' | 'dl' | 'krm' | 'tsk' | 'msk' | 'kkp' | 'glas' | 'kanna' | 'tsp' | 'Tbs' | 'in3' | 'fl-oz' | 'cup' | 'pnt' | 'qt' | 'gal' | 'ft3' | 'yd3'

This request returns a JSON object with data and message

```
{
"volume: 12.1"
"prevKegAmount": 14,
"newKegAmount": 12.1,
"success": true,
"message": "Keg Monitor updated successfully"
}

eller 

{
"amount: 0.46"
"prevKegAmount": 14000,
"newKegAmount": 13540,
"success": true,
"message": "Keg Monitor updated successfully"
}
```

Url: [\
https://europe-west1-barhelper-app.cloudfunctions.net/api/customKegMon](<&#xA;https://europe-west1-barhelper-app.cloudfunctions.net/api/customKegMon>)\
Method: POST\
Headers: \
authorization: BarHelper API key\
Content-Type: application/json\
Body format: json\
Body:  { "name": "The name of your monitor", amout: amout-in-milliliters}

<mark style="color:green;">`POST`</mark> `https://europe-west1-barhelper-app.cloudfunctions.net/api/customKegMon`

#### Headers

| Name          | Type   | Description        |
| ------------- | ------ | ------------------ |
| Content-Type  | string | application/json   |
| authorization | string | Bar Helper API Key |

#### Request Body

| Name | Type   | Description                          |
| ---- | ------ | ------------------------------------ |
|      | object | JSON: name and amount in milliliters |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

1\) Here we run the cUrl command\
2\) Here you see the new monitor showing up

![](/files/-MjJ_0igo5Aw_nkxmJBM)

Now that we have the monitor, we can connect it to a tap tower in the usual way. 1) Click on Tap, then + in the bottom right corner\
2\) Select Custom Keg monitor

![](/files/-MjJ_rd5BHmvI1g3maQn)

1\) Choose your monitor

![](/files/-MjJaGeXNf0eO_aY7eRp)

You have now created a Custom Keg Monitor and are ready to use it. \
\
Here is an example of how it works when mapped to a tap tower. <https://www.loom.com/share/c5a080f9591c46c1b9c286ce0efcb6ea>


---

# 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.barhelper.app/english/settings/custom-keg-monitor.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.
