# Alerting # Available Alerts ## Get Alert Types `alerting.available_alerts.list(AvailableAlertListParams**kwargs) -> AvailableAlertListResponse` **get** `/accounts/{account_id}/alerting/v3/available_alerts` Gets a list of all alert types for which an account is eligible. ### Parameters - `account_id: str` The account id ### Returns - `Dict[str, List[AvailableAlertListResponseItem]]` - `description: Optional[str]` Describes the alert type. - `display_name: Optional[str]` Alert type name. - `filter_options: Optional[List[object]]` Format of additional configuration options (filters) for the alert type. Data type of filters during policy creation: Array of strings. - `type: Optional[str]` Use this value when creating and updating a notification policy. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) available_alerts = client.alerting.available_alerts.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(available_alerts) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "Origin Monitoring": [ { "description": "High levels of 5xx HTTP errors at your origin.", "display_name": "Origin Error Rate Alert", "filter_options": [ { "AvailableValues": null, "ComparisonOperator": "==", "Key": "zones", "Range": "1-n" }, { "AvailableValues": [ { "Description": "Service-Level Objective of 99.7", "ID": "99.7" }, { "Description": "Service-Level Objective of 99.8", "ID": "99.8" } ], "ComparisonOperator": ">=", "Key": "slo", "Range": "0-1" } ], "type": "http_alert_origin_error" } ] } } ``` ## Domain Types ### Available Alert List Response - `Dict[str, List[AvailableAlertListResponseItem]]` - `description: Optional[str]` Describes the alert type. - `display_name: Optional[str]` Alert type name. - `filter_options: Optional[List[object]]` Format of additional configuration options (filters) for the alert type. Data type of filters during policy creation: Array of strings. - `type: Optional[str]` Use this value when creating and updating a notification policy. # Destinations # Eligible ## Get delivery mechanism eligibility `alerting.destinations.eligible.get(EligibleGetParams**kwargs) -> EligibleGetResponse` **get** `/accounts/{account_id}/alerting/v3/destinations/eligible` Get a list of all delivery mechanism types for which an account is eligible. ### Parameters - `account_id: str` The account id ### Returns - `Dict[str, List[EligibleGetResponseItem]]` - `eligible: Optional[bool]` Determines whether or not the account is eligible for the delivery mechanism. - `ready: Optional[bool]` Beta flag. Users can create a policy with a mechanism that is not ready, but we cannot guarantee successful delivery of notifications. - `type: Optional[Literal["email", "pagerduty", "webhook"]]` Determines type of delivery mechanism. - `"email"` - `"pagerduty"` - `"webhook"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) eligible = client.alerting.destinations.eligible.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(eligible) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "foo": [ { "eligible": true, "ready": true, "type": "email" } ] } } ``` ## Domain Types ### Eligible Get Response - `Dict[str, List[EligibleGetResponseItem]]` - `eligible: Optional[bool]` Determines whether or not the account is eligible for the delivery mechanism. - `ready: Optional[bool]` Beta flag. Users can create a policy with a mechanism that is not ready, but we cannot guarantee successful delivery of notifications. - `type: Optional[Literal["email", "pagerduty", "webhook"]]` Determines type of delivery mechanism. - `"email"` - `"pagerduty"` - `"webhook"` # Pagerduty ## List PagerDuty services `alerting.destinations.pagerduty.get(PagerdutyGetParams**kwargs) -> SyncSinglePage[Pagerduty]` **get** `/accounts/{account_id}/alerting/v3/destinations/pagerduty` Get a list of all configured PagerDuty services. ### Parameters - `account_id: str` The account id ### Returns - `class Pagerduty: …` - `id: Optional[str]` UUID - `name: Optional[str]` The name of the pagerduty service. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.alerting.destinations.pagerduty.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": [ { "id": "f174e90afafe4643bbbc4a0ed4fc8415", "name": "My PagerDuty Service" } ] } ``` ## Create PagerDuty integration token `alerting.destinations.pagerduty.create(PagerdutyCreateParams**kwargs) -> PagerdutyCreateResponse` **post** `/accounts/{account_id}/alerting/v3/destinations/pagerduty/connect` Creates a new token for integrating with PagerDuty. ### Parameters - `account_id: str` The account id ### Returns - `class PagerdutyCreateResponse: …` - `id: Optional[str]` token in form of UUID ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pagerduty = client.alerting.destinations.pagerduty.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(pagerduty.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "a313ba7d3e464c0ea40808fafbc3816a" } } ``` ## Delete PagerDuty Services `alerting.destinations.pagerduty.delete(PagerdutyDeleteParams**kwargs) -> PagerdutyDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/destinations/pagerduty` Deletes all the PagerDuty Services connected to the account. ### Parameters - `account_id: str` The account id ### Returns - `class PagerdutyDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pagerduty = client.alerting.destinations.pagerduty.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(pagerduty.errors) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Connect PagerDuty `alerting.destinations.pagerduty.link(strtoken_id, PagerdutyLinkParams**kwargs) -> PagerdutyLinkResponse` **get** `/accounts/{account_id}/alerting/v3/destinations/pagerduty/connect/{token_id}` Links PagerDuty with the account using the integration token. ### Parameters - `account_id: str` The account id - `token_id: str` The token integration key ### Returns - `class PagerdutyLinkResponse: …` - `id: Optional[str]` UUID ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.alerting.destinations.pagerduty.link( token_id="8c71e667571b4f61b94d9e4b12158038", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Domain Types ### Pagerduty - `class Pagerduty: …` - `id: Optional[str]` UUID - `name: Optional[str]` The name of the pagerduty service. ### Pagerduty Create Response - `class PagerdutyCreateResponse: …` - `id: Optional[str]` token in form of UUID ### Pagerduty Delete Response - `class PagerdutyDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` ### Pagerduty Link Response - `class PagerdutyLinkResponse: …` - `id: Optional[str]` UUID # Webhooks ## List webhooks `alerting.destinations.webhooks.list(WebhookListParams**kwargs) -> SyncSinglePage[Webhooks]` **get** `/accounts/{account_id}/alerting/v3/destinations/webhooks` Gets a list of all configured webhook destinations. ### Parameters - `account_id: str` The account id ### Returns - `class Webhooks: …` - `id: Optional[str]` The unique identifier of a webhook - `created_at: Optional[datetime]` Timestamp of when the webhook destination was created. - `last_failure: Optional[datetime]` Timestamp of the last time an attempt to dispatch a notification to this webhook failed. - `last_success: Optional[datetime]` Timestamp of the last time Cloudflare was able to successfully dispatch a notification using this webhook. - `name: Optional[str]` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `secret: Optional[str]` Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body. - `type: Optional[Literal["datadog", "discord", "feishu", 5 more]]` Type of webhook endpoint. - `"datadog"` - `"discord"` - `"feishu"` - `"gchat"` - `"generic"` - `"opsgenie"` - `"slack"` - `"splunk"` - `url: Optional[str]` The POST endpoint to call when dispatching a notification. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.alerting.destinations.webhooks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": [ { "id": "b115d5ec15c641ee8b7692c449b5227b", "created_at": "2020-10-26T18:25:04.532316Z", "last_failure": "2020-10-26T18:25:04.532316Z", "last_success": "2020-10-26T18:25:04.532316Z", "name": "Slack Webhook", "type": "slack", "url": "https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd" } ] } ``` ## Get a webhook `alerting.destinations.webhooks.get(strwebhook_id, WebhookGetParams**kwargs) -> Webhooks` **get** `/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}` Get details for a single webhooks destination. ### Parameters - `account_id: str` The account id - `webhook_id: str` The unique identifier of a webhook ### Returns - `class Webhooks: …` - `id: Optional[str]` The unique identifier of a webhook - `created_at: Optional[datetime]` Timestamp of when the webhook destination was created. - `last_failure: Optional[datetime]` Timestamp of the last time an attempt to dispatch a notification to this webhook failed. - `last_success: Optional[datetime]` Timestamp of the last time Cloudflare was able to successfully dispatch a notification using this webhook. - `name: Optional[str]` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `secret: Optional[str]` Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body. - `type: Optional[Literal["datadog", "discord", "feishu", 5 more]]` Type of webhook endpoint. - `"datadog"` - `"discord"` - `"feishu"` - `"gchat"` - `"generic"` - `"opsgenie"` - `"slack"` - `"splunk"` - `url: Optional[str]` The POST endpoint to call when dispatching a notification. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) webhooks = client.alerting.destinations.webhooks.get( webhook_id="b115d5ec15c641ee8b7692c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(webhooks.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "b115d5ec15c641ee8b7692c449b5227b", "created_at": "2020-10-26T18:25:04.532316Z", "last_failure": "2020-10-26T18:25:04.532316Z", "last_success": "2020-10-26T18:25:04.532316Z", "name": "Slack Webhook", "type": "slack", "url": "https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd" } } ``` ## Create a webhook `alerting.destinations.webhooks.create(WebhookCreateParams**kwargs) -> WebhookCreateResponse` **post** `/accounts/{account_id}/alerting/v3/destinations/webhooks` Creates a new webhook destination. ### Parameters - `account_id: str` The account id - `name: str` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `url: str` The POST endpoint to call when dispatching a notification. - `secret: Optional[str]` Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body. ### Returns - `class WebhookCreateResponse: …` - `id: Optional[str]` UUID ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) webhook = client.alerting.destinations.webhooks.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", name="Slack Webhook", url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) print(webhook.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Update a webhook `alerting.destinations.webhooks.update(strwebhook_id, WebhookUpdateParams**kwargs) -> WebhookUpdateResponse` **put** `/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}` Update a webhook destination. ### Parameters - `account_id: str` The account id - `webhook_id: str` The unique identifier of a webhook - `name: str` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `url: str` The POST endpoint to call when dispatching a notification. - `secret: Optional[str]` Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body. ### Returns - `class WebhookUpdateResponse: …` - `id: Optional[str]` UUID ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) webhook = client.alerting.destinations.webhooks.update( webhook_id="b115d5ec15c641ee8b7692c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", name="Slack Webhook", url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) print(webhook.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Delete a webhook `alerting.destinations.webhooks.delete(strwebhook_id, WebhookDeleteParams**kwargs) -> WebhookDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}` Delete a configured webhook destination. ### Parameters - `account_id: str` The account id - `webhook_id: str` The unique identifier of a webhook ### Returns - `class WebhookDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) webhook = client.alerting.destinations.webhooks.delete( webhook_id="b115d5ec15c641ee8b7692c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(webhook.errors) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Domain Types ### Webhooks - `class Webhooks: …` - `id: Optional[str]` The unique identifier of a webhook - `created_at: Optional[datetime]` Timestamp of when the webhook destination was created. - `last_failure: Optional[datetime]` Timestamp of the last time an attempt to dispatch a notification to this webhook failed. - `last_success: Optional[datetime]` Timestamp of the last time Cloudflare was able to successfully dispatch a notification using this webhook. - `name: Optional[str]` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `secret: Optional[str]` Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body. - `type: Optional[Literal["datadog", "discord", "feishu", 5 more]]` Type of webhook endpoint. - `"datadog"` - `"discord"` - `"feishu"` - `"gchat"` - `"generic"` - `"opsgenie"` - `"slack"` - `"splunk"` - `url: Optional[str]` The POST endpoint to call when dispatching a notification. ### Webhook Create Response - `class WebhookCreateResponse: …` - `id: Optional[str]` UUID ### Webhook Update Response - `class WebhookUpdateResponse: …` - `id: Optional[str]` UUID ### Webhook Delete Response - `class WebhookDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` # History ## List History `alerting.history.list(HistoryListParams**kwargs) -> SyncV4PagePaginationArray[History]` **get** `/accounts/{account_id}/alerting/v3/history` Gets a list of history records for notifications sent to an account. The records are displayed for last `x` number of days based on the zone plan (free = 30, pro = 30, biz = 30, ent = 90). ### Parameters - `account_id: str` The account id - `before: Optional[Union[str, datetime]]` Limit the returned results to history records older than the specified date. This must be a timestamp that conforms to RFC3339. - `page: Optional[float]` Page number of paginated results. - `per_page: Optional[float]` Number of items per page. - `since: Optional[Union[str, datetime]]` Limit the returned results to history records newer than the specified date. This must be a timestamp that conforms to RFC3339. ### Returns - `class History: …` - `id: Optional[str]` UUID - `alert_body: Optional[str]` Message body included in the notification sent. - `alert_type: Optional[str]` Type of notification that has been dispatched. - `description: Optional[str]` Description of the notification policy (if present). - `mechanism: Optional[str]` The mechanism to which the notification has been dispatched. - `mechanism_type: Optional[Literal["email", "pagerduty", "webhook"]]` The type of mechanism to which the notification has been dispatched. This can be email/pagerduty/webhook based on the mechanism configured. - `"email"` - `"pagerduty"` - `"webhook"` - `name: Optional[str]` Name of the policy. - `policy_id: Optional[str]` The unique identifier of a notification policy - `sent: Optional[datetime]` Timestamp of when the notification was dispatched in ISO 8601 format. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.alerting.history.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": [ { "id": "f174e90afafe4643bbbc4a0ed4fc8415", "alert_body": "SSL certificate has expired", "alert_type": "universal_ssl_event_type", "description": "Universal Certificate validation status, issuance, renewal, and expiration notices", "mechanism": "test@example.com", "mechanism_type": "email", "name": "SSL Notification Event Policy", "policy_id": "0da2b59ef118439d8097bdfb215203c9", "sent": "2021-10-08T17:52:17.571336Z" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Domain Types ### History - `class History: …` - `id: Optional[str]` UUID - `alert_body: Optional[str]` Message body included in the notification sent. - `alert_type: Optional[str]` Type of notification that has been dispatched. - `description: Optional[str]` Description of the notification policy (if present). - `mechanism: Optional[str]` The mechanism to which the notification has been dispatched. - `mechanism_type: Optional[Literal["email", "pagerduty", "webhook"]]` The type of mechanism to which the notification has been dispatched. This can be email/pagerduty/webhook based on the mechanism configured. - `"email"` - `"pagerduty"` - `"webhook"` - `name: Optional[str]` Name of the policy. - `policy_id: Optional[str]` The unique identifier of a notification policy - `sent: Optional[datetime]` Timestamp of when the notification was dispatched in ISO 8601 format. # Policies ## List Notification policies `alerting.policies.list(PolicyListParams**kwargs) -> SyncSinglePage[Policy]` **get** `/accounts/{account_id}/alerting/v3/policies` Get a list of all Notification policies. ### Parameters - `account_id: str` The account id ### Returns - `class Policy: …` - `id: Optional[str]` The unique identifier of a notification policy - `alert_interval: Optional[str]` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type: Optional[Literal["abuse_report_alert", "access_custom_certificate_expiration_type", "advanced_ddos_attack_l4_alert", 66 more]]` Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values. - `"abuse_report_alert"` - `"access_custom_certificate_expiration_type"` - `"advanced_ddos_attack_l4_alert"` - `"advanced_ddos_attack_l7_alert"` - `"advanced_http_alert_error"` - `"bgp_hijack_notification"` - `"billing_usage_alert"` - `"block_notification_block_removed"` - `"block_notification_new_block"` - `"block_notification_review_rejected"` - `"bot_traffic_basic_alert"` - `"brand_protection_alert"` - `"brand_protection_digest"` - `"clickhouse_alert_fw_anomaly"` - `"clickhouse_alert_fw_ent_anomaly"` - `"cloudforce_one_request_notification"` - `"cni_maintenance_notification"` - `"custom_analytics"` - `"custom_bot_detection_alert"` - `"custom_ssl_certificate_event_type"` - `"dedicated_ssl_certificate_event_type"` - `"device_connectivity_anomaly_alert"` - `"dos_attack_l4"` - `"dos_attack_l7"` - `"expiring_service_token_alert"` - `"failing_logpush_job_disabled_alert"` - `"fbm_auto_advertisement"` - `"fbm_dosd_attack"` - `"fbm_volumetric_attack"` - `"health_check_status_notification"` - `"hostname_aop_custom_certificate_expiration_type"` - `"http_alert_edge_error"` - `"http_alert_origin_error"` - `"image_notification"` - `"image_resizing_notification"` - `"incident_alert"` - `"load_balancing_health_alert"` - `"load_balancing_pool_enablement_alert"` - `"logo_match_alert"` - `"magic_tunnel_health_check_event"` - `"magic_wan_tunnel_health"` - `"maintenance_event_notification"` - `"mtls_certificate_store_certificate_expiration_type"` - `"pages_event_alert"` - `"radar_notification"` - `"real_origin_monitoring"` - `"scriptmonitor_alert_new_code_change_detections"` - `"scriptmonitor_alert_new_hosts"` - `"scriptmonitor_alert_new_malicious_hosts"` - `"scriptmonitor_alert_new_malicious_scripts"` - `"scriptmonitor_alert_new_malicious_url"` - `"scriptmonitor_alert_new_max_length_resource_url"` - `"scriptmonitor_alert_new_resources"` - `"secondary_dns_all_primaries_failing"` - `"secondary_dns_primaries_failing"` - `"secondary_dns_warning"` - `"secondary_dns_zone_successfully_updated"` - `"secondary_dns_zone_validation_warning"` - `"security_insights_alert"` - `"sentinel_alert"` - `"stream_live_notifications"` - `"synthetic_test_latency_alert"` - `"synthetic_test_low_availability_alert"` - `"traffic_anomalies_alert"` - `"tunnel_health_event"` - `"tunnel_update_event"` - `"universal_ssl_event_type"` - `"web_analytics_metrics_update"` - `"zone_aop_custom_certificate_expiration_type"` - `created: Optional[datetime]` - `description: Optional[str]` Optional description for the Notification policy. - `enabled: Optional[bool]` Whether or not the Notification policy is enabled. - `filters: Optional[PolicyFilter]` Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. - `actions: Optional[List[str]]` Usage depends on specific alert type - `affected_asns: Optional[List[str]]` Used for configuring radar_notification - `affected_components: Optional[List[str]]` Used for configuring incident_alert - `affected_locations: Optional[List[str]]` Used for configuring radar_notification - `airport_code: Optional[List[str]]` Used for configuring maintenance_event_notification - `alert_trigger_preferences: Optional[List[str]]` Usage depends on specific alert type - `alert_trigger_preferences_value: Optional[List[str]]` Usage depends on specific alert type - `enabled: Optional[List[str]]` Used for configuring load_balancing_pool_enablement_alert - `environment: Optional[List[str]]` Used for configuring pages_event_alert - `event: Optional[List[str]]` Used for configuring pages_event_alert - `event_source: Optional[List[str]]` Used for configuring load_balancing_health_alert - `event_type: Optional[List[str]]` Usage depends on specific alert type - `group_by: Optional[List[str]]` Usage depends on specific alert type - `health_check_id: Optional[List[str]]` Used for configuring health_check_status_notification - `incident_impact: Optional[List[Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"]]]` Used for configuring incident_alert - `"INCIDENT_IMPACT_NONE"` - `"INCIDENT_IMPACT_MINOR"` - `"INCIDENT_IMPACT_MAJOR"` - `"INCIDENT_IMPACT_CRITICAL"` - `input_id: Optional[List[str]]` Used for configuring stream_live_notifications - `insight_class: Optional[List[str]]` Used for configuring security_insights_alert - `limit: Optional[List[str]]` Used for configuring billing_usage_alert - `logo_tag: Optional[List[str]]` Used for configuring logo_match_alert - `megabits_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `new_health: Optional[List[str]]` Used for configuring load_balancing_health_alert - `new_status: Optional[List[str]]` Used for configuring tunnel_health_event - `packets_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `pool_id: Optional[List[str]]` Usage depends on specific alert type - `pop_names: Optional[List[str]]` Usage depends on specific alert type - `product: Optional[List[str]]` Used for configuring billing_usage_alert - `project_id: Optional[List[str]]` Used for configuring pages_event_alert - `protocol: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `query_tag: Optional[List[str]]` Usage depends on specific alert type - `requests_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `selectors: Optional[List[str]]` Usage depends on specific alert type - `services: Optional[List[str]]` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo: Optional[List[str]]` Usage depends on specific alert type - `status: Optional[List[str]]` Used for configuring health_check_status_notification - `target_hostname: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `target_ip: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions: Optional[List[Literal["security_events"]]]` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id: Optional[List[str]]` Used for configuring tunnel_health_event - `tunnel_name: Optional[List[str]]` Usage depends on specific alert type - `type: Optional[List[str]]` Usage depends on specific alert type - `where: Optional[List[str]]` Usage depends on specific alert type - `zones: Optional[List[str]]` Usage depends on specific alert type - `mechanisms: Optional[Mechanism]` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email: Optional[List[Email]]` - `id: Optional[str]` The email address - `pagerduty: Optional[List[Pagerduty]]` - `id: Optional[str]` UUID - `webhooks: Optional[List[Webhook]]` - `id: Optional[str]` UUID - `modified: Optional[datetime]` - `name: Optional[str]` Name of the policy. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.alerting.policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": [ { "id": "0da2b59ef118439d8097bdfb215203c9", "alert_interval": "30m", "alert_type": "universal_ssl_event_type", "created": "2014-01-01T05:20:00.12345Z", "description": "Something describing the policy.", "enabled": true, "filters": { "actions": [ "string" ], "affected_asns": [ "string" ], "affected_components": [ "string" ], "affected_locations": [ "string" ], "airport_code": [ "string" ], "alert_trigger_preferences": [ "string" ], "alert_trigger_preferences_value": [ "string" ], "enabled": [ "string" ], "environment": [ "string" ], "event": [ "string" ], "event_source": [ "string" ], "event_type": [ "string" ], "group_by": [ "string" ], "health_check_id": [ "string" ], "incident_impact": [ "INCIDENT_IMPACT_NONE" ], "input_id": [ "string" ], "insight_class": [ "string" ], "limit": [ "string" ], "logo_tag": [ "string" ], "megabits_per_second": [ "string" ], "new_health": [ "string" ], "new_status": [ "string" ], "packets_per_second": [ "string" ], "pool_id": [ "string" ], "pop_names": [ "string" ], "product": [ "string" ], "project_id": [ "string" ], "protocol": [ "string" ], "query_tag": [ "string" ], "requests_per_second": [ "string" ], "selectors": [ "string" ], "services": [ "string" ], "slo": [ "99.9" ], "status": [ "string" ], "target_hostname": [ "string" ], "target_ip": [ "string" ], "target_zone_name": [ "string" ], "traffic_exclusions": [ "security_events" ], "tunnel_id": [ "string" ], "tunnel_name": [ "string" ], "type": [ "string" ], "where": [ "string" ], "zones": [ "string" ] }, "mechanisms": { "email": [ { "id": "id" } ], "pagerduty": [ { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } ], "webhooks": [ { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } ] }, "modified": "2014-01-01T05:20:00.12345Z", "name": "SSL Notification Event Policy" } ] } ``` ## Get a Notification policy `alerting.policies.get(strpolicy_id, PolicyGetParams**kwargs) -> Policy` **get** `/accounts/{account_id}/alerting/v3/policies/{policy_id}` Get details for a single policy. ### Parameters - `account_id: str` The account id - `policy_id: str` The unique identifier of a notification policy ### Returns - `class Policy: …` - `id: Optional[str]` The unique identifier of a notification policy - `alert_interval: Optional[str]` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type: Optional[Literal["abuse_report_alert", "access_custom_certificate_expiration_type", "advanced_ddos_attack_l4_alert", 66 more]]` Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values. - `"abuse_report_alert"` - `"access_custom_certificate_expiration_type"` - `"advanced_ddos_attack_l4_alert"` - `"advanced_ddos_attack_l7_alert"` - `"advanced_http_alert_error"` - `"bgp_hijack_notification"` - `"billing_usage_alert"` - `"block_notification_block_removed"` - `"block_notification_new_block"` - `"block_notification_review_rejected"` - `"bot_traffic_basic_alert"` - `"brand_protection_alert"` - `"brand_protection_digest"` - `"clickhouse_alert_fw_anomaly"` - `"clickhouse_alert_fw_ent_anomaly"` - `"cloudforce_one_request_notification"` - `"cni_maintenance_notification"` - `"custom_analytics"` - `"custom_bot_detection_alert"` - `"custom_ssl_certificate_event_type"` - `"dedicated_ssl_certificate_event_type"` - `"device_connectivity_anomaly_alert"` - `"dos_attack_l4"` - `"dos_attack_l7"` - `"expiring_service_token_alert"` - `"failing_logpush_job_disabled_alert"` - `"fbm_auto_advertisement"` - `"fbm_dosd_attack"` - `"fbm_volumetric_attack"` - `"health_check_status_notification"` - `"hostname_aop_custom_certificate_expiration_type"` - `"http_alert_edge_error"` - `"http_alert_origin_error"` - `"image_notification"` - `"image_resizing_notification"` - `"incident_alert"` - `"load_balancing_health_alert"` - `"load_balancing_pool_enablement_alert"` - `"logo_match_alert"` - `"magic_tunnel_health_check_event"` - `"magic_wan_tunnel_health"` - `"maintenance_event_notification"` - `"mtls_certificate_store_certificate_expiration_type"` - `"pages_event_alert"` - `"radar_notification"` - `"real_origin_monitoring"` - `"scriptmonitor_alert_new_code_change_detections"` - `"scriptmonitor_alert_new_hosts"` - `"scriptmonitor_alert_new_malicious_hosts"` - `"scriptmonitor_alert_new_malicious_scripts"` - `"scriptmonitor_alert_new_malicious_url"` - `"scriptmonitor_alert_new_max_length_resource_url"` - `"scriptmonitor_alert_new_resources"` - `"secondary_dns_all_primaries_failing"` - `"secondary_dns_primaries_failing"` - `"secondary_dns_warning"` - `"secondary_dns_zone_successfully_updated"` - `"secondary_dns_zone_validation_warning"` - `"security_insights_alert"` - `"sentinel_alert"` - `"stream_live_notifications"` - `"synthetic_test_latency_alert"` - `"synthetic_test_low_availability_alert"` - `"traffic_anomalies_alert"` - `"tunnel_health_event"` - `"tunnel_update_event"` - `"universal_ssl_event_type"` - `"web_analytics_metrics_update"` - `"zone_aop_custom_certificate_expiration_type"` - `created: Optional[datetime]` - `description: Optional[str]` Optional description for the Notification policy. - `enabled: Optional[bool]` Whether or not the Notification policy is enabled. - `filters: Optional[PolicyFilter]` Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. - `actions: Optional[List[str]]` Usage depends on specific alert type - `affected_asns: Optional[List[str]]` Used for configuring radar_notification - `affected_components: Optional[List[str]]` Used for configuring incident_alert - `affected_locations: Optional[List[str]]` Used for configuring radar_notification - `airport_code: Optional[List[str]]` Used for configuring maintenance_event_notification - `alert_trigger_preferences: Optional[List[str]]` Usage depends on specific alert type - `alert_trigger_preferences_value: Optional[List[str]]` Usage depends on specific alert type - `enabled: Optional[List[str]]` Used for configuring load_balancing_pool_enablement_alert - `environment: Optional[List[str]]` Used for configuring pages_event_alert - `event: Optional[List[str]]` Used for configuring pages_event_alert - `event_source: Optional[List[str]]` Used for configuring load_balancing_health_alert - `event_type: Optional[List[str]]` Usage depends on specific alert type - `group_by: Optional[List[str]]` Usage depends on specific alert type - `health_check_id: Optional[List[str]]` Used for configuring health_check_status_notification - `incident_impact: Optional[List[Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"]]]` Used for configuring incident_alert - `"INCIDENT_IMPACT_NONE"` - `"INCIDENT_IMPACT_MINOR"` - `"INCIDENT_IMPACT_MAJOR"` - `"INCIDENT_IMPACT_CRITICAL"` - `input_id: Optional[List[str]]` Used for configuring stream_live_notifications - `insight_class: Optional[List[str]]` Used for configuring security_insights_alert - `limit: Optional[List[str]]` Used for configuring billing_usage_alert - `logo_tag: Optional[List[str]]` Used for configuring logo_match_alert - `megabits_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `new_health: Optional[List[str]]` Used for configuring load_balancing_health_alert - `new_status: Optional[List[str]]` Used for configuring tunnel_health_event - `packets_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `pool_id: Optional[List[str]]` Usage depends on specific alert type - `pop_names: Optional[List[str]]` Usage depends on specific alert type - `product: Optional[List[str]]` Used for configuring billing_usage_alert - `project_id: Optional[List[str]]` Used for configuring pages_event_alert - `protocol: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `query_tag: Optional[List[str]]` Usage depends on specific alert type - `requests_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `selectors: Optional[List[str]]` Usage depends on specific alert type - `services: Optional[List[str]]` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo: Optional[List[str]]` Usage depends on specific alert type - `status: Optional[List[str]]` Used for configuring health_check_status_notification - `target_hostname: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `target_ip: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions: Optional[List[Literal["security_events"]]]` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id: Optional[List[str]]` Used for configuring tunnel_health_event - `tunnel_name: Optional[List[str]]` Usage depends on specific alert type - `type: Optional[List[str]]` Usage depends on specific alert type - `where: Optional[List[str]]` Usage depends on specific alert type - `zones: Optional[List[str]]` Usage depends on specific alert type - `mechanisms: Optional[Mechanism]` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email: Optional[List[Email]]` - `id: Optional[str]` The email address - `pagerduty: Optional[List[Pagerduty]]` - `id: Optional[str]` UUID - `webhooks: Optional[List[Webhook]]` - `id: Optional[str]` UUID - `modified: Optional[datetime]` - `name: Optional[str]` Name of the policy. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) policy = client.alerting.policies.get( policy_id="0da2b59ef118439d8097bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(policy.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "0da2b59ef118439d8097bdfb215203c9", "alert_interval": "30m", "alert_type": "universal_ssl_event_type", "created": "2014-01-01T05:20:00.12345Z", "description": "Something describing the policy.", "enabled": true, "filters": { "actions": [ "string" ], "affected_asns": [ "string" ], "affected_components": [ "string" ], "affected_locations": [ "string" ], "airport_code": [ "string" ], "alert_trigger_preferences": [ "string" ], "alert_trigger_preferences_value": [ "string" ], "enabled": [ "string" ], "environment": [ "string" ], "event": [ "string" ], "event_source": [ "string" ], "event_type": [ "string" ], "group_by": [ "string" ], "health_check_id": [ "string" ], "incident_impact": [ "INCIDENT_IMPACT_NONE" ], "input_id": [ "string" ], "insight_class": [ "string" ], "limit": [ "string" ], "logo_tag": [ "string" ], "megabits_per_second": [ "string" ], "new_health": [ "string" ], "new_status": [ "string" ], "packets_per_second": [ "string" ], "pool_id": [ "string" ], "pop_names": [ "string" ], "product": [ "string" ], "project_id": [ "string" ], "protocol": [ "string" ], "query_tag": [ "string" ], "requests_per_second": [ "string" ], "selectors": [ "string" ], "services": [ "string" ], "slo": [ "99.9" ], "status": [ "string" ], "target_hostname": [ "string" ], "target_ip": [ "string" ], "target_zone_name": [ "string" ], "traffic_exclusions": [ "security_events" ], "tunnel_id": [ "string" ], "tunnel_name": [ "string" ], "type": [ "string" ], "where": [ "string" ], "zones": [ "string" ] }, "mechanisms": { "email": [ { "id": "id" } ], "pagerduty": [ { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } ], "webhooks": [ { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } ] }, "modified": "2014-01-01T05:20:00.12345Z", "name": "SSL Notification Event Policy" } } ``` ## Create a Notification policy `alerting.policies.create(PolicyCreateParams**kwargs) -> PolicyCreateResponse` **post** `/accounts/{account_id}/alerting/v3/policies` Creates a new Notification policy. ### Parameters - `account_id: str` The account id - `alert_type: Literal["abuse_report_alert", "access_custom_certificate_expiration_type", "advanced_ddos_attack_l4_alert", 66 more]` Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values. - `"abuse_report_alert"` - `"access_custom_certificate_expiration_type"` - `"advanced_ddos_attack_l4_alert"` - `"advanced_ddos_attack_l7_alert"` - `"advanced_http_alert_error"` - `"bgp_hijack_notification"` - `"billing_usage_alert"` - `"block_notification_block_removed"` - `"block_notification_new_block"` - `"block_notification_review_rejected"` - `"bot_traffic_basic_alert"` - `"brand_protection_alert"` - `"brand_protection_digest"` - `"clickhouse_alert_fw_anomaly"` - `"clickhouse_alert_fw_ent_anomaly"` - `"cloudforce_one_request_notification"` - `"cni_maintenance_notification"` - `"custom_analytics"` - `"custom_bot_detection_alert"` - `"custom_ssl_certificate_event_type"` - `"dedicated_ssl_certificate_event_type"` - `"device_connectivity_anomaly_alert"` - `"dos_attack_l4"` - `"dos_attack_l7"` - `"expiring_service_token_alert"` - `"failing_logpush_job_disabled_alert"` - `"fbm_auto_advertisement"` - `"fbm_dosd_attack"` - `"fbm_volumetric_attack"` - `"health_check_status_notification"` - `"hostname_aop_custom_certificate_expiration_type"` - `"http_alert_edge_error"` - `"http_alert_origin_error"` - `"image_notification"` - `"image_resizing_notification"` - `"incident_alert"` - `"load_balancing_health_alert"` - `"load_balancing_pool_enablement_alert"` - `"logo_match_alert"` - `"magic_tunnel_health_check_event"` - `"magic_wan_tunnel_health"` - `"maintenance_event_notification"` - `"mtls_certificate_store_certificate_expiration_type"` - `"pages_event_alert"` - `"radar_notification"` - `"real_origin_monitoring"` - `"scriptmonitor_alert_new_code_change_detections"` - `"scriptmonitor_alert_new_hosts"` - `"scriptmonitor_alert_new_malicious_hosts"` - `"scriptmonitor_alert_new_malicious_scripts"` - `"scriptmonitor_alert_new_malicious_url"` - `"scriptmonitor_alert_new_max_length_resource_url"` - `"scriptmonitor_alert_new_resources"` - `"secondary_dns_all_primaries_failing"` - `"secondary_dns_primaries_failing"` - `"secondary_dns_warning"` - `"secondary_dns_zone_successfully_updated"` - `"secondary_dns_zone_validation_warning"` - `"security_insights_alert"` - `"sentinel_alert"` - `"stream_live_notifications"` - `"synthetic_test_latency_alert"` - `"synthetic_test_low_availability_alert"` - `"traffic_anomalies_alert"` - `"tunnel_health_event"` - `"tunnel_update_event"` - `"universal_ssl_event_type"` - `"web_analytics_metrics_update"` - `"zone_aop_custom_certificate_expiration_type"` - `enabled: bool` Whether or not the Notification policy is enabled. - `mechanisms: MechanismParam` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email: Optional[List[Email]]` - `id: Optional[str]` The email address - `pagerduty: Optional[List[Pagerduty]]` - `id: Optional[str]` UUID - `webhooks: Optional[List[Webhook]]` - `id: Optional[str]` UUID - `name: str` Name of the policy. - `alert_interval: Optional[str]` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `description: Optional[str]` Optional description for the Notification policy. - `filters: Optional[PolicyFilterParam]` Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. - `actions: Optional[List[str]]` Usage depends on specific alert type - `affected_asns: Optional[List[str]]` Used for configuring radar_notification - `affected_components: Optional[List[str]]` Used for configuring incident_alert - `affected_locations: Optional[List[str]]` Used for configuring radar_notification - `airport_code: Optional[List[str]]` Used for configuring maintenance_event_notification - `alert_trigger_preferences: Optional[List[str]]` Usage depends on specific alert type - `alert_trigger_preferences_value: Optional[List[str]]` Usage depends on specific alert type - `enabled: Optional[List[str]]` Used for configuring load_balancing_pool_enablement_alert - `environment: Optional[List[str]]` Used for configuring pages_event_alert - `event: Optional[List[str]]` Used for configuring pages_event_alert - `event_source: Optional[List[str]]` Used for configuring load_balancing_health_alert - `event_type: Optional[List[str]]` Usage depends on specific alert type - `group_by: Optional[List[str]]` Usage depends on specific alert type - `health_check_id: Optional[List[str]]` Used for configuring health_check_status_notification - `incident_impact: Optional[List[Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"]]]` Used for configuring incident_alert - `"INCIDENT_IMPACT_NONE"` - `"INCIDENT_IMPACT_MINOR"` - `"INCIDENT_IMPACT_MAJOR"` - `"INCIDENT_IMPACT_CRITICAL"` - `input_id: Optional[List[str]]` Used for configuring stream_live_notifications - `insight_class: Optional[List[str]]` Used for configuring security_insights_alert - `limit: Optional[List[str]]` Used for configuring billing_usage_alert - `logo_tag: Optional[List[str]]` Used for configuring logo_match_alert - `megabits_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `new_health: Optional[List[str]]` Used for configuring load_balancing_health_alert - `new_status: Optional[List[str]]` Used for configuring tunnel_health_event - `packets_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `pool_id: Optional[List[str]]` Usage depends on specific alert type - `pop_names: Optional[List[str]]` Usage depends on specific alert type - `product: Optional[List[str]]` Used for configuring billing_usage_alert - `project_id: Optional[List[str]]` Used for configuring pages_event_alert - `protocol: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `query_tag: Optional[List[str]]` Usage depends on specific alert type - `requests_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `selectors: Optional[List[str]]` Usage depends on specific alert type - `services: Optional[List[str]]` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo: Optional[List[str]]` Usage depends on specific alert type - `status: Optional[List[str]]` Used for configuring health_check_status_notification - `target_hostname: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `target_ip: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions: Optional[List[Literal["security_events"]]]` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id: Optional[List[str]]` Used for configuring tunnel_health_event - `tunnel_name: Optional[List[str]]` Usage depends on specific alert type - `type: Optional[List[str]]` Usage depends on specific alert type - `where: Optional[List[str]]` Usage depends on specific alert type - `zones: Optional[List[str]]` Usage depends on specific alert type ### Returns - `class PolicyCreateResponse: …` - `id: Optional[str]` UUID ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) policy = client.alerting.policies.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", alert_type="universal_ssl_event_type", enabled=True, mechanisms={}, name="SSL Notification Event Policy", ) print(policy.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Update a Notification policy `alerting.policies.update(strpolicy_id, PolicyUpdateParams**kwargs) -> PolicyUpdateResponse` **put** `/accounts/{account_id}/alerting/v3/policies/{policy_id}` Update a Notification policy. ### Parameters - `account_id: str` The account id - `policy_id: str` The unique identifier of a notification policy - `alert_interval: Optional[str]` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type: Optional[Literal["abuse_report_alert", "access_custom_certificate_expiration_type", "advanced_ddos_attack_l4_alert", 66 more]]` Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values. - `"abuse_report_alert"` - `"access_custom_certificate_expiration_type"` - `"advanced_ddos_attack_l4_alert"` - `"advanced_ddos_attack_l7_alert"` - `"advanced_http_alert_error"` - `"bgp_hijack_notification"` - `"billing_usage_alert"` - `"block_notification_block_removed"` - `"block_notification_new_block"` - `"block_notification_review_rejected"` - `"bot_traffic_basic_alert"` - `"brand_protection_alert"` - `"brand_protection_digest"` - `"clickhouse_alert_fw_anomaly"` - `"clickhouse_alert_fw_ent_anomaly"` - `"cloudforce_one_request_notification"` - `"cni_maintenance_notification"` - `"custom_analytics"` - `"custom_bot_detection_alert"` - `"custom_ssl_certificate_event_type"` - `"dedicated_ssl_certificate_event_type"` - `"device_connectivity_anomaly_alert"` - `"dos_attack_l4"` - `"dos_attack_l7"` - `"expiring_service_token_alert"` - `"failing_logpush_job_disabled_alert"` - `"fbm_auto_advertisement"` - `"fbm_dosd_attack"` - `"fbm_volumetric_attack"` - `"health_check_status_notification"` - `"hostname_aop_custom_certificate_expiration_type"` - `"http_alert_edge_error"` - `"http_alert_origin_error"` - `"image_notification"` - `"image_resizing_notification"` - `"incident_alert"` - `"load_balancing_health_alert"` - `"load_balancing_pool_enablement_alert"` - `"logo_match_alert"` - `"magic_tunnel_health_check_event"` - `"magic_wan_tunnel_health"` - `"maintenance_event_notification"` - `"mtls_certificate_store_certificate_expiration_type"` - `"pages_event_alert"` - `"radar_notification"` - `"real_origin_monitoring"` - `"scriptmonitor_alert_new_code_change_detections"` - `"scriptmonitor_alert_new_hosts"` - `"scriptmonitor_alert_new_malicious_hosts"` - `"scriptmonitor_alert_new_malicious_scripts"` - `"scriptmonitor_alert_new_malicious_url"` - `"scriptmonitor_alert_new_max_length_resource_url"` - `"scriptmonitor_alert_new_resources"` - `"secondary_dns_all_primaries_failing"` - `"secondary_dns_primaries_failing"` - `"secondary_dns_warning"` - `"secondary_dns_zone_successfully_updated"` - `"secondary_dns_zone_validation_warning"` - `"security_insights_alert"` - `"sentinel_alert"` - `"stream_live_notifications"` - `"synthetic_test_latency_alert"` - `"synthetic_test_low_availability_alert"` - `"traffic_anomalies_alert"` - `"tunnel_health_event"` - `"tunnel_update_event"` - `"universal_ssl_event_type"` - `"web_analytics_metrics_update"` - `"zone_aop_custom_certificate_expiration_type"` - `description: Optional[str]` Optional description for the Notification policy. - `enabled: Optional[bool]` Whether or not the Notification policy is enabled. - `filters: Optional[PolicyFilterParam]` Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. - `actions: Optional[List[str]]` Usage depends on specific alert type - `affected_asns: Optional[List[str]]` Used for configuring radar_notification - `affected_components: Optional[List[str]]` Used for configuring incident_alert - `affected_locations: Optional[List[str]]` Used for configuring radar_notification - `airport_code: Optional[List[str]]` Used for configuring maintenance_event_notification - `alert_trigger_preferences: Optional[List[str]]` Usage depends on specific alert type - `alert_trigger_preferences_value: Optional[List[str]]` Usage depends on specific alert type - `enabled: Optional[List[str]]` Used for configuring load_balancing_pool_enablement_alert - `environment: Optional[List[str]]` Used for configuring pages_event_alert - `event: Optional[List[str]]` Used for configuring pages_event_alert - `event_source: Optional[List[str]]` Used for configuring load_balancing_health_alert - `event_type: Optional[List[str]]` Usage depends on specific alert type - `group_by: Optional[List[str]]` Usage depends on specific alert type - `health_check_id: Optional[List[str]]` Used for configuring health_check_status_notification - `incident_impact: Optional[List[Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"]]]` Used for configuring incident_alert - `"INCIDENT_IMPACT_NONE"` - `"INCIDENT_IMPACT_MINOR"` - `"INCIDENT_IMPACT_MAJOR"` - `"INCIDENT_IMPACT_CRITICAL"` - `input_id: Optional[List[str]]` Used for configuring stream_live_notifications - `insight_class: Optional[List[str]]` Used for configuring security_insights_alert - `limit: Optional[List[str]]` Used for configuring billing_usage_alert - `logo_tag: Optional[List[str]]` Used for configuring logo_match_alert - `megabits_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `new_health: Optional[List[str]]` Used for configuring load_balancing_health_alert - `new_status: Optional[List[str]]` Used for configuring tunnel_health_event - `packets_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `pool_id: Optional[List[str]]` Usage depends on specific alert type - `pop_names: Optional[List[str]]` Usage depends on specific alert type - `product: Optional[List[str]]` Used for configuring billing_usage_alert - `project_id: Optional[List[str]]` Used for configuring pages_event_alert - `protocol: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `query_tag: Optional[List[str]]` Usage depends on specific alert type - `requests_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `selectors: Optional[List[str]]` Usage depends on specific alert type - `services: Optional[List[str]]` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo: Optional[List[str]]` Usage depends on specific alert type - `status: Optional[List[str]]` Used for configuring health_check_status_notification - `target_hostname: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `target_ip: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions: Optional[List[Literal["security_events"]]]` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id: Optional[List[str]]` Used for configuring tunnel_health_event - `tunnel_name: Optional[List[str]]` Usage depends on specific alert type - `type: Optional[List[str]]` Usage depends on specific alert type - `where: Optional[List[str]]` Usage depends on specific alert type - `zones: Optional[List[str]]` Usage depends on specific alert type - `mechanisms: Optional[MechanismParam]` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email: Optional[List[Email]]` - `id: Optional[str]` The email address - `pagerduty: Optional[List[Pagerduty]]` - `id: Optional[str]` UUID - `webhooks: Optional[List[Webhook]]` - `id: Optional[str]` UUID - `name: Optional[str]` Name of the policy. ### Returns - `class PolicyUpdateResponse: …` - `id: Optional[str]` UUID ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) policy = client.alerting.policies.update( policy_id="0da2b59ef118439d8097bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(policy.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Delete a Notification policy `alerting.policies.delete(strpolicy_id, PolicyDeleteParams**kwargs) -> PolicyDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/policies/{policy_id}` Delete a Notification policy. ### Parameters - `account_id: str` The account id - `policy_id: str` The unique identifier of a notification policy ### Returns - `class PolicyDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` - `result_info: Optional[ResultInfo]` - `count: Optional[float]` Total number of results for the requested service - `page: Optional[float]` Current page within paginated list of results - `per_page: Optional[float]` Number of results per page of results - `total_count: Optional[float]` Total results available without any search parameters ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) policy = client.alerting.policies.delete( policy_id="0da2b59ef118439d8097bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(policy.errors) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Domain Types ### Mechanism - `class Mechanism: …` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email: Optional[List[Email]]` - `id: Optional[str]` The email address - `pagerduty: Optional[List[Pagerduty]]` - `id: Optional[str]` UUID - `webhooks: Optional[List[Webhook]]` - `id: Optional[str]` UUID ### Policy - `class Policy: …` - `id: Optional[str]` The unique identifier of a notification policy - `alert_interval: Optional[str]` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type: Optional[Literal["abuse_report_alert", "access_custom_certificate_expiration_type", "advanced_ddos_attack_l4_alert", 66 more]]` Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values. - `"abuse_report_alert"` - `"access_custom_certificate_expiration_type"` - `"advanced_ddos_attack_l4_alert"` - `"advanced_ddos_attack_l7_alert"` - `"advanced_http_alert_error"` - `"bgp_hijack_notification"` - `"billing_usage_alert"` - `"block_notification_block_removed"` - `"block_notification_new_block"` - `"block_notification_review_rejected"` - `"bot_traffic_basic_alert"` - `"brand_protection_alert"` - `"brand_protection_digest"` - `"clickhouse_alert_fw_anomaly"` - `"clickhouse_alert_fw_ent_anomaly"` - `"cloudforce_one_request_notification"` - `"cni_maintenance_notification"` - `"custom_analytics"` - `"custom_bot_detection_alert"` - `"custom_ssl_certificate_event_type"` - `"dedicated_ssl_certificate_event_type"` - `"device_connectivity_anomaly_alert"` - `"dos_attack_l4"` - `"dos_attack_l7"` - `"expiring_service_token_alert"` - `"failing_logpush_job_disabled_alert"` - `"fbm_auto_advertisement"` - `"fbm_dosd_attack"` - `"fbm_volumetric_attack"` - `"health_check_status_notification"` - `"hostname_aop_custom_certificate_expiration_type"` - `"http_alert_edge_error"` - `"http_alert_origin_error"` - `"image_notification"` - `"image_resizing_notification"` - `"incident_alert"` - `"load_balancing_health_alert"` - `"load_balancing_pool_enablement_alert"` - `"logo_match_alert"` - `"magic_tunnel_health_check_event"` - `"magic_wan_tunnel_health"` - `"maintenance_event_notification"` - `"mtls_certificate_store_certificate_expiration_type"` - `"pages_event_alert"` - `"radar_notification"` - `"real_origin_monitoring"` - `"scriptmonitor_alert_new_code_change_detections"` - `"scriptmonitor_alert_new_hosts"` - `"scriptmonitor_alert_new_malicious_hosts"` - `"scriptmonitor_alert_new_malicious_scripts"` - `"scriptmonitor_alert_new_malicious_url"` - `"scriptmonitor_alert_new_max_length_resource_url"` - `"scriptmonitor_alert_new_resources"` - `"secondary_dns_all_primaries_failing"` - `"secondary_dns_primaries_failing"` - `"secondary_dns_warning"` - `"secondary_dns_zone_successfully_updated"` - `"secondary_dns_zone_validation_warning"` - `"security_insights_alert"` - `"sentinel_alert"` - `"stream_live_notifications"` - `"synthetic_test_latency_alert"` - `"synthetic_test_low_availability_alert"` - `"traffic_anomalies_alert"` - `"tunnel_health_event"` - `"tunnel_update_event"` - `"universal_ssl_event_type"` - `"web_analytics_metrics_update"` - `"zone_aop_custom_certificate_expiration_type"` - `created: Optional[datetime]` - `description: Optional[str]` Optional description for the Notification policy. - `enabled: Optional[bool]` Whether or not the Notification policy is enabled. - `filters: Optional[PolicyFilter]` Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. - `actions: Optional[List[str]]` Usage depends on specific alert type - `affected_asns: Optional[List[str]]` Used for configuring radar_notification - `affected_components: Optional[List[str]]` Used for configuring incident_alert - `affected_locations: Optional[List[str]]` Used for configuring radar_notification - `airport_code: Optional[List[str]]` Used for configuring maintenance_event_notification - `alert_trigger_preferences: Optional[List[str]]` Usage depends on specific alert type - `alert_trigger_preferences_value: Optional[List[str]]` Usage depends on specific alert type - `enabled: Optional[List[str]]` Used for configuring load_balancing_pool_enablement_alert - `environment: Optional[List[str]]` Used for configuring pages_event_alert - `event: Optional[List[str]]` Used for configuring pages_event_alert - `event_source: Optional[List[str]]` Used for configuring load_balancing_health_alert - `event_type: Optional[List[str]]` Usage depends on specific alert type - `group_by: Optional[List[str]]` Usage depends on specific alert type - `health_check_id: Optional[List[str]]` Used for configuring health_check_status_notification - `incident_impact: Optional[List[Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"]]]` Used for configuring incident_alert - `"INCIDENT_IMPACT_NONE"` - `"INCIDENT_IMPACT_MINOR"` - `"INCIDENT_IMPACT_MAJOR"` - `"INCIDENT_IMPACT_CRITICAL"` - `input_id: Optional[List[str]]` Used for configuring stream_live_notifications - `insight_class: Optional[List[str]]` Used for configuring security_insights_alert - `limit: Optional[List[str]]` Used for configuring billing_usage_alert - `logo_tag: Optional[List[str]]` Used for configuring logo_match_alert - `megabits_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `new_health: Optional[List[str]]` Used for configuring load_balancing_health_alert - `new_status: Optional[List[str]]` Used for configuring tunnel_health_event - `packets_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `pool_id: Optional[List[str]]` Usage depends on specific alert type - `pop_names: Optional[List[str]]` Usage depends on specific alert type - `product: Optional[List[str]]` Used for configuring billing_usage_alert - `project_id: Optional[List[str]]` Used for configuring pages_event_alert - `protocol: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `query_tag: Optional[List[str]]` Usage depends on specific alert type - `requests_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `selectors: Optional[List[str]]` Usage depends on specific alert type - `services: Optional[List[str]]` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo: Optional[List[str]]` Usage depends on specific alert type - `status: Optional[List[str]]` Used for configuring health_check_status_notification - `target_hostname: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `target_ip: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions: Optional[List[Literal["security_events"]]]` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id: Optional[List[str]]` Used for configuring tunnel_health_event - `tunnel_name: Optional[List[str]]` Usage depends on specific alert type - `type: Optional[List[str]]` Usage depends on specific alert type - `where: Optional[List[str]]` Usage depends on specific alert type - `zones: Optional[List[str]]` Usage depends on specific alert type - `mechanisms: Optional[Mechanism]` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email: Optional[List[Email]]` - `id: Optional[str]` The email address - `pagerduty: Optional[List[Pagerduty]]` - `id: Optional[str]` UUID - `webhooks: Optional[List[Webhook]]` - `id: Optional[str]` UUID - `modified: Optional[datetime]` - `name: Optional[str]` Name of the policy. ### Policy Filter - `class PolicyFilter: …` Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. - `actions: Optional[List[str]]` Usage depends on specific alert type - `affected_asns: Optional[List[str]]` Used for configuring radar_notification - `affected_components: Optional[List[str]]` Used for configuring incident_alert - `affected_locations: Optional[List[str]]` Used for configuring radar_notification - `airport_code: Optional[List[str]]` Used for configuring maintenance_event_notification - `alert_trigger_preferences: Optional[List[str]]` Usage depends on specific alert type - `alert_trigger_preferences_value: Optional[List[str]]` Usage depends on specific alert type - `enabled: Optional[List[str]]` Used for configuring load_balancing_pool_enablement_alert - `environment: Optional[List[str]]` Used for configuring pages_event_alert - `event: Optional[List[str]]` Used for configuring pages_event_alert - `event_source: Optional[List[str]]` Used for configuring load_balancing_health_alert - `event_type: Optional[List[str]]` Usage depends on specific alert type - `group_by: Optional[List[str]]` Usage depends on specific alert type - `health_check_id: Optional[List[str]]` Used for configuring health_check_status_notification - `incident_impact: Optional[List[Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"]]]` Used for configuring incident_alert - `"INCIDENT_IMPACT_NONE"` - `"INCIDENT_IMPACT_MINOR"` - `"INCIDENT_IMPACT_MAJOR"` - `"INCIDENT_IMPACT_CRITICAL"` - `input_id: Optional[List[str]]` Used for configuring stream_live_notifications - `insight_class: Optional[List[str]]` Used for configuring security_insights_alert - `limit: Optional[List[str]]` Used for configuring billing_usage_alert - `logo_tag: Optional[List[str]]` Used for configuring logo_match_alert - `megabits_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `new_health: Optional[List[str]]` Used for configuring load_balancing_health_alert - `new_status: Optional[List[str]]` Used for configuring tunnel_health_event - `packets_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `pool_id: Optional[List[str]]` Usage depends on specific alert type - `pop_names: Optional[List[str]]` Usage depends on specific alert type - `product: Optional[List[str]]` Used for configuring billing_usage_alert - `project_id: Optional[List[str]]` Used for configuring pages_event_alert - `protocol: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `query_tag: Optional[List[str]]` Usage depends on specific alert type - `requests_per_second: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `selectors: Optional[List[str]]` Usage depends on specific alert type - `services: Optional[List[str]]` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo: Optional[List[str]]` Usage depends on specific alert type - `status: Optional[List[str]]` Used for configuring health_check_status_notification - `target_hostname: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `target_ip: Optional[List[str]]` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name: Optional[List[str]]` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions: Optional[List[Literal["security_events"]]]` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id: Optional[List[str]]` Used for configuring tunnel_health_event - `tunnel_name: Optional[List[str]]` Usage depends on specific alert type - `type: Optional[List[str]]` Usage depends on specific alert type - `where: Optional[List[str]]` Usage depends on specific alert type - `zones: Optional[List[str]]` Usage depends on specific alert type ### Policy Create Response - `class PolicyCreateResponse: …` - `id: Optional[str]` UUID ### Policy Update Response - `class PolicyUpdateResponse: …` - `id: Optional[str]` UUID ### Policy Delete Response - `class PolicyDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` - `result_info: Optional[ResultInfo]` - `count: Optional[float]` Total number of results for the requested service - `page: Optional[float]` Current page within paginated list of results - `per_page: Optional[float]` Number of results per page of results - `total_count: Optional[float]` Total results available without any search parameters # Silences ## List Silences `alerting.silences.list(SilenceListParams**kwargs) -> SyncSinglePage[SilenceListResponse]` **get** `/accounts/{account_id}/alerting/v3/silences` Gets a list of silences for an account. ### Parameters - `account_id: str` The account id ### Returns - `class SilenceListResponse: …` - `id: Optional[str]` Silence ID - `created_at: Optional[str]` When the silence was created. - `end_time: Optional[str]` When the silence ends. - `policy_id: Optional[str]` The unique identifier of a notification policy - `start_time: Optional[str]` When the silence starts. - `updated_at: Optional[str]` When the silence was modified. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.alerting.silences.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": [ { "id": "f878e90c23f44126ae3cfc399f646977", "created_at": "2022-01-01T00:00:00Z", "end_time": "2022-01-01T00:00:00Z", "policy_id": "0da2b59ef118439d8097bdfb215203c9", "start_time": "2022-01-01T00:00:00Z", "updated_at": "2022-01-01T00:00:00Z" } ] } ``` ## Get Silence `alerting.silences.get(strsilence_id, SilenceGetParams**kwargs) -> SilenceGetResponse` **get** `/accounts/{account_id}/alerting/v3/silences/{silence_id}` Gets a specific silence for an account. ### Parameters - `account_id: str` The account id - `silence_id: str` Silence ID ### Returns - `class SilenceGetResponse: …` - `id: Optional[str]` Silence ID - `created_at: Optional[str]` When the silence was created. - `end_time: Optional[str]` When the silence ends. - `policy_id: Optional[str]` The unique identifier of a notification policy - `start_time: Optional[str]` When the silence starts. - `updated_at: Optional[str]` When the silence was modified. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) silence = client.alerting.silences.get( silence_id="f878e90c23f44126ae3cfc399f646977", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(silence.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f878e90c23f44126ae3cfc399f646977", "created_at": "2022-01-01T00:00:00Z", "end_time": "2022-01-01T00:00:00Z", "policy_id": "0da2b59ef118439d8097bdfb215203c9", "start_time": "2022-01-01T00:00:00Z", "updated_at": "2022-01-01T00:00:00Z" } } ``` ## Create Silences `alerting.silences.create(SilenceCreateParams**kwargs) -> SilenceCreateResponse` **post** `/accounts/{account_id}/alerting/v3/silences` Creates a new silence for an account. ### Parameters - `account_id: str` The account id - `body: Iterable[Body]` - `end_time: Optional[str]` When the silence ends. - `policy_id: Optional[str]` The unique identifier of a notification policy - `start_time: Optional[str]` When the silence starts. ### Returns - `class SilenceCreateResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) silence = client.alerting.silences.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{}], ) print(silence.errors) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Update Silences `alerting.silences.update(SilenceUpdateParams**kwargs) -> SyncSinglePage[SilenceUpdateResponse]` **put** `/accounts/{account_id}/alerting/v3/silences` Updates existing silences for an account. ### Parameters - `account_id: str` The account id - `body: Iterable[Body]` - `id: Optional[str]` Silence ID - `end_time: Optional[str]` When the silence ends. - `start_time: Optional[str]` When the silence starts. ### Returns - `class SilenceUpdateResponse: …` - `id: Optional[str]` Silence ID - `created_at: Optional[str]` When the silence was created. - `end_time: Optional[str]` When the silence ends. - `policy_id: Optional[str]` The unique identifier of a notification policy - `start_time: Optional[str]` When the silence starts. - `updated_at: Optional[str]` When the silence was modified. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.alerting.silences.update( account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{}], ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": [ { "id": "f878e90c23f44126ae3cfc399f646977", "created_at": "2022-01-01T00:00:00Z", "end_time": "2022-01-01T00:00:00Z", "policy_id": "0da2b59ef118439d8097bdfb215203c9", "start_time": "2022-01-01T00:00:00Z", "updated_at": "2022-01-01T00:00:00Z" } ] } ``` ## Delete Silence `alerting.silences.delete(strsilence_id, SilenceDeleteParams**kwargs) -> SilenceDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/silences/{silence_id}` Deletes an existing silence for an account. ### Parameters - `account_id: str` The account id - `silence_id: str` Silence ID ### Returns - `class SilenceDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) silence = client.alerting.silences.delete( silence_id="f878e90c23f44126ae3cfc399f646977", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(silence.errors) ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Domain Types ### Silence List Response - `class SilenceListResponse: …` - `id: Optional[str]` Silence ID - `created_at: Optional[str]` When the silence was created. - `end_time: Optional[str]` When the silence ends. - `policy_id: Optional[str]` The unique identifier of a notification policy - `start_time: Optional[str]` When the silence starts. - `updated_at: Optional[str]` When the silence was modified. ### Silence Get Response - `class SilenceGetResponse: …` - `id: Optional[str]` Silence ID - `created_at: Optional[str]` When the silence was created. - `end_time: Optional[str]` When the silence ends. - `policy_id: Optional[str]` The unique identifier of a notification policy - `start_time: Optional[str]` When the silence starts. - `updated_at: Optional[str]` When the silence was modified. ### Silence Create Response - `class SilenceCreateResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true` ### Silence Update Response - `class SilenceUpdateResponse: …` - `id: Optional[str]` Silence ID - `created_at: Optional[str]` When the silence was created. - `end_time: Optional[str]` When the silence ends. - `policy_id: Optional[str]` The unique identifier of a notification policy - `start_time: Optional[str]` When the silence starts. - `updated_at: Optional[str]` When the silence was modified. ### Silence Delete Response - `class SilenceDeleteResponse: …` - `errors: List[Error]` - `message: str` - `code: Optional[int]` - `messages: List[Message]` - `message: str` - `code: Optional[int]` - `success: Literal[true]` Whether the API call was successful - `true`