{"type":"api","title":"List alert rules","meta":{"id":"/apps/pubhub/media/000-v7-apis/4ec57f8c141f43990cef5c737bb51240bb169e79/9a54eafb-59ad-38f2-a440-c003b58ad29f","info":{"title":"Alerts API","description":"**Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance.\n\nYou can manage the following alert functionalities on the ThousandEyes platform using the Alerts API:\n\n* **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules.\n\n* **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests..\n\n* **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance.\n\nFor more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts).\n","version":"7.0.117"},"security":[{"BearerAuth":[]}],"tags":[{"name":"Alerts"},{"name":"Alert Rules"},{"name":"Alert Suppression Windows"}],"openapi":"3.0.1","servers":[{"description":"ThousandEyes API production URL","url":"https://api.thousandeyes.com/v7"}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Bearer authentication token"}}},"spec":{"tags":["Alert Rules"],"summary":"List alert rules","operationId":"getAlertsRules","description":"Returns a list of alert rules. Default rules for each test type are indicated with a boolean response (true or false); these default alert rules automatically apply to their respective test types. This endpoint is limited to alert rules for Network & App Synthetics tests and Routing tests. Each list row may include the response-only boolean `hasOptimization`. `true` means the authorized lookup completed and an active optimization exists. `false` means the lookup completed and no active optimization exists. If `hasOptimization` is omitted from a row, enrichment could not be completed and the absence must not be interpreted as `false`. Query `hasOptimization=true` returns only rows with an active optimization; `hasOptimization=false` returns only rows without one. Omitting the query parameter preserves the unfiltered list. When the query parameter is explicitly supplied and optimization data cannot be retrieved, the request returns `503` with `OPTIMIZATION_DATA_UNAVAILABLE`. Unfiltered requests remain `200` if enrichment is unavailable; affected rows omit `hasOptimization`. List rows do not include the full `optimization` object. Callers without the `View alert rules` permission receive `403`.","parameters":[{"name":"aid","in":"query","description":"A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.","required":false,"schema":{"type":"string","example":"1234"},"$$ref":"#/components/parameters/AccountGroupId"},{"name":"hasOptimization","in":"query","required":false,"description":"Filters alert rules by whether they currently have an active optimization. `true` returns only rules with an active optimization; every successfully returned row contains `hasOptimization: true`. `false` returns only rules without an active optimization; every successfully returned row contains `hasOptimization: false`. When omitted, the list is unfiltered. Rows whose lookup succeeds include `hasOptimization` `true` or `false`; the field is omitted when enrichment is unavailable. When this parameter is explicitly supplied and optimization data cannot be retrieved, the request returns `503` with `OPTIMIZATION_DATA_UNAVAILABLE`.","schema":{"type":"boolean"},"example":true,"$$ref":"#/components/parameters/HasOptimization"}],"responses":{"200":{"description":"OK","content":{"application/hal+json":{"schema":{"type":"object","properties":{"alertRules":{"type":"array","items":{"description":"Alert-rule list row. Includes the optional response-only `hasOptimization` indicator. This schema is not used for create or update operations.","allOf":[{"type":"object","required":["ruleName","expression","alertType","roundsViolatingOutOf"],"properties":{"ruleId":{"type":"string","description":"Unique ID of the rule.","example":"127094","readOnly":true,"$$ref":"#/components/schemas/RuleId"},"ruleName":{"type":"string","description":"Name of the alert rule.","example":"The End of the Internet"},"expression":{"type":"string","description":"The expression of the alert rule.","example":"((hops((hopDelay \u003e= 100 ms))))"},"description":{"type":"string","description":"A description of the alert rule.","example":"A rule description string"},"direction":{"type":"string","enum":["to-target","from-target","bidirectional"],"description":"Direction for applicable alert types (eg. path trace, End-to-End (Agent) etc.)","example":"to-target","$$ref":"#/components/schemas/AlertDirection"},"notifyOnClear":{"type":"boolean","description":"Send notification when alert clears.","example":true},"isDefault":{"type":"boolean","description":"If set to `true`, this alert rule becomes the default for its test type and is automatically applied to newly created tests with relevant metrics. Only one default alert rule is allowed per test type.","example":true},"alertType":{"type":"string","description":"Type of alert being triggered. In multi-layered tests, this value represents the layer the alert relates to. See [Alert Details](https://developer.cisco.com/docs/thousandeyes/retrieve-alert-details/) documentation for a list of possible values","example":"http-server","enum":["page-load","http-server","end-to-end-server","end-to-end-agent","voice","dns-server","dns-trace","dnssec","bgp","path-trace","ftp","sip-server","transactions","web-transactions","agent","network-outage","application-outage","device-device","device-interface","endpoint-network-server","endpoint-http-server","endpoint-path-trace","endpoint-browser-sessions-agent","endpoint-browser-sessions-application","api","web-transaction","unknown"],"$$ref":"#/components/schemas/AlertType"},"alertGroupType":{"type":"string","description":"Category of alert type based on the application or network layer and source of the test.","enum":["bgp","browser-session","cloud-enterprise","endpoint"],"example":"endpoint","$$ref":"#/components/schemas/AlertGroupType"},"minimumSources":{"type":"integer","description":"The minimum number of agents or monitors that must meet the specified criteria to trigger the alert.","example":10},"minimumSourcesPct":{"type":"integer","description":"The minimum percentage of all assigned agents or monitors that must meet the specified criteria to trigger the alert.","example":99},"roundsViolatingMode":{"type":"string","description":"`exact` requires the same agents to meet the threshold in consecutive rounds. `auto` is only enabled for CEA and Endpoint Scheduled test rules. The default is `any`.","enum":["exact","any","auto"],"example":"exact","readOnly":true,"$$ref":"#/components/schemas/AlertRoundsViolationMode"},"roundsViolatingOutOf":{"type":"integer","description":"Specifies the divisor (y value) in the “X of Y times” condition.","example":5},"roundsViolatingRequired":{"type":"integer","description":"Specifies the numerator (x value) in the “X of Y times” condition.","example":2},"includeCoveredPrefixes":{"type":"boolean","description":"Set true to include covered prefixes in the BGP alert rule. Only applicable to BGP alert rules.","example":true},"sensitivityLevel":{"type":"string","description":"Used when `roundsViolatingMode` is set to `auto`. The default is `medium`. Higher sensitivity increases the likelihood of triggering alerts.","enum":["high","medium","low"],"example":"medium","readOnly":true,"$$ref":"#/components/schemas/SensitivityLevel"},"severity":{"type":"string","description":"The severity of the alert.","enum":["info","major","minor","critical","unknown"],"example":"major","$$ref":"#/components/schemas/Severity"},"endpointAgentIds":{"description":"An array of endpoint agent IDs associated with the rule (get `id` from `/endpoint/agents` API). This is applicable when `alertGroupType` is `browser-session`.","type":"array","items":{"description":"Unique ID of the agent.","type":"string","example":"281474976710706"}},"endpointLabelIds":{"description":"An array of label IDs used to assign specific Endpoint Agents to the test (get `id` from `/endpoint/labels`). This is applicable when `alertGroupType` is `browser-session`.","type":"array","items":{"description":"An Endpoint label ID.","type":"string","example":"123456"}},"visitedSitesFilter":{"description":"A list of website domains visited during the session. This is applicable when `alertGroupType` is `browser-session`.","type":"array","items":{"type":"string"},"example":["app.thousandeyes.com"]}},"$$ref":"#/components/schemas/BaseRule"},{"type":"object","description":"Response-only optimization presence indicator for alert-rule list rows.","properties":{"hasOptimization":{"type":"boolean","readOnly":true,"description":"Indicates whether the authorized optimization lookup found an active optimization for this rule. `true` means the lookup completed and an active optimization exists. `false` means the lookup completed and no active optimization exists. If this field is omitted, optimization enrichment could not be completed and the absence must not be interpreted as `false`. This field is not nullable; its three states are `true`, `false`, or absent.","example":true}},"$$ref":"#/components/schemas/RuleListOptimizationIndicator"}],"$$ref":"#/components/schemas/RuleListItem"}},"_links":{"type":"object","description":"A links object containing the self link.","readOnly":true,"properties":{"self":{"type":"object","description":"A hyperlink from the containing resource to a URI.","required":["href"],"properties":{"href":{"type":"string","description":"Its value is either a URI [RFC3986] or a URI template [RFC6570].","example":"https://api.thousandeyes.com/v7/link/to/resource/id"},"templated":{"type":"boolean","description":"Should be true when the link object's \"href\" property is a URI template."},"type":{"type":"string","description":"Used as a hint to indicate the media type expected when dereferencing the target resource."},"deprecation":{"type":"string","description":"Its presence indicates that the link is to be deprecated at a future date. Its value is a URL that should provide further information about the deprecation."},"name":{"type":"string","description":"Its value may be used as a secondary key for selecting link objects that share the same relation type."},"profile":{"type":"string","description":"A URI that hints about the profile of the target resource."},"title":{"type":"string","description":"Intended for labelling the link with a human-readable identifier"},"hreflang":{"type":"string","description":"Indicates the language of the target resource"}},"$$ref":"#/components/schemas/Link"}},"$$ref":"#/components/schemas/SelfLinks"}},"$$ref":"#/components/schemas/Rules"},"example":{"alertRules":[{"ruleId":"1197261","ruleName":"Rule with optimization","expression":"((responseTime \u003e= 1000 ms))","alertType":"http-server","roundsViolatingOutOf":5,"hasOptimization":true},{"ruleId":"1197262","ruleName":"Rule without optimization","expression":"((responseTime \u003e= 1000 ms))","alertType":"http-server","roundsViolatingOutOf":5,"hasOptimization":false},{"ruleId":"1197263","ruleName":"Optimization lookup unavailable","expression":"((responseTime \u003e= 1000 ms))","alertType":"http-server","roundsViolatingOutOf":5}],"_links":{"self":{"href":"https://api.thousandeyes.com/v7/alerts/rules"}}}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"invalid_token"},"error_description":{"type":"string","example":"Invalid access token"}},"$$ref":"#/components/schemas/UnauthorizedError"}}},"$$ref":"#/components/responses/401"},"403":{"description":"Insufficient permissions to query endpoint","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI reference that identifies the problem type. When this member is not present, its value is assumed to be \"about:blank\"."},"title":{"type":"string","description":"A short, human-readable summary of the problem type."},"status":{"type":"integer","description":"The HTTP status code generated by the origin server for this occurrence of the problem."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."},"instance":{"type":"string","description":"A URI reference that identifies the specific occurrence of the problem."}},"$$ref":"#/components/schemas/Error"}}},"$$ref":"#/components/responses/403"},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI reference that identifies the problem type. When this member is not present, its value is assumed to be \"about:blank\"."},"title":{"type":"string","description":"A short, human-readable summary of the problem type."},"status":{"type":"integer","description":"The HTTP status code generated by the origin server for this occurrence of the problem."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."},"instance":{"type":"string","description":"A URI reference that identifies the specific occurrence of the problem."}},"$$ref":"#/components/schemas/Error"},"example":{"type":"about:blank","title":"URI Resource Not Found","status":404,"detail":"Details explaining if the 404 error is related to an invalid URI or a wrong ID","instance":"/v7"}}},"$$ref":"#/components/responses/404"},"429":{"description":"Exhausted rate limit for the organization","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI reference that identifies the problem type. When this member is not present, its value is assumed to be \"about:blank\"."},"title":{"type":"string","description":"A short, human-readable summary of the problem type."},"status":{"type":"integer","description":"The HTTP status code generated by the origin server for this occurrence of the problem."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."},"instance":{"type":"string","description":"A URI reference that identifies the specific occurrence of the problem."}},"$$ref":"#/components/schemas/Error"}}},"$$ref":"#/components/responses/429"},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI reference that identifies the problem type. When this member is not present, its value is assumed to be \"about:blank\"."},"title":{"type":"string","description":"A short, human-readable summary of the problem type."},"status":{"type":"integer","description":"The HTTP status code generated by the origin server for this occurrence of the problem."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."},"instance":{"type":"string","description":"A URI reference that identifies the specific occurrence of the problem."}},"$$ref":"#/components/schemas/Error"},"example":{"type":"about:blank","title":"Internal server error","status":500,"detail":"Optional detail about the internal error message.","instance":"/v7"}}},"$$ref":"#/components/responses/500"},"503":{"description":"Service unavailable. For requests that include `hasOptimization`, this response can indicate that optimization data could not be retrieved. Do not interpret an optimization-data-unavailable response as an empty result or as “no optimizations found.”","content":{"application/problem+json":{"schema":{"description":"Problem details returned when an explicitly filtered alert-rule list cannot be evaluated because optimization data is unavailable.","allOf":[{"type":"object","properties":{"type":{"type":"string","description":"A URI reference that identifies the problem type. When this member is not present, its value is assumed to be \"about:blank\"."},"title":{"type":"string","description":"A short, human-readable summary of the problem type."},"status":{"type":"integer","description":"The HTTP status code generated by the origin server for this occurrence of the problem."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."},"instance":{"type":"string","description":"A URI reference that identifies the specific occurrence of the problem."}},"$$ref":"#/components/schemas/Error"},{"type":"object","required":["code","status"],"properties":{"code":{"type":"string","description":"Stable error code returned when an explicitly filtered alert-rule list cannot obtain optimization data.","enum":["OPTIMIZATION_DATA_UNAVAILABLE"],"example":"OPTIMIZATION_DATA_UNAVAILABLE","$$ref":"#/components/schemas/OptimizationDataUnavailableCode"},"status":{"type":"integer","example":503}},"$$ref":"#/components/schemas/OptimizationDataUnavailableDetails"}],"$$ref":"#/components/schemas/OptimizationDataUnavailableError"},"example":{"type":"about:blank","title":"Optimization data unavailable","status":503,"code":"OPTIMIZATION_DATA_UNAVAILABLE","detail":"Optimization data could not be retrieved. Retry the filtered request.","instance":"/v7/alerts/rules"}}}}},"__originalOperationId":"getAlertsRules","security":[{"BearerAuth":[]}],"method":"get","path":"/alerts/rules"}}