MuleSoft Anypoint Platform provides REST API call that can be used to manage alerts programmatically for API Manager managed APIs. Using the Alerts API, users can:
The alerts can be configured based on metrics such as api_response_code_count and can trigger notifications like email alerts when thresholds are exceeded.
To manage alerts for API Manager API instances:
Ensure the following before executing the APIs:
The alert state changes from pending to ok once the monitoring service validates and activates the alert configuration.
Below are the commonly used operations.
curl --location 'https://anypoint.mulesoft.com/monitoring/api/alerts/api/v2/organizations/{orgId}/environments/{envId}/alerts' \
--header 'Authorization: bearer <access_token>'
Example Response
[
{
"alertId": "019e0230-24b0-77b6-900e-c6daa5ebd19a",
"alertType": "basic",
"condition": {
"interval": 0,
"operator": "above",
"threshold": 4
},
"createdAt": "2026-05-07T11:26:10.096Z",
"environmentId": "**********",
"masterOrganizationId": "**********",
"metricType": "api_response_code_count",
"name": "test-12-api",
"notifications": [
{
"message": "Hello,\nYou are receiving this alert because:\n The API ${api} has ${condition} of ${value} at ${timestamp}.\nThe API has reached the threshold based on ${condition} is ${operator} ${threshold} for ${period}.\n\nEnvironment: ${environment}\n${dashboardLink}\n${apiLink}",
"recipients": [
"email"
],
"subject": "${severity}: ${api} ${condition}",
"type": "email"
}
],
"organizationId": "**********",
"resourceType": "api",
"resources": [
{
"apiId": "20832117",
"apiVersionId": "20832117",
"subFilters": [
{
"name": "response_code",
"values": [
"400"
]
}
],
"type": "api"
}
],
"severity": "critical",
"state": "ok",
"stateChangedAt": "2026-05-07T11:31:50.797Z",
"wildcardAlert": false
}
]
curl --location 'https://anypoint.mulesoft.com/monitoring/api/alerts/api/v2/organizations/{orgId}/environments/{envId}/alerts' \
--header 'Authorization: bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "basic",
"name": "test-12",
"severity": "critical",
"environmentId": "{envId}",
"resourceType": "api",
"metricType": "api_response_code_count",
"resources": [
{
"apiVersionId": "20832117",
"apiId": "20832117",
"type": "api",
"subFilters": [
{
"name": "response_code",
"values": [
"400"
]
}
]
}
],
"condition": {
"operator": "above",
"threshold": 4,
"interval": 5
},
"wildcardAlert": false,
"notifications": [
{
"type": "email",
"recipients": [
"email"
],
"subject": "${severity}: ${api} ${condition}",
"message": "Hello, You are receiving this alert because API threshold exceeded."
}
]
}'
Example Response
{
"alertId": "019e0230-24b0-77b6-900e-c6daa5ebd19a",
"alertType": "basic",
"condition": {
"interval": 0,
"operator": "above",
"threshold": 4
},
"createdAt": "2026-05-07T11:26:10.096Z",
"environmentId": "**********",
"masterOrganizationId": "**********",
"metricType": "api_response_code_count",
"name": "test-12",
"notifications": [],
"organizationId": "**********",
"resourceType": "api",
"resources": [
{
"apiId": "20832117",
"apiVersionId": "20832117",
"subFilters": [
{
"name": "response_code",
"values": [
"400"
]
}
],
"type": "api"
}
],
"severity": "critical",
"state": "pending",
"stateChangedAt": "2026-05-07T11:26:10.096Z",
"wildcardAlert": false
}
curl --location --request PUT 'https://anypoint.mulesoft.com/monitoring/api/alerts/api/v2/organizations/{orgId}/environments/{envId}/alerts/{alertId}' \
--header 'Authorization: bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"alertId": "019e0230-24b0-77b6-900e-c6daa5ebd19a",
"name": "test-12-api",
"severity": "critical",
"environmentId": "{envId}",
"resourceType": "api",
"metricType": "api_response_code_count",
"resources": [
{
"apiVersionId": "20832117",
"apiId": "20832117",
"type": "api",
"subFilters": [
{
"name": "response_code",
"values": [
"400"
]
}
]
}
],
"condition": {
"operator": "above",
"threshold": 4,
"interval": 5
},
"wildcardAlert": false,
"notifications": [
{
"type": "email",
"recipients": [
"email"
],
"subject": "${severity}: ${api} ${condition}",
"message": "Hello, You are receiving this alert because API threshold exceeded."
}
]
}'
Example Response
{
"alertId": "019e0230-24b0-77b6-900e-c6daa5ebd19a",
"alertType": "basic",
"condition": {
"interval": 0,
"operator": "above",
"threshold": 4
},
"createdAt": "2026-05-07T11:26:10.096Z",
"environmentId": "**********",
"masterOrganizationId": "**********",
"metricType": "api_response_code_count",
"name": "test-12-api",
"notifications": [],
"organizationId": "**********",
"resourceType": "api",
"resources": [
{
"apiId": "20832117",
"apiVersionId": "20832117",
"subFilters": [
{
"name": "response_code",
"values": [
"400"
]
}
],
"type": "api"
}
],
"severity": "critical",
"state": "pending",
"stateChangedAt": "2026-05-07T11:31:50.791Z",
"wildcardAlert": false
}
005321761

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.