# Alert configurations

Configurations are used to define specific behavior, thresholds, and rules associated with each alert type. They are dedicated resources.&#x20;

Each alert type can have a different set of configurations. By configuring alert types, you can tailor the behavior of the alerts to meet specific requirements.

Alert configurations can be personalized for a specific organization. This means that each organization can have its own set of configuration values for the alert types. If a configuration is not set, a default value set by mediarithmics will be used.

## Allowed configurations

Alert configurations are identified by combining three values: `config_key`, `organisation_id`, and `alert_type`. The `config_key` uniquely identifies a specific configuration setting, while the `organisation_id` and `alert_type` specify the organization and alert type to which the configuration belongs.

Here is a list of available configuration keys and their sample values:

<table><thead><tr><th width="403.3333333333333">config</th><th>config_value</th><th data-type="checkbox">Editable in the UI</th></tr></thead><tbody><tr><td><code>volume_drops_segment_labels_mode</code>:<br><br><strong>alert_type</strong>: SEGMENT_VOLUME_DROP<br> <br>Defines whether segment labels in <code>volume_drops_segment_labels_ids</code> config are whitelisted or blacklisted.<br><br><em>To edit in the UI, go to alerts on the segment list. For more information, see</em> <a href="https://userguides.mediarithmics.io/audience/segments/using-the-segments-page"><em>Using the Segments page</em></a><em>.</em></td><td><code>blacklist</code> | <code>whitelist</code>. Volume drops apply to all segments if not defined</td><td>true</td></tr><tr><td><code>volume_drops_segment_labels_ids</code>: <br><br><strong>alert_type</strong>: SEGMENT_VOLUME_DROP<br><br>List of segment labels that will or won't receive volume drop alerts depending on the <code>volume_drops_segment_labels_mode</code> configuration<br><br><em>To edit in the UI, go to alerts on the segment list. For more information, see</em> <a href="https://userguides.mediarithmics.io/audience/segments/using-the-segments-page"><em>Using the Segments page</em></a><em>.</em></td><td><p>Sample value: <code>1,2,3</code></p><p>Volume drops apply to all segments if not defined</p></td><td>true</td></tr><tr><td><code>volume_drops_threshold</code><br><br><strong>alert_type</strong>: SEGMENT_VOLUME_DROP<br><br>Percentage of volume drop in a segment that triggers the alert.</td><td>Value is an integer such as <code>15</code>. Defaults to <code>10</code></td><td>false</td></tr><tr><td><p><code>initial_loading_not_starting_hours_threshold</code><br></p><p><strong>alert_type</strong>: SEGMENT_INITIAL_LOADING<br><br>Threshold in hours after which an alert will be triggered if the initial loading hasn't started</p></td><td>Value is an integer &#x26; reprents a number of hours Defaults to <code>24</code></td><td>false</td></tr><tr><td><p><code>initial_loading_running_too_long_hours_threshold</code><br></p><p><strong>alert_type</strong>: SEGMENT_INITIAL_LOADING<br><br>Threshold in hours after which an alert will be triggered if the initial loading is taking more time than expected</p></td><td>Value is an integer &#x26; reprents a number of hours Defaults to <code>24</code></td><td>false</td></tr><tr><td><p><code>initial_loading_records_error_threshold</code><br></p><p><strong>alert_type</strong>: SEGMENT_INITIAL_LOADING<br><br>An alert will be triggered if the percentage of errors is above the one defined in this config.</p></td><td>Value is an integer. Defaults to <code>10</code></td><td>false</td></tr></tbody></table>

## Accessing configurations

You can list/edit configurations for your organizations by API.

{% hint style="info" %}
It is much easier to edit configurations through the UI when available.
{% endhint %}

## Get all configurations set up for an organisation

<mark style="color:blue;">`GET`</mark> `https://api.mediarithmics.com/v1/alert_type_configs`

If a configuration from the allowed list is not setup, it won't be returned by this call but fall back to the default platform value in usage.

#### Query Parameters

| Name                                               | Type | Description            |
| -------------------------------------------------- | ---- | ---------------------- |
| organisation\_id<mark style="color:red;">\*</mark> | Int  | ID of the organisation |

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

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}
{% endtabs %}

## Creates a new configuration entry

<mark style="color:green;">`POST`</mark> `https://api.mediarithmics.com/v1/alert_type_configs/config_key=:configKey/organisation_id=:organisationId/alert_type=:alertType`

#### Path Parameters

| Name                                             | Type   | Description                                                                                       |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------- |
| configKey<mark style="color:red;">\*</mark>      | string | Configuration key. Use the list of allowed configurations. Other keys won't have an impact.       |
| organisationId<mark style="color:red;">\*</mark> | string | ID of the organisation for which to create the configuration                                      |
| alertType<mark style="color:red;">\*</mark>      | string | [AlertType](https://developer.mediarithmics.io/alerting). Use the list of allowed configurations. |

#### Request Body

| Name                                            | Type   | Description                                                                                                                           |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| config\_value<mark style="color:red;">\*</mark> | string | The value of the configuration. Use the list of allowed configurations for the correct value format, depending on your configuration. |

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

{% endtab %}

{% tab title="400: Bad Request Wrong parameter or the configuration already exists" %}

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}
{% endtabs %}

## Change the value or archive a configuration

<mark style="color:orange;">`PUT`</mark> `https://api.mediarithmics.com/v1/alert_type_configs/config_key=:configKey/organisation_id=:organisationId/alert_type=:alertType`

#### Path Parameters

| Name                                             | Type   | Description                                                                                       |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------- |
| configKey<mark style="color:red;">\*</mark>      | string | Configuration key. Use the list of allowed configurations. Other keys won't have an impact.       |
| organisationId<mark style="color:red;">\*</mark> | string | ID of the organisation for which to create the configuration                                      |
| alertType<mark style="color:red;">\*</mark>      | string | [AlertType](https://developer.mediarithmics.io/alerting). Use the list of allowed configurations. |

#### Request Body

| Name                                            | Type    | Description                                                                                                                                 |
| ----------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| config\_value<mark style="color:red;">\*</mark> | string  | The value of the configuration. Use the list of allowed configurations for the correct value format, depending on your configuration.       |
| archived                                        | Boolean | `true` to archive a configuration. `false` to reactivate it. For more information, see [Archived configurations](#archived-configurations). |

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

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

## Deletes a config

<mark style="color:red;">`DELETE`</mark> `https://api.mediarithmics.com/v1/alert_type_configs/config_key=:configKey/organisation_id=:organisationId/alert_type=:alertType`

#### Path Parameters

| Name                                             | Type   | Description                                                                                       |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------- |
| configKey<mark style="color:red;">\*</mark>      | string | Configuration key. Use the list of allowed configurations. Other keys won't have an impact.       |
| organisationId<mark style="color:red;">\*</mark> | string | ID of the organisation for which to create the configuration                                      |
| alertType<mark style="color:red;">\*</mark>      | string | [AlertType](https://developer.mediarithmics.io/alerting). Use the list of allowed configurations. |

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

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}
{% endtabs %}

## Archived configurations

Configurations can be archived using the PUT request. An archived configuration is not used anymore by the platform (fallback to default value) but is easier to reactivate later.&#x20;
