---
schema_version: "1"
id: c98e483f9e0142da584901c4a9a59628507a554bac9f2023fd8e03ac437a90e8
title: Using Flex Gateway API Alerts
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.9/flex-use-api-alerts.md
canonical_url: https://docs.mulesoft.com/gateway/1.9/flex-use-api-alerts
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3647b5617dae21c9612a6fc21590d7c5a2ff445dded53d2746d3a830977fe3ef
description: MuleSoft Documentation Site
release: "1.9"
latest: false
---
---
product: Omni Gateway
version: 1.9
---

# Using Flex Gateway API Alerts

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Using API alerts, you can add and configure email notifications that flag unusual API behavior, such
as:

- An API response time over 60 seconds

- More than 1000 API requests in 30 seconds

See [Add API Alerts](#add-api-alerts) below.

## Types of API Alerts

Add any of the following alerts to notify you of the condition described:

- Total Request Count: Users request access to the API more times than allowed during a specified
  time. Specify time interval values from 1 through 999999999. To prevent data bursts, intervals are
  implemented as sliding windows instead of as absolute minute boundaries.

- Average Response Time: The response time of the API exceeds a specified timeout period.

- Response Codes: Upon receiving a request, the API returns an HTTP code of 400, 401, 403, 404, 408,
  500, 502, or 503 or a custom three-digit response.

- Policy Violation: An infraction of a specified policy governing the API occurs.

## How API Alerts Work

API alerts are triggered only when:

- The API state changes

  Note that the first occurrence of a state change might go undetected if a newly created alert does
  not include defined states.

- The alert conditions are met for the specified period of time

  For example, if an alert is configured to trigger when an API returns an HTTP code of 500 five or
  more times within a 10-minute period, it does not trigger if the API returns a code of 500 only
  once within that 10-minute period.

When configuring an API alert, you can select business group users and users outside your
organization to receive email notifications about the alert. Notifications include information about
events that trigger alerts as specified by severity level.

> [!NOTE] API Alerts are sent from `no-reply@mulesoft.com`. This cannot be customized.

- The first email describes the alert:

  `Your API, CesarDemoAPI - Basic:151 (Environment: "NewOne"), has received greater than 2 requests within 1 consecutive periods of 1 minutes.`

- Another email notifies you when the alert is resolved:

  `Your API Version, jsonplaceholderapi - 1.0.development, is no longer in an alert state. The number of policy violations was not greater than 1 in the last 1 consecutive periods of 1 minutes.`

After the first set of two notification emails is sent, API Manager stops listening for alerts until
the next alert period begins. This technique prevents repeated notification emails.

## Before You Begin

To view and delete alerts, ensure that you have:

- **Manage Alerts** permission to view and delete API alerts.

- **View Alerts** permission for view-only access to alerts.

## Add API Alerts

To track and manage APIs, you can add one or more API alerts to your API instances. Add different
[types of alerts](#types-of-api-alerts) based on your requirements.

The following table explains the number of active alerts per API instance:

<table><colgroup><col> <col></colgroup><thead><tr><th>Pricing Package</th><th>Active Alerts</th></tr></thead><tbody><tr><td><p>Anypoint Integration Starter</p></td><td><p>Up to 6</p></td></tr><tr><td><p>Anypoint Integration Advanced</p></td><td><p>Up to 10</p></td></tr><tr><td><p>Gold Subscription</p></td><td><p>Up to 6</p></td></tr><tr><td><p>Platinum Subscription</p></td><td><p>Up to 6</p></td></tr><tr><td><p>Titanium Subscription</p></td><td><p>Up to 10</p></td></tr></tbody></table>

All subscriptions enable you to have as many non-active alerts as needed.

Pausing or deleting an active alert enables you to create new alerts if you have reached the maximum
number of active alerts.

Alerts are enabled by default when created. This setting cannot be modified.

> [!NOTE] Alerts cannot be added to API instances protected by
> [automated policies](https://docs.mulesoft.com/gateway/latest/policies-automated-overview).

To add an API alert:

1.  Navigate to **API Manager** > **API Administration** and click the API instance for which you
    want to add an alert.

2.  From the left navigation pane, select **Alerts** > **New alert**.

3.  Specify values for the displayed alert options:

    - **Name**:

      Type an alert name, for example, `trial-alert`. You can delete an alert anytime if not
      required.

    - **Severity**:

      Select a severity for the alert:

      - **Info**

        Assign to alerts that do not require immediate attention when triggered. This severity
        indicates that the metric should be passively monitored.

      - **Warning**

        Assign to alerts that require prompt attention when triggered. This severity indicates an
        alert should be closely monitored.

      - **Critical**

        Assign to alerts that require immediate attention when triggered. This severity indicates an
        alert should receive an immediate response.

4.  Specify the alert conditions:

    - **Metric**

      Condition that triggers the alert.

    - **Logic**

      When the alert is triggered, based on the occurrence rate defined in the **When number of
      occurrences are** and **For at least \[number of\] minutes** fields. You can select a maximum
      of ten response codes for alert conditions.

5.  Configure the email notification:

    - **Subject**

      Subject of the alert email to send when the alert is triggered. The subject can include
      variables. See [Variable Definitions](#alert-variables).

    - **Message**

      Body text for the email to send when the alert is triggered. The message body can include
      variables. See [Variable Definitions](#alert-variables).

    - **Recipients**

      Recipients of the alert email. You can select up to 20 platform user IDs and enter up to 20
      email addresses.

6.  Click **Create**.

Alerts appear as **Pending** when they are created. After the API receives traffic, the alert
changes to a state of **OK**. Depending on the value, the alert transitions to **OK** or
**Alerting**.

### Alert Email Template

You can use the following variables in the **Subject** and **Message** fields for basic email
alerts.

For the description of each variable, see [Variable Definitions](#alert-variables).

<table><caption>Table 1. Variables for Alerts</caption> <colgroup><col> <col></colgroup><thead><tr><th>Alert</th><th>Applicable Variables</th></tr></thead><tbody><tr><td><p><strong>Total Request Count</strong></p></td><td rowspan="4"><div><div><ul><li><p><code>${severity}</code></p></li><li><p><code>${operator}</code></p></li><li><p><code>${threshold}</code></p></li><li><p><code>${period}</code></p></li><li><p><code>${value}</code></p></li><li><p><code>${condition}</code></p></li><li><p><code>${organization}</code></p></li><li><p><code>${environment}</code></p></li><li><p><code>${apiLink}</code></p></li><li><p><code>${dashboardLink}</code></p></li><li><p><code>${api}</code></p></li><li><p><code>${policy}</code></p></li></ul></div></div></td></tr><tr><td><p><strong>Average Response Time</strong></p></td></tr><tr><td><p><strong>Response Codes</strong></p></td></tr><tr><td><p><strong>Policy Violations</strong></p></td></tr></tbody></table>

<table id="alert-variables"><caption>Table 2. Variable Definitions</caption> <colgroup><col> <col></colgroup><thead><tr><th>Variable</th><th>Definition</th></tr></thead><tbody><tr><td><p><code>${apiLink}</code></p></td><td><p>URL of the triggered API</p></td></tr><tr><td><p><code>${alertState}</code></p></td><td><p>State of the alert when it was triggered.</p><p>Available values are <code>OK</code> or <code>Alerting</code>.</p></td></tr><tr><td><p><code>${comparison}</code></p></td><td><p>* Above, above or equal, equal, below or equal, below</p></td></tr><tr><td><p><code>${condition}</code></p></td><td><p>Metric for which the alert is triggered</p></td></tr><tr><td><p><code>${environment}</code></p></td><td><p>Name of the environment in which the resource is deployed</p></td></tr><tr><td><p><code>${operator}</code></p></td><td><p>An operator, such as <code>&lt; &gt; =</code></p></td></tr><tr><td><p><code>${organization}</code></p></td><td><p>Name of the organization that owns the alert</p></td></tr><tr><td><p><code>${period}</code></p></td><td><p>Period of time over which to measure</p></td></tr><tr><td><p><code>${severity}</code></p></td><td><p>Severity of the alert</p></td></tr><tr><td><p><code>${threshold}</code></p></td><td><p>Count over the period of time that triggers the alert</p></td></tr><tr><td><p><code>${value}</code></p></td><td><p>Value of the metric that triggers the alert</p></td></tr></tbody></table>

## Pause and Edit API Alerts

Pausing an alert causes the alert to transition to **Paused**.

You can also edit an existing alert by following these steps:

1.  In API Manager, click **API Administration** in the left navigation bar.

2.  Click the API instance and version that you want to edit and then click **Alerts**.

3.  Click **Edit** from the three-dots menu (![5%](/mulesoft/current/en-us/gateway/1.9/_images/three-dots-menu.png)) on the alert you
    want to edit.

    ![A table that shows the name of the alert, the metrics it is based on, the severity, the state, and whether the alert is enabled](/mulesoft/current/en-us/gateway/1.9/_images/flex-alerts-edit.png)

## View and Delete Alerts

To view and delete alerts:

1.  From API Manager, click **API Administration > API instance**, and select **Alerts**.

    ![A table of API service contract alerts with an expanded alert named 'Test fail alert'](/mulesoft/current/en-us/gateway/1.9/_images/view-add-alert.png)

2.  Expand an alert in the list.

    Details about the alert options appear.

3.  Click **Delete** from the three-dots menu
    (![Three dots aligned vertically as a menu](/mulesoft/current/en-us/gateway/1.9/_images/three-dots-menu.png)) on the alert you want
    to delete. You can also delete an alert when editing it.
