Usage Alerts

The Email Alerts API enables you to configure and manage usage alerts for your account. You can create up to 8 alerts per account to monitor your accounts usage and receive notifications when thresholds are reached.

List Alerts

Retrieve all alerts configured for a logical account.

Request Header

GET https://api.cm.com/email/alerts/v1/account/{logicalAccount}/alerts/list

Response Body

Successful Response (200)

{
    "isSuccess": true,
    "statusCode": 200,
    "message": "Alerts found.",
    "data": [
        {
            "id": 1,
            "logicalAccountId": "123e4567-e89b-12d3-a456-426614174000",
            "alertName": "High Usage Alert",
            "metric": "Usage",
            "threshold": ">90",
            "recipient": "[email protected], [email protected]",
            "createdDate": "2024-01-15T10:30:00Z",
            "updatedDate": "2024-01-15T10:30:00Z"
        }
    ]
}

Add Alert

Create a new alert for monitoring email metrics.

Request Header

POST https://api.cm.com/email/alerts/v1/account/{logicalAccount}/alerts/create
Content-Type: application/json

{
    "alertName": "Low Open Rate Alert",
    "metric": "Usage",
    "threshold": "<50",
    "recipient": "[email protected], [email protected]"
}

Response Body

Successful Response (200)

{
    "isSuccess": true,
    "statusCode": 200,
    "message": "Successfully inserted new email alert.",
    "data": 2
}

Error Responses

Maximum Limit (400)

{
    "isSuccess": false,
    "statusCode": 400,
    "message": "Maximum alert limit reached, cannot add more alerts.",
    "data": -1
}

Update Existing Alert

Update an existing alert configuration.

Request Header

PUT https://api.cm.com/email/alerts/v1/account/{logicalAccount}/alerts/update/{id}
Content-Type: application/json

{
    "alertName": "Updated Usage Rate Alert",
    "metric": "Usage",
    "threshold": ">85",
    "recipient": "[email protected], [email protected]"
}

Response Body

Successful Response (200)

{
    "isSuccess": true,
    "statusCode": 200,
    "message": "Updated email alert",
    "data": 1
}

Delete Alert

Delete an existing alert.

Request Header

DELETE https://api.cm.com/email/alerts/v1/account/{logicalAccount}/alerts/delete/{id}

Response Body

Successful Response (200)

{
    "isSuccess": true,
    "statusCode": 200,
    "message": "Successfully deleted email alert with id 1",
    "data": 1
}

Error Responses

Alert Not Found (400)

{
    "isSuccess": false,
    "statusCode": 400,
    "message": "Alert not found or already deleted.",
    "data": -1
}

Request Parameters

Path Parameters

ParameterTypeRequiredDescription
Logical AccountGUIDYesUnique identifier for the logical account
idint32YesAlert ID (for update/delete operations only)

Request Body Fields

FieldTypeRequiredDescription
Alert NamestringYesName of the alert
metricstringYesUsage
thresholdstringYesThreshold with operator (e.g., ">90", "<50", "=75")
recipientstringYesEmail addresses (comma-separated for multiple)

Threshold Operators

OperatorSymbolDescription
Over>Alert when metric is above threshold
Below<Alert when metric is below threshold
Equal=Alert when metric equals threshold

Best Practices

  1. Alert Limit: Remember the 8-alert limit per account. Plan your alerts strategically.
  2. Threshold Values: Use percentage values (0-100) for thresholds.
  3. Multiple Recipients: Use comma-separated email addresses for multiple notifications. You can add max 5 recipients per alert.
  4. Meaningful Names: Use descriptive alert names for easy identification.
  5. Monitor Performance: Regularly review and update alert thresholds based on your email performance trends.

Examples

High Usage Alert

Monitor when usage rate exceed expectations:

{
    "alertName": "Excellent Campaign Performance",
    "metric": "Usage",
    "threshold": ">95",
    "recipient": "[email protected]"
}

Deliverability Issue Alert

Monitor for delivery problems:

{
    "alertName": "Low Usage Rate Warning",
    "metric": "Usage",
    "threshold": ">10",
    "recipient": "[email protected], [email protected]"
}