## Update a Notification policy `client.Alerting.Policies.Update(ctx, policyID, params) (*PolicyUpdateResponse, error)` **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` - `AccountID param.Field[string]` Path param: The account id - `AlertInterval param.Field[string]` Body param: Optional specification of how often to re-alert from the same incident, not support on all alert types. - `AlertType param.Field[PolicyUpdateParamsAlertType]` 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. - `const PolicyUpdateParamsAlertTypeAbuseReportAlert PolicyUpdateParamsAlertType = "abuse_report_alert"` - `const PolicyUpdateParamsAlertTypeAccessCustomCertificateExpirationType PolicyUpdateParamsAlertType = "access_custom_certificate_expiration_type"` - `const PolicyUpdateParamsAlertTypeAdvancedDDoSAttackL4Alert PolicyUpdateParamsAlertType = "advanced_ddos_attack_l4_alert"` - `const PolicyUpdateParamsAlertTypeAdvancedDDoSAttackL7Alert PolicyUpdateParamsAlertType = "advanced_ddos_attack_l7_alert"` - `const PolicyUpdateParamsAlertTypeAdvancedHTTPAlertError PolicyUpdateParamsAlertType = "advanced_http_alert_error"` - `const PolicyUpdateParamsAlertTypeBGPHijackNotification PolicyUpdateParamsAlertType = "bgp_hijack_notification"` - `const PolicyUpdateParamsAlertTypeBillingUsageAlert PolicyUpdateParamsAlertType = "billing_usage_alert"` - `const PolicyUpdateParamsAlertTypeBlockNotificationBlockRemoved PolicyUpdateParamsAlertType = "block_notification_block_removed"` - `const PolicyUpdateParamsAlertTypeBlockNotificationNewBlock PolicyUpdateParamsAlertType = "block_notification_new_block"` - `const PolicyUpdateParamsAlertTypeBlockNotificationReviewRejected PolicyUpdateParamsAlertType = "block_notification_review_rejected"` - `const PolicyUpdateParamsAlertTypeBotTrafficBasicAlert PolicyUpdateParamsAlertType = "bot_traffic_basic_alert"` - `const PolicyUpdateParamsAlertTypeBrandProtectionAlert PolicyUpdateParamsAlertType = "brand_protection_alert"` - `const PolicyUpdateParamsAlertTypeBrandProtectionDigest PolicyUpdateParamsAlertType = "brand_protection_digest"` - `const PolicyUpdateParamsAlertTypeClickhouseAlertFwAnomaly PolicyUpdateParamsAlertType = "clickhouse_alert_fw_anomaly"` - `const PolicyUpdateParamsAlertTypeClickhouseAlertFwEntAnomaly PolicyUpdateParamsAlertType = "clickhouse_alert_fw_ent_anomaly"` - `const PolicyUpdateParamsAlertTypeCloudforceOneRequestNotification PolicyUpdateParamsAlertType = "cloudforce_one_request_notification"` - `const PolicyUpdateParamsAlertTypeCNIMaintenanceNotification PolicyUpdateParamsAlertType = "cni_maintenance_notification"` - `const PolicyUpdateParamsAlertTypeCustomAnalytics PolicyUpdateParamsAlertType = "custom_analytics"` - `const PolicyUpdateParamsAlertTypeCustomBotDetectionAlert PolicyUpdateParamsAlertType = "custom_bot_detection_alert"` - `const PolicyUpdateParamsAlertTypeCustomSSLCertificateEventType PolicyUpdateParamsAlertType = "custom_ssl_certificate_event_type"` - `const PolicyUpdateParamsAlertTypeDedicatedSSLCertificateEventType PolicyUpdateParamsAlertType = "dedicated_ssl_certificate_event_type"` - `const PolicyUpdateParamsAlertTypeDeviceConnectivityAnomalyAlert PolicyUpdateParamsAlertType = "device_connectivity_anomaly_alert"` - `const PolicyUpdateParamsAlertTypeDosAttackL4 PolicyUpdateParamsAlertType = "dos_attack_l4"` - `const PolicyUpdateParamsAlertTypeDosAttackL7 PolicyUpdateParamsAlertType = "dos_attack_l7"` - `const PolicyUpdateParamsAlertTypeExpiringServiceTokenAlert PolicyUpdateParamsAlertType = "expiring_service_token_alert"` - `const PolicyUpdateParamsAlertTypeFailingLogpushJobDisabledAlert PolicyUpdateParamsAlertType = "failing_logpush_job_disabled_alert"` - `const PolicyUpdateParamsAlertTypeFbmAutoAdvertisement PolicyUpdateParamsAlertType = "fbm_auto_advertisement"` - `const PolicyUpdateParamsAlertTypeFbmDosdAttack PolicyUpdateParamsAlertType = "fbm_dosd_attack"` - `const PolicyUpdateParamsAlertTypeFbmVolumetricAttack PolicyUpdateParamsAlertType = "fbm_volumetric_attack"` - `const PolicyUpdateParamsAlertTypeHealthCheckStatusNotification PolicyUpdateParamsAlertType = "health_check_status_notification"` - `const PolicyUpdateParamsAlertTypeHostnameAopCustomCertificateExpirationType PolicyUpdateParamsAlertType = "hostname_aop_custom_certificate_expiration_type"` - `const PolicyUpdateParamsAlertTypeHTTPAlertEdgeError PolicyUpdateParamsAlertType = "http_alert_edge_error"` - `const PolicyUpdateParamsAlertTypeHTTPAlertOriginError PolicyUpdateParamsAlertType = "http_alert_origin_error"` - `const PolicyUpdateParamsAlertTypeImageNotification PolicyUpdateParamsAlertType = "image_notification"` - `const PolicyUpdateParamsAlertTypeImageResizingNotification PolicyUpdateParamsAlertType = "image_resizing_notification"` - `const PolicyUpdateParamsAlertTypeIncidentAlert PolicyUpdateParamsAlertType = "incident_alert"` - `const PolicyUpdateParamsAlertTypeLoadBalancingHealthAlert PolicyUpdateParamsAlertType = "load_balancing_health_alert"` - `const PolicyUpdateParamsAlertTypeLoadBalancingPoolEnablementAlert PolicyUpdateParamsAlertType = "load_balancing_pool_enablement_alert"` - `const PolicyUpdateParamsAlertTypeLogoMatchAlert PolicyUpdateParamsAlertType = "logo_match_alert"` - `const PolicyUpdateParamsAlertTypeMagicTunnelHealthCheckEvent PolicyUpdateParamsAlertType = "magic_tunnel_health_check_event"` - `const PolicyUpdateParamsAlertTypeMagicWANTunnelHealth PolicyUpdateParamsAlertType = "magic_wan_tunnel_health"` - `const PolicyUpdateParamsAlertTypeMaintenanceEventNotification PolicyUpdateParamsAlertType = "maintenance_event_notification"` - `const PolicyUpdateParamsAlertTypeMTLSCertificateStoreCertificateExpirationType PolicyUpdateParamsAlertType = "mtls_certificate_store_certificate_expiration_type"` - `const PolicyUpdateParamsAlertTypePagesEventAlert PolicyUpdateParamsAlertType = "pages_event_alert"` - `const PolicyUpdateParamsAlertTypeRadarNotification PolicyUpdateParamsAlertType = "radar_notification"` - `const PolicyUpdateParamsAlertTypeRealOriginMonitoring PolicyUpdateParamsAlertType = "real_origin_monitoring"` - `const PolicyUpdateParamsAlertTypeScriptmonitorAlertNewCodeChangeDetections PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_code_change_detections"` - `const PolicyUpdateParamsAlertTypeScriptmonitorAlertNewHosts PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_hosts"` - `const PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaliciousHosts PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_malicious_hosts"` - `const PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaliciousScripts PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_malicious_scripts"` - `const PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaliciousURL PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_malicious_url"` - `const PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaxLengthResourceURL PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_max_length_resource_url"` - `const PolicyUpdateParamsAlertTypeScriptmonitorAlertNewResources PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_resources"` - `const PolicyUpdateParamsAlertTypeSecondaryDNSAllPrimariesFailing PolicyUpdateParamsAlertType = "secondary_dns_all_primaries_failing"` - `const PolicyUpdateParamsAlertTypeSecondaryDNSPrimariesFailing PolicyUpdateParamsAlertType = "secondary_dns_primaries_failing"` - `const PolicyUpdateParamsAlertTypeSecondaryDNSWarning PolicyUpdateParamsAlertType = "secondary_dns_warning"` - `const PolicyUpdateParamsAlertTypeSecondaryDNSZoneSuccessfullyUpdated PolicyUpdateParamsAlertType = "secondary_dns_zone_successfully_updated"` - `const PolicyUpdateParamsAlertTypeSecondaryDNSZoneValidationWarning PolicyUpdateParamsAlertType = "secondary_dns_zone_validation_warning"` - `const PolicyUpdateParamsAlertTypeSecurityInsightsAlert PolicyUpdateParamsAlertType = "security_insights_alert"` - `const PolicyUpdateParamsAlertTypeSentinelAlert PolicyUpdateParamsAlertType = "sentinel_alert"` - `const PolicyUpdateParamsAlertTypeStreamLiveNotifications PolicyUpdateParamsAlertType = "stream_live_notifications"` - `const PolicyUpdateParamsAlertTypeSyntheticTestLatencyAlert PolicyUpdateParamsAlertType = "synthetic_test_latency_alert"` - `const PolicyUpdateParamsAlertTypeSyntheticTestLowAvailabilityAlert PolicyUpdateParamsAlertType = "synthetic_test_low_availability_alert"` - `const PolicyUpdateParamsAlertTypeTrafficAnomaliesAlert PolicyUpdateParamsAlertType = "traffic_anomalies_alert"` - `const PolicyUpdateParamsAlertTypeTunnelHealthEvent PolicyUpdateParamsAlertType = "tunnel_health_event"` - `const PolicyUpdateParamsAlertTypeTunnelUpdateEvent PolicyUpdateParamsAlertType = "tunnel_update_event"` - `const PolicyUpdateParamsAlertTypeUniversalSSLEventType PolicyUpdateParamsAlertType = "universal_ssl_event_type"` - `const PolicyUpdateParamsAlertTypeWebAnalyticsMetricsUpdate PolicyUpdateParamsAlertType = "web_analytics_metrics_update"` - `const PolicyUpdateParamsAlertTypeZoneAopCustomCertificateExpirationType PolicyUpdateParamsAlertType = "zone_aop_custom_certificate_expiration_type"` - `Description param.Field[string]` Body param: Optional description for the Notification policy. - `Enabled param.Field[bool]` Body param: Whether or not the Notification policy is enabled. - `Filters param.Field[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. - `Mechanisms param.Field[Mechanism]` Body param: List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. - `Name param.Field[string]` Body param: Name of the policy. ### Returns - `type PolicyUpdateResponse struct{…}` - `ID string` UUID ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/alerting" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) policy, err := client.Alerting.Policies.Update( context.TODO(), "0da2b59ef118439d8097bdfb215203c9", alerting.PolicyUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", policy.ID) } ``` #### Response ```json { "errors": [ { "message": "message", "code": 1000 } ], "messages": [ { "message": "message", "code": 1000 } ], "success": true, "result": { "id": "f174e90afafe4643bbbc4a0ed4fc8415" } } ```