# Alerting # Available Alerts ## Get Alert Types `client.alerting.availableAlerts.list(AvailableAlertListParamsparams, RequestOptionsoptions?): AvailableAlertListResponse` **get** `/accounts/{account_id}/alerting/v3/available_alerts` Gets a list of all alert types for which an account is eligible. ### Parameters - `params: AvailableAlertListParams` - `account_id: string` The account id ### Returns - `AvailableAlertListResponse = Record>` - `description?: string` Describes the alert type. - `display_name?: string` Alert type name. - `filter_options?: Array` Format of additional configuration options (filters) for the alert type. Data type of filters during policy creation: Array of strings. - `type?: string` Use this value when creating and updating a notification policy. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const availableAlerts = await client.alerting.availableAlerts.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(availableAlerts); ``` #### 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 - `AvailableAlertListResponse = Record>` - `description?: string` Describes the alert type. - `display_name?: string` Alert type name. - `filter_options?: Array` Format of additional configuration options (filters) for the alert type. Data type of filters during policy creation: Array of strings. - `type?: string` Use this value when creating and updating a notification policy. # Destinations # Eligible ## Get delivery mechanism eligibility `client.alerting.destinations.eligible.get(EligibleGetParamsparams, RequestOptionsoptions?): EligibleGetResponse` **get** `/accounts/{account_id}/alerting/v3/destinations/eligible` Get a list of all delivery mechanism types for which an account is eligible. ### Parameters - `params: EligibleGetParams` - `account_id: string` The account id ### Returns - `EligibleGetResponse = Record>` - `eligible?: boolean` Determines whether or not the account is eligible for the delivery mechanism. - `ready?: boolean` Beta flag. Users can create a policy with a mechanism that is not ready, but we cannot guarantee successful delivery of notifications. - `type?: "email" | "pagerduty" | "webhook"` Determines type of delivery mechanism. - `"email"` - `"pagerduty"` - `"webhook"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const eligible = await client.alerting.destinations.eligible.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 - `EligibleGetResponse = Record>` - `eligible?: boolean` Determines whether or not the account is eligible for the delivery mechanism. - `ready?: boolean` Beta flag. Users can create a policy with a mechanism that is not ready, but we cannot guarantee successful delivery of notifications. - `type?: "email" | "pagerduty" | "webhook"` Determines type of delivery mechanism. - `"email"` - `"pagerduty"` - `"webhook"` # Pagerduty ## List PagerDuty services `client.alerting.destinations.pagerduty.get(PagerdutyGetParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/alerting/v3/destinations/pagerduty` Get a list of all configured PagerDuty services. ### Parameters - `params: PagerdutyGetParams` - `account_id: string` The account id ### Returns - `Pagerduty` - `id?: string` UUID - `name?: string` The name of the pagerduty service. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const pagerduty of client.alerting.destinations.pagerduty.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(pagerduty.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 `client.alerting.destinations.pagerduty.create(PagerdutyCreateParamsparams, RequestOptionsoptions?): PagerdutyCreateResponse` **post** `/accounts/{account_id}/alerting/v3/destinations/pagerduty/connect` Creates a new token for integrating with PagerDuty. ### Parameters - `params: PagerdutyCreateParams` - `account_id: string` The account id ### Returns - `PagerdutyCreateResponse` - `id?: string` token in form of UUID ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const pagerduty = await client.alerting.destinations.pagerduty.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(pagerduty.id); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "a313ba7d3e464c0ea40808fafbc3816a" } } ``` ## Delete PagerDuty Services `client.alerting.destinations.pagerduty.delete(PagerdutyDeleteParamsparams, RequestOptionsoptions?): PagerdutyDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/destinations/pagerduty` Deletes all the PagerDuty Services connected to the account. ### Parameters - `params: PagerdutyDeleteParams` - `account_id: string` The account id ### Returns - `PagerdutyDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const pagerduty = await client.alerting.destinations.pagerduty.delete({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(pagerduty.errors); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Connect PagerDuty `client.alerting.destinations.pagerduty.link(stringtokenId, PagerdutyLinkParamsparams, RequestOptionsoptions?): PagerdutyLinkResponse` **get** `/accounts/{account_id}/alerting/v3/destinations/pagerduty/connect/{token_id}` Links PagerDuty with the account using the integration token. ### Parameters - `tokenId: string` The token integration key - `params: PagerdutyLinkParams` - `account_id: string` The account id ### Returns - `PagerdutyLinkResponse` - `id?: string` UUID ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.alerting.destinations.pagerduty.link( '8c71e667571b4f61b94d9e4b12158038', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(response.id); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Domain Types ### Pagerduty - `Pagerduty` - `id?: string` UUID - `name?: string` The name of the pagerduty service. ### Pagerduty Create Response - `PagerdutyCreateResponse` - `id?: string` token in form of UUID ### Pagerduty Delete Response - `PagerdutyDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` ### Pagerduty Link Response - `PagerdutyLinkResponse` - `id?: string` UUID # Webhooks ## List webhooks `client.alerting.destinations.webhooks.list(WebhookListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/alerting/v3/destinations/webhooks` Gets a list of all configured webhook destinations. ### Parameters - `params: WebhookListParams` - `account_id: string` The account id ### Returns - `Webhooks` - `id?: string` The unique identifier of a webhook - `created_at?: string` Timestamp of when the webhook destination was created. - `last_failure?: string` Timestamp of the last time an attempt to dispatch a notification to this webhook failed. - `last_success?: string` Timestamp of the last time Cloudflare was able to successfully dispatch a notification using this webhook. - `name?: string` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `secret?: string` 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?: "datadog" | "discord" | "feishu" | 5 more` Type of webhook endpoint. - `"datadog"` - `"discord"` - `"feishu"` - `"gchat"` - `"generic"` - `"opsgenie"` - `"slack"` - `"splunk"` - `url?: string` The POST endpoint to call when dispatching a notification. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const webhooks of client.alerting.destinations.webhooks.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(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" } ] } ``` ## Get a webhook `client.alerting.destinations.webhooks.get(stringwebhookId, WebhookGetParamsparams, RequestOptionsoptions?): Webhooks` **get** `/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}` Get details for a single webhooks destination. ### Parameters - `webhookId: string` The unique identifier of a webhook - `params: WebhookGetParams` - `account_id: string` The account id ### Returns - `Webhooks` - `id?: string` The unique identifier of a webhook - `created_at?: string` Timestamp of when the webhook destination was created. - `last_failure?: string` Timestamp of the last time an attempt to dispatch a notification to this webhook failed. - `last_success?: string` Timestamp of the last time Cloudflare was able to successfully dispatch a notification using this webhook. - `name?: string` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `secret?: string` 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?: "datadog" | "discord" | "feishu" | 5 more` Type of webhook endpoint. - `"datadog"` - `"discord"` - `"feishu"` - `"gchat"` - `"generic"` - `"opsgenie"` - `"slack"` - `"splunk"` - `url?: string` The POST endpoint to call when dispatching a notification. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const webhooks = await client.alerting.destinations.webhooks.get( 'b115d5ec15c641ee8b7692c449b5227b', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(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 `client.alerting.destinations.webhooks.create(WebhookCreateParamsparams, RequestOptionsoptions?): WebhookCreateResponse` **post** `/accounts/{account_id}/alerting/v3/destinations/webhooks` Creates a new webhook destination. ### Parameters - `params: WebhookCreateParams` - `account_id: string` Path param: The account id - `name: string` Body param: The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `url: string` Body param: The POST endpoint to call when dispatching a notification. - `secret?: string` Body param: 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 - `WebhookCreateResponse` - `id?: string` UUID ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const webhook = await client.alerting.destinations.webhooks.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'Slack Webhook', url: 'https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd', }); console.log(webhook.id); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Update a webhook `client.alerting.destinations.webhooks.update(stringwebhookId, WebhookUpdateParamsparams, RequestOptionsoptions?): WebhookUpdateResponse` **put** `/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}` Update a webhook destination. ### Parameters - `webhookId: string` The unique identifier of a webhook - `params: WebhookUpdateParams` - `account_id: string` Path param: The account id - `name: string` Body param: The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `url: string` Body param: The POST endpoint to call when dispatching a notification. - `secret?: string` Body param: 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 - `WebhookUpdateResponse` - `id?: string` UUID ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const webhook = await client.alerting.destinations.webhooks.update( 'b115d5ec15c641ee8b7692c449b5227b', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'Slack Webhook', url: 'https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd', }, ); console.log(webhook.id); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Delete a webhook `client.alerting.destinations.webhooks.delete(stringwebhookId, WebhookDeleteParamsparams, RequestOptionsoptions?): WebhookDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}` Delete a configured webhook destination. ### Parameters - `webhookId: string` The unique identifier of a webhook - `params: WebhookDeleteParams` - `account_id: string` The account id ### Returns - `WebhookDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const webhook = await client.alerting.destinations.webhooks.delete( 'b115d5ec15c641ee8b7692c449b5227b', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(webhook.errors); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Domain Types ### Webhooks - `Webhooks` - `id?: string` The unique identifier of a webhook - `created_at?: string` Timestamp of when the webhook destination was created. - `last_failure?: string` Timestamp of the last time an attempt to dispatch a notification to this webhook failed. - `last_success?: string` Timestamp of the last time Cloudflare was able to successfully dispatch a notification using this webhook. - `name?: string` The name of the webhook destination. This will be included in the request body when you receive a webhook notification. - `secret?: string` 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?: "datadog" | "discord" | "feishu" | 5 more` Type of webhook endpoint. - `"datadog"` - `"discord"` - `"feishu"` - `"gchat"` - `"generic"` - `"opsgenie"` - `"slack"` - `"splunk"` - `url?: string` The POST endpoint to call when dispatching a notification. ### Webhook Create Response - `WebhookCreateResponse` - `id?: string` UUID ### Webhook Update Response - `WebhookUpdateResponse` - `id?: string` UUID ### Webhook Delete Response - `WebhookDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` # History ## List History `client.alerting.history.list(HistoryListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **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 - `params: HistoryListParams` - `account_id: string` Path param: The account id - `before?: string` Query param: Limit the returned results to history records older than the specified date. This must be a timestamp that conforms to RFC3339. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of items per page. - `since?: string` Query param: Limit the returned results to history records newer than the specified date. This must be a timestamp that conforms to RFC3339. ### Returns - `History` - `id?: string` UUID - `alert_body?: string` Message body included in the notification sent. - `alert_type?: string` Type of notification that has been dispatched. - `description?: string` Description of the notification policy (if present). - `mechanism?: string` The mechanism to which the notification has been dispatched. - `mechanism_type?: "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?: string` Name of the policy. - `policy_id?: string` The unique identifier of a notification policy - `sent?: string` Timestamp of when the notification was dispatched in ISO 8601 format. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const history of client.alerting.history.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(history.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 - `History` - `id?: string` UUID - `alert_body?: string` Message body included in the notification sent. - `alert_type?: string` Type of notification that has been dispatched. - `description?: string` Description of the notification policy (if present). - `mechanism?: string` The mechanism to which the notification has been dispatched. - `mechanism_type?: "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?: string` Name of the policy. - `policy_id?: string` The unique identifier of a notification policy - `sent?: string` Timestamp of when the notification was dispatched in ISO 8601 format. # Policies ## List Notification policies `client.alerting.policies.list(PolicyListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/alerting/v3/policies` Get a list of all Notification policies. ### Parameters - `params: PolicyListParams` - `account_id: string` The account id ### Returns - `Policy` - `id?: string` The unique identifier of a notification policy - `alert_interval?: string` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type?: "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?: string` - `description?: string` Optional description for the Notification policy. - `enabled?: boolean` Whether or not the Notification policy is enabled. - `filters?: 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?: Array` Usage depends on specific alert type - `affected_asns?: Array` Used for configuring radar_notification - `affected_components?: Array` Used for configuring incident_alert - `affected_locations?: Array` Used for configuring radar_notification - `airport_code?: Array` Used for configuring maintenance_event_notification - `alert_trigger_preferences?: Array` Usage depends on specific alert type - `alert_trigger_preferences_value?: Array` Usage depends on specific alert type - `enabled?: Array` Used for configuring load_balancing_pool_enablement_alert - `environment?: Array` Used for configuring pages_event_alert - `event?: Array` Used for configuring pages_event_alert - `event_source?: Array` Used for configuring load_balancing_health_alert - `event_type?: Array` Usage depends on specific alert type - `group_by?: Array` Usage depends on specific alert type - `health_check_id?: Array` Used for configuring health_check_status_notification - `incident_impact?: Array<"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?: Array` Used for configuring stream_live_notifications - `insight_class?: Array` Used for configuring security_insights_alert - `limit?: Array` Used for configuring billing_usage_alert - `logo_tag?: Array` Used for configuring logo_match_alert - `megabits_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `new_health?: Array` Used for configuring load_balancing_health_alert - `new_status?: Array` Used for configuring tunnel_health_event - `packets_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `pool_id?: Array` Usage depends on specific alert type - `pop_names?: Array` Usage depends on specific alert type - `product?: Array` Used for configuring billing_usage_alert - `project_id?: Array` Used for configuring pages_event_alert - `protocol?: Array` Used for configuring advanced_ddos_attack_l4_alert - `query_tag?: Array` Usage depends on specific alert type - `requests_per_second?: Array` Used for configuring advanced_ddos_attack_l7_alert - `selectors?: Array` Usage depends on specific alert type - `services?: Array` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo?: Array` Usage depends on specific alert type - `status?: Array` Used for configuring health_check_status_notification - `target_hostname?: Array` Used for configuring advanced_ddos_attack_l7_alert - `target_ip?: Array` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name?: Array` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions?: Array<"security_events">` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id?: Array` Used for configuring tunnel_health_event - `tunnel_name?: Array` Usage depends on specific alert type - `type?: Array` Usage depends on specific alert type - `where?: Array` Usage depends on specific alert type - `zones?: Array` Usage depends on specific alert type - `mechanisms?: Mechanism` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email?: Array` - `id?: string` The email address - `pagerduty?: Array` - `id?: string` UUID - `webhooks?: Array` - `id?: string` UUID - `modified?: string` - `name?: string` Name of the policy. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const policy of client.alerting.policies.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(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" } ] } ``` ## Get a Notification policy `client.alerting.policies.get(stringpolicyId, PolicyGetParamsparams, RequestOptionsoptions?): Policy` **get** `/accounts/{account_id}/alerting/v3/policies/{policy_id}` Get details for a single policy. ### Parameters - `policyId: string` The unique identifier of a notification policy - `params: PolicyGetParams` - `account_id: string` The account id ### Returns - `Policy` - `id?: string` The unique identifier of a notification policy - `alert_interval?: string` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type?: "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?: string` - `description?: string` Optional description for the Notification policy. - `enabled?: boolean` Whether or not the Notification policy is enabled. - `filters?: 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?: Array` Usage depends on specific alert type - `affected_asns?: Array` Used for configuring radar_notification - `affected_components?: Array` Used for configuring incident_alert - `affected_locations?: Array` Used for configuring radar_notification - `airport_code?: Array` Used for configuring maintenance_event_notification - `alert_trigger_preferences?: Array` Usage depends on specific alert type - `alert_trigger_preferences_value?: Array` Usage depends on specific alert type - `enabled?: Array` Used for configuring load_balancing_pool_enablement_alert - `environment?: Array` Used for configuring pages_event_alert - `event?: Array` Used for configuring pages_event_alert - `event_source?: Array` Used for configuring load_balancing_health_alert - `event_type?: Array` Usage depends on specific alert type - `group_by?: Array` Usage depends on specific alert type - `health_check_id?: Array` Used for configuring health_check_status_notification - `incident_impact?: Array<"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?: Array` Used for configuring stream_live_notifications - `insight_class?: Array` Used for configuring security_insights_alert - `limit?: Array` Used for configuring billing_usage_alert - `logo_tag?: Array` Used for configuring logo_match_alert - `megabits_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `new_health?: Array` Used for configuring load_balancing_health_alert - `new_status?: Array` Used for configuring tunnel_health_event - `packets_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `pool_id?: Array` Usage depends on specific alert type - `pop_names?: Array` Usage depends on specific alert type - `product?: Array` Used for configuring billing_usage_alert - `project_id?: Array` Used for configuring pages_event_alert - `protocol?: Array` Used for configuring advanced_ddos_attack_l4_alert - `query_tag?: Array` Usage depends on specific alert type - `requests_per_second?: Array` Used for configuring advanced_ddos_attack_l7_alert - `selectors?: Array` Usage depends on specific alert type - `services?: Array` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo?: Array` Usage depends on specific alert type - `status?: Array` Used for configuring health_check_status_notification - `target_hostname?: Array` Used for configuring advanced_ddos_attack_l7_alert - `target_ip?: Array` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name?: Array` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions?: Array<"security_events">` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id?: Array` Used for configuring tunnel_health_event - `tunnel_name?: Array` Usage depends on specific alert type - `type?: Array` Usage depends on specific alert type - `where?: Array` Usage depends on specific alert type - `zones?: Array` Usage depends on specific alert type - `mechanisms?: Mechanism` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email?: Array` - `id?: string` The email address - `pagerduty?: Array` - `id?: string` UUID - `webhooks?: Array` - `id?: string` UUID - `modified?: string` - `name?: string` Name of the policy. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const policy = await client.alerting.policies.get('0da2b59ef118439d8097bdfb215203c9', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 `client.alerting.policies.create(PolicyCreateParamsparams, RequestOptionsoptions?): PolicyCreateResponse` **post** `/accounts/{account_id}/alerting/v3/policies` Creates a new Notification policy. ### Parameters - `params: PolicyCreateParams` - `account_id: string` Path param: The account id - `alert_type: "abuse_report_alert" | "access_custom_certificate_expiration_type" | "advanced_ddos_attack_l4_alert" | 66 more` Body param: 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: boolean` Body param: Whether or not the Notification policy is enabled. - `mechanisms: Mechanism` Body param: List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email?: Array` - `id?: string` The email address - `pagerduty?: Array` - `id?: string` UUID - `webhooks?: Array` - `id?: string` UUID - `name: string` Body param: Name of the policy. - `alert_interval?: string` Body param: Optional specification of how often to re-alert from the same incident, not support on all alert types. - `description?: string` Body param: Optional description for the Notification policy. - `filters?: PolicyFilter` Body param: 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?: Array` Usage depends on specific alert type - `affected_asns?: Array` Used for configuring radar_notification - `affected_components?: Array` Used for configuring incident_alert - `affected_locations?: Array` Used for configuring radar_notification - `airport_code?: Array` Used for configuring maintenance_event_notification - `alert_trigger_preferences?: Array` Usage depends on specific alert type - `alert_trigger_preferences_value?: Array` Usage depends on specific alert type - `enabled?: Array` Used for configuring load_balancing_pool_enablement_alert - `environment?: Array` Used for configuring pages_event_alert - `event?: Array` Used for configuring pages_event_alert - `event_source?: Array` Used for configuring load_balancing_health_alert - `event_type?: Array` Usage depends on specific alert type - `group_by?: Array` Usage depends on specific alert type - `health_check_id?: Array` Used for configuring health_check_status_notification - `incident_impact?: Array<"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?: Array` Used for configuring stream_live_notifications - `insight_class?: Array` Used for configuring security_insights_alert - `limit?: Array` Used for configuring billing_usage_alert - `logo_tag?: Array` Used for configuring logo_match_alert - `megabits_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `new_health?: Array` Used for configuring load_balancing_health_alert - `new_status?: Array` Used for configuring tunnel_health_event - `packets_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `pool_id?: Array` Usage depends on specific alert type - `pop_names?: Array` Usage depends on specific alert type - `product?: Array` Used for configuring billing_usage_alert - `project_id?: Array` Used for configuring pages_event_alert - `protocol?: Array` Used for configuring advanced_ddos_attack_l4_alert - `query_tag?: Array` Usage depends on specific alert type - `requests_per_second?: Array` Used for configuring advanced_ddos_attack_l7_alert - `selectors?: Array` Usage depends on specific alert type - `services?: Array` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo?: Array` Usage depends on specific alert type - `status?: Array` Used for configuring health_check_status_notification - `target_hostname?: Array` Used for configuring advanced_ddos_attack_l7_alert - `target_ip?: Array` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name?: Array` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions?: Array<"security_events">` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id?: Array` Used for configuring tunnel_health_event - `tunnel_name?: Array` Usage depends on specific alert type - `type?: Array` Usage depends on specific alert type - `where?: Array` Usage depends on specific alert type - `zones?: Array` Usage depends on specific alert type ### Returns - `PolicyCreateResponse` - `id?: string` UUID ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const policy = await client.alerting.policies.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', alert_type: 'universal_ssl_event_type', enabled: true, mechanisms: {}, name: 'SSL Notification Event Policy', }); console.log(policy.id); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Update a Notification policy `client.alerting.policies.update(stringpolicyId, PolicyUpdateParamsparams, RequestOptionsoptions?): PolicyUpdateResponse` **put** `/accounts/{account_id}/alerting/v3/policies/{policy_id}` Update a Notification policy. ### Parameters - `policyId: string` The unique identifier of a notification policy - `params: PolicyUpdateParams` - `account_id: string` Path param: The account id - `alert_interval?: string` Body param: Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type?: "abuse_report_alert" | "access_custom_certificate_expiration_type" | "advanced_ddos_attack_l4_alert" | 66 more` Body param: 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?: string` Body param: Optional description for the Notification policy. - `enabled?: boolean` Body param: Whether or not the Notification policy is enabled. - `filters?: PolicyFilter` Body param: 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?: Array` Usage depends on specific alert type - `affected_asns?: Array` Used for configuring radar_notification - `affected_components?: Array` Used for configuring incident_alert - `affected_locations?: Array` Used for configuring radar_notification - `airport_code?: Array` Used for configuring maintenance_event_notification - `alert_trigger_preferences?: Array` Usage depends on specific alert type - `alert_trigger_preferences_value?: Array` Usage depends on specific alert type - `enabled?: Array` Used for configuring load_balancing_pool_enablement_alert - `environment?: Array` Used for configuring pages_event_alert - `event?: Array` Used for configuring pages_event_alert - `event_source?: Array` Used for configuring load_balancing_health_alert - `event_type?: Array` Usage depends on specific alert type - `group_by?: Array` Usage depends on specific alert type - `health_check_id?: Array` Used for configuring health_check_status_notification - `incident_impact?: Array<"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?: Array` Used for configuring stream_live_notifications - `insight_class?: Array` Used for configuring security_insights_alert - `limit?: Array` Used for configuring billing_usage_alert - `logo_tag?: Array` Used for configuring logo_match_alert - `megabits_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `new_health?: Array` Used for configuring load_balancing_health_alert - `new_status?: Array` Used for configuring tunnel_health_event - `packets_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `pool_id?: Array` Usage depends on specific alert type - `pop_names?: Array` Usage depends on specific alert type - `product?: Array` Used for configuring billing_usage_alert - `project_id?: Array` Used for configuring pages_event_alert - `protocol?: Array` Used for configuring advanced_ddos_attack_l4_alert - `query_tag?: Array` Usage depends on specific alert type - `requests_per_second?: Array` Used for configuring advanced_ddos_attack_l7_alert - `selectors?: Array` Usage depends on specific alert type - `services?: Array` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo?: Array` Usage depends on specific alert type - `status?: Array` Used for configuring health_check_status_notification - `target_hostname?: Array` Used for configuring advanced_ddos_attack_l7_alert - `target_ip?: Array` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name?: Array` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions?: Array<"security_events">` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id?: Array` Used for configuring tunnel_health_event - `tunnel_name?: Array` Usage depends on specific alert type - `type?: Array` Usage depends on specific alert type - `where?: Array` Usage depends on specific alert type - `zones?: Array` Usage depends on specific alert type - `mechanisms?: Mechanism` Body param: List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email?: Array` - `id?: string` The email address - `pagerduty?: Array` - `id?: string` UUID - `webhooks?: Array` - `id?: string` UUID - `name?: string` Body param: Name of the policy. ### Returns - `PolicyUpdateResponse` - `id?: string` UUID ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const policy = await client.alerting.policies.update('0da2b59ef118439d8097bdfb215203c9', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(policy.id); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ``` ## Delete a Notification policy `client.alerting.policies.delete(stringpolicyId, PolicyDeleteParamsparams, RequestOptionsoptions?): PolicyDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/policies/{policy_id}` Delete a Notification policy. ### Parameters - `policyId: string` The unique identifier of a notification policy - `params: PolicyDeleteParams` - `account_id: string` The account id ### Returns - `PolicyDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` - `result_info?: ResultInfo` - `count?: number` Total number of results for the requested service - `page?: number` Current page within paginated list of results - `per_page?: number` Number of results per page of results - `total_count?: number` Total results available without any search parameters ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const policy = await client.alerting.policies.delete('0da2b59ef118439d8097bdfb215203c9', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 - `Mechanism` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email?: Array` - `id?: string` The email address - `pagerduty?: Array` - `id?: string` UUID - `webhooks?: Array` - `id?: string` UUID ### Policy - `Policy` - `id?: string` The unique identifier of a notification policy - `alert_interval?: string` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `alert_type?: "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?: string` - `description?: string` Optional description for the Notification policy. - `enabled?: boolean` Whether or not the Notification policy is enabled. - `filters?: 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?: Array` Usage depends on specific alert type - `affected_asns?: Array` Used for configuring radar_notification - `affected_components?: Array` Used for configuring incident_alert - `affected_locations?: Array` Used for configuring radar_notification - `airport_code?: Array` Used for configuring maintenance_event_notification - `alert_trigger_preferences?: Array` Usage depends on specific alert type - `alert_trigger_preferences_value?: Array` Usage depends on specific alert type - `enabled?: Array` Used for configuring load_balancing_pool_enablement_alert - `environment?: Array` Used for configuring pages_event_alert - `event?: Array` Used for configuring pages_event_alert - `event_source?: Array` Used for configuring load_balancing_health_alert - `event_type?: Array` Usage depends on specific alert type - `group_by?: Array` Usage depends on specific alert type - `health_check_id?: Array` Used for configuring health_check_status_notification - `incident_impact?: Array<"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?: Array` Used for configuring stream_live_notifications - `insight_class?: Array` Used for configuring security_insights_alert - `limit?: Array` Used for configuring billing_usage_alert - `logo_tag?: Array` Used for configuring logo_match_alert - `megabits_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `new_health?: Array` Used for configuring load_balancing_health_alert - `new_status?: Array` Used for configuring tunnel_health_event - `packets_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `pool_id?: Array` Usage depends on specific alert type - `pop_names?: Array` Usage depends on specific alert type - `product?: Array` Used for configuring billing_usage_alert - `project_id?: Array` Used for configuring pages_event_alert - `protocol?: Array` Used for configuring advanced_ddos_attack_l4_alert - `query_tag?: Array` Usage depends on specific alert type - `requests_per_second?: Array` Used for configuring advanced_ddos_attack_l7_alert - `selectors?: Array` Usage depends on specific alert type - `services?: Array` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo?: Array` Usage depends on specific alert type - `status?: Array` Used for configuring health_check_status_notification - `target_hostname?: Array` Used for configuring advanced_ddos_attack_l7_alert - `target_ip?: Array` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name?: Array` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions?: Array<"security_events">` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id?: Array` Used for configuring tunnel_health_event - `tunnel_name?: Array` Usage depends on specific alert type - `type?: Array` Usage depends on specific alert type - `where?: Array` Usage depends on specific alert type - `zones?: Array` Usage depends on specific alert type - `mechanisms?: Mechanism` List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `email?: Array` - `id?: string` The email address - `pagerduty?: Array` - `id?: string` UUID - `webhooks?: Array` - `id?: string` UUID - `modified?: string` - `name?: string` Name of the policy. ### Policy Filter - `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?: Array` Usage depends on specific alert type - `affected_asns?: Array` Used for configuring radar_notification - `affected_components?: Array` Used for configuring incident_alert - `affected_locations?: Array` Used for configuring radar_notification - `airport_code?: Array` Used for configuring maintenance_event_notification - `alert_trigger_preferences?: Array` Usage depends on specific alert type - `alert_trigger_preferences_value?: Array` Usage depends on specific alert type - `enabled?: Array` Used for configuring load_balancing_pool_enablement_alert - `environment?: Array` Used for configuring pages_event_alert - `event?: Array` Used for configuring pages_event_alert - `event_source?: Array` Used for configuring load_balancing_health_alert - `event_type?: Array` Usage depends on specific alert type - `group_by?: Array` Usage depends on specific alert type - `health_check_id?: Array` Used for configuring health_check_status_notification - `incident_impact?: Array<"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?: Array` Used for configuring stream_live_notifications - `insight_class?: Array` Used for configuring security_insights_alert - `limit?: Array` Used for configuring billing_usage_alert - `logo_tag?: Array` Used for configuring logo_match_alert - `megabits_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `new_health?: Array` Used for configuring load_balancing_health_alert - `new_status?: Array` Used for configuring tunnel_health_event - `packets_per_second?: Array` Used for configuring advanced_ddos_attack_l4_alert - `pool_id?: Array` Usage depends on specific alert type - `pop_names?: Array` Usage depends on specific alert type - `product?: Array` Used for configuring billing_usage_alert - `project_id?: Array` Used for configuring pages_event_alert - `protocol?: Array` Used for configuring advanced_ddos_attack_l4_alert - `query_tag?: Array` Usage depends on specific alert type - `requests_per_second?: Array` Used for configuring advanced_ddos_attack_l7_alert - `selectors?: Array` Usage depends on specific alert type - `services?: Array` Used for configuring clickhouse_alert_fw_ent_anomaly - `slo?: Array` Usage depends on specific alert type - `status?: Array` Used for configuring health_check_status_notification - `target_hostname?: Array` Used for configuring advanced_ddos_attack_l7_alert - `target_ip?: Array` Used for configuring advanced_ddos_attack_l4_alert - `target_zone_name?: Array` Used for configuring advanced_ddos_attack_l7_alert - `traffic_exclusions?: Array<"security_events">` Used for configuring traffic_anomalies_alert - `"security_events"` - `tunnel_id?: Array` Used for configuring tunnel_health_event - `tunnel_name?: Array` Usage depends on specific alert type - `type?: Array` Usage depends on specific alert type - `where?: Array` Usage depends on specific alert type - `zones?: Array` Usage depends on specific alert type ### Policy Create Response - `PolicyCreateResponse` - `id?: string` UUID ### Policy Update Response - `PolicyUpdateResponse` - `id?: string` UUID ### Policy Delete Response - `PolicyDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` - `result_info?: ResultInfo` - `count?: number` Total number of results for the requested service - `page?: number` Current page within paginated list of results - `per_page?: number` Number of results per page of results - `total_count?: number` Total results available without any search parameters # Silences ## List Silences `client.alerting.silences.list(SilenceListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/alerting/v3/silences` Gets a list of silences for an account. ### Parameters - `params: SilenceListParams` - `account_id: string` The account id ### Returns - `SilenceListResponse` - `id?: string` Silence ID - `created_at?: string` When the silence was created. - `end_time?: string` When the silence ends. - `policy_id?: string` The unique identifier of a notification policy - `start_time?: string` When the silence starts. - `updated_at?: string` When the silence was modified. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const silenceListResponse of client.alerting.silences.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(silenceListResponse.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 `client.alerting.silences.get(stringsilenceId, SilenceGetParamsparams, RequestOptionsoptions?): SilenceGetResponse` **get** `/accounts/{account_id}/alerting/v3/silences/{silence_id}` Gets a specific silence for an account. ### Parameters - `silenceId: string` Silence ID - `params: SilenceGetParams` - `account_id: string` The account id ### Returns - `SilenceGetResponse` - `id?: string` Silence ID - `created_at?: string` When the silence was created. - `end_time?: string` When the silence ends. - `policy_id?: string` The unique identifier of a notification policy - `start_time?: string` When the silence starts. - `updated_at?: string` When the silence was modified. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const silence = await client.alerting.silences.get('f878e90c23f44126ae3cfc399f646977', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 `client.alerting.silences.create(SilenceCreateParamsparams, RequestOptionsoptions?): SilenceCreateResponse` **post** `/accounts/{account_id}/alerting/v3/silences` Creates a new silence for an account. ### Parameters - `params: SilenceCreateParams` - `account_id: string` Path param: The account id - `body: Array` Body param - `end_time?: string` When the silence ends. - `policy_id?: string` The unique identifier of a notification policy - `start_time?: string` When the silence starts. ### Returns - `SilenceCreateResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const silence = await client.alerting.silences.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [{}], }); console.log(silence.errors); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Update Silences `client.alerting.silences.update(SilenceUpdateParamsparams, RequestOptionsoptions?): SinglePage` **put** `/accounts/{account_id}/alerting/v3/silences` Updates existing silences for an account. ### Parameters - `params: SilenceUpdateParams` - `account_id: string` Path param: The account id - `body: Array` Body param - `id?: string` Silence ID - `end_time?: string` When the silence ends. - `start_time?: string` When the silence starts. ### Returns - `SilenceUpdateResponse` - `id?: string` Silence ID - `created_at?: string` When the silence was created. - `end_time?: string` When the silence ends. - `policy_id?: string` The unique identifier of a notification policy - `start_time?: string` When the silence starts. - `updated_at?: string` When the silence was modified. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const silenceUpdateResponse of client.alerting.silences.update({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [{}], })) { console.log(silenceUpdateResponse.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 `client.alerting.silences.delete(stringsilenceId, SilenceDeleteParamsparams, RequestOptionsoptions?): SilenceDeleteResponse` **delete** `/accounts/{account_id}/alerting/v3/silences/{silence_id}` Deletes an existing silence for an account. ### Parameters - `silenceId: string` Silence ID - `params: SilenceDeleteParams` - `account_id: string` The account id ### Returns - `SilenceDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const silence = await client.alerting.silences.delete('f878e90c23f44126ae3cfc399f646977', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(silence.errors); ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true } ``` ## Domain Types ### Silence List Response - `SilenceListResponse` - `id?: string` Silence ID - `created_at?: string` When the silence was created. - `end_time?: string` When the silence ends. - `policy_id?: string` The unique identifier of a notification policy - `start_time?: string` When the silence starts. - `updated_at?: string` When the silence was modified. ### Silence Get Response - `SilenceGetResponse` - `id?: string` Silence ID - `created_at?: string` When the silence was created. - `end_time?: string` When the silence ends. - `policy_id?: string` The unique identifier of a notification policy - `start_time?: string` When the silence starts. - `updated_at?: string` When the silence was modified. ### Silence Create Response - `SilenceCreateResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true` ### Silence Update Response - `SilenceUpdateResponse` - `id?: string` Silence ID - `created_at?: string` When the silence was created. - `end_time?: string` When the silence ends. - `policy_id?: string` The unique identifier of a notification policy - `start_time?: string` When the silence starts. - `updated_at?: string` When the silence was modified. ### Silence Delete Response - `SilenceDeleteResponse` - `errors: Array` - `message: string` - `code?: number` - `messages: Array` - `message: string` - `code?: number` - `success: true` Whether the API call was successful - `true`