## Get a Notification policy `client.Alerting.Policies.Get(ctx, policyID, query) (*Policy, error)` **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 - `query PolicyGetParams` - `AccountID param.Field[string]` The account id ### Returns - `type Policy struct{…}` - `ID string` The unique identifier of a notification policy - `AlertInterval string` Optional specification of how often to re-alert from the same incident, not support on all alert types. - `AlertType PolicyAlertType` 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 PolicyAlertTypeAbuseReportAlert PolicyAlertType = "abuse_report_alert"` - `const PolicyAlertTypeAccessCustomCertificateExpirationType PolicyAlertType = "access_custom_certificate_expiration_type"` - `const PolicyAlertTypeAdvancedDDoSAttackL4Alert PolicyAlertType = "advanced_ddos_attack_l4_alert"` - `const PolicyAlertTypeAdvancedDDoSAttackL7Alert PolicyAlertType = "advanced_ddos_attack_l7_alert"` - `const PolicyAlertTypeAdvancedHTTPAlertError PolicyAlertType = "advanced_http_alert_error"` - `const PolicyAlertTypeBGPHijackNotification PolicyAlertType = "bgp_hijack_notification"` - `const PolicyAlertTypeBillingUsageAlert PolicyAlertType = "billing_usage_alert"` - `const PolicyAlertTypeBlockNotificationBlockRemoved PolicyAlertType = "block_notification_block_removed"` - `const PolicyAlertTypeBlockNotificationNewBlock PolicyAlertType = "block_notification_new_block"` - `const PolicyAlertTypeBlockNotificationReviewRejected PolicyAlertType = "block_notification_review_rejected"` - `const PolicyAlertTypeBotTrafficBasicAlert PolicyAlertType = "bot_traffic_basic_alert"` - `const PolicyAlertTypeBrandProtectionAlert PolicyAlertType = "brand_protection_alert"` - `const PolicyAlertTypeBrandProtectionDigest PolicyAlertType = "brand_protection_digest"` - `const PolicyAlertTypeClickhouseAlertFwAnomaly PolicyAlertType = "clickhouse_alert_fw_anomaly"` - `const PolicyAlertTypeClickhouseAlertFwEntAnomaly PolicyAlertType = "clickhouse_alert_fw_ent_anomaly"` - `const PolicyAlertTypeCloudforceOneRequestNotification PolicyAlertType = "cloudforce_one_request_notification"` - `const PolicyAlertTypeCNIMaintenanceNotification PolicyAlertType = "cni_maintenance_notification"` - `const PolicyAlertTypeCustomAnalytics PolicyAlertType = "custom_analytics"` - `const PolicyAlertTypeCustomBotDetectionAlert PolicyAlertType = "custom_bot_detection_alert"` - `const PolicyAlertTypeCustomSSLCertificateEventType PolicyAlertType = "custom_ssl_certificate_event_type"` - `const PolicyAlertTypeDedicatedSSLCertificateEventType PolicyAlertType = "dedicated_ssl_certificate_event_type"` - `const PolicyAlertTypeDeviceConnectivityAnomalyAlert PolicyAlertType = "device_connectivity_anomaly_alert"` - `const PolicyAlertTypeDosAttackL4 PolicyAlertType = "dos_attack_l4"` - `const PolicyAlertTypeDosAttackL7 PolicyAlertType = "dos_attack_l7"` - `const PolicyAlertTypeExpiringServiceTokenAlert PolicyAlertType = "expiring_service_token_alert"` - `const PolicyAlertTypeFailingLogpushJobDisabledAlert PolicyAlertType = "failing_logpush_job_disabled_alert"` - `const PolicyAlertTypeFbmAutoAdvertisement PolicyAlertType = "fbm_auto_advertisement"` - `const PolicyAlertTypeFbmDosdAttack PolicyAlertType = "fbm_dosd_attack"` - `const PolicyAlertTypeFbmVolumetricAttack PolicyAlertType = "fbm_volumetric_attack"` - `const PolicyAlertTypeHealthCheckStatusNotification PolicyAlertType = "health_check_status_notification"` - `const PolicyAlertTypeHostnameAopCustomCertificateExpirationType PolicyAlertType = "hostname_aop_custom_certificate_expiration_type"` - `const PolicyAlertTypeHTTPAlertEdgeError PolicyAlertType = "http_alert_edge_error"` - `const PolicyAlertTypeHTTPAlertOriginError PolicyAlertType = "http_alert_origin_error"` - `const PolicyAlertTypeImageNotification PolicyAlertType = "image_notification"` - `const PolicyAlertTypeImageResizingNotification PolicyAlertType = "image_resizing_notification"` - `const PolicyAlertTypeIncidentAlert PolicyAlertType = "incident_alert"` - `const PolicyAlertTypeLoadBalancingHealthAlert PolicyAlertType = "load_balancing_health_alert"` - `const PolicyAlertTypeLoadBalancingPoolEnablementAlert PolicyAlertType = "load_balancing_pool_enablement_alert"` - `const PolicyAlertTypeLogoMatchAlert PolicyAlertType = "logo_match_alert"` - `const PolicyAlertTypeMagicTunnelHealthCheckEvent PolicyAlertType = "magic_tunnel_health_check_event"` - `const PolicyAlertTypeMagicWANTunnelHealth PolicyAlertType = "magic_wan_tunnel_health"` - `const PolicyAlertTypeMaintenanceEventNotification PolicyAlertType = "maintenance_event_notification"` - `const PolicyAlertTypeMTLSCertificateStoreCertificateExpirationType PolicyAlertType = "mtls_certificate_store_certificate_expiration_type"` - `const PolicyAlertTypePagesEventAlert PolicyAlertType = "pages_event_alert"` - `const PolicyAlertTypeRadarNotification PolicyAlertType = "radar_notification"` - `const PolicyAlertTypeRealOriginMonitoring PolicyAlertType = "real_origin_monitoring"` - `const PolicyAlertTypeScriptmonitorAlertNewCodeChangeDetections PolicyAlertType = "scriptmonitor_alert_new_code_change_detections"` - `const PolicyAlertTypeScriptmonitorAlertNewHosts PolicyAlertType = "scriptmonitor_alert_new_hosts"` - `const PolicyAlertTypeScriptmonitorAlertNewMaliciousHosts PolicyAlertType = "scriptmonitor_alert_new_malicious_hosts"` - `const PolicyAlertTypeScriptmonitorAlertNewMaliciousScripts PolicyAlertType = "scriptmonitor_alert_new_malicious_scripts"` - `const PolicyAlertTypeScriptmonitorAlertNewMaliciousURL PolicyAlertType = "scriptmonitor_alert_new_malicious_url"` - `const PolicyAlertTypeScriptmonitorAlertNewMaxLengthResourceURL PolicyAlertType = "scriptmonitor_alert_new_max_length_resource_url"` - `const PolicyAlertTypeScriptmonitorAlertNewResources PolicyAlertType = "scriptmonitor_alert_new_resources"` - `const PolicyAlertTypeSecondaryDNSAllPrimariesFailing PolicyAlertType = "secondary_dns_all_primaries_failing"` - `const PolicyAlertTypeSecondaryDNSPrimariesFailing PolicyAlertType = "secondary_dns_primaries_failing"` - `const PolicyAlertTypeSecondaryDNSWarning PolicyAlertType = "secondary_dns_warning"` - `const PolicyAlertTypeSecondaryDNSZoneSuccessfullyUpdated PolicyAlertType = "secondary_dns_zone_successfully_updated"` - `const PolicyAlertTypeSecondaryDNSZoneValidationWarning PolicyAlertType = "secondary_dns_zone_validation_warning"` - `const PolicyAlertTypeSecurityInsightsAlert PolicyAlertType = "security_insights_alert"` - `const PolicyAlertTypeSentinelAlert PolicyAlertType = "sentinel_alert"` - `const PolicyAlertTypeStreamLiveNotifications PolicyAlertType = "stream_live_notifications"` - `const PolicyAlertTypeSyntheticTestLatencyAlert PolicyAlertType = "synthetic_test_latency_alert"` - `const PolicyAlertTypeSyntheticTestLowAvailabilityAlert PolicyAlertType = "synthetic_test_low_availability_alert"` - `const PolicyAlertTypeTrafficAnomaliesAlert PolicyAlertType = "traffic_anomalies_alert"` - `const PolicyAlertTypeTunnelHealthEvent PolicyAlertType = "tunnel_health_event"` - `const PolicyAlertTypeTunnelUpdateEvent PolicyAlertType = "tunnel_update_event"` - `const PolicyAlertTypeUniversalSSLEventType PolicyAlertType = "universal_ssl_event_type"` - `const PolicyAlertTypeWebAnalyticsMetricsUpdate PolicyAlertType = "web_analytics_metrics_update"` - `const PolicyAlertTypeZoneAopCustomCertificateExpirationType PolicyAlertType = "zone_aop_custom_certificate_expiration_type"` - `Created Time` - `Description string` Optional description for the Notification policy. - `Enabled bool` 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 []string` Usage depends on specific alert type - `AffectedASNs []string` Used for configuring radar_notification - `AffectedComponents []string` Used for configuring incident_alert - `AffectedLocations []string` Used for configuring radar_notification - `AirportCode []string` Used for configuring maintenance_event_notification - `AlertTriggerPreferences []string` Usage depends on specific alert type - `AlertTriggerPreferencesValue []string` Usage depends on specific alert type - `Enabled []string` Used for configuring load_balancing_pool_enablement_alert - `Environment []string` Used for configuring pages_event_alert - `Event []string` Used for configuring pages_event_alert - `EventSource []string` Used for configuring load_balancing_health_alert - `EventType []string` Usage depends on specific alert type - `GroupBy []string` Usage depends on specific alert type - `HealthCheckID []string` Used for configuring health_check_status_notification - `IncidentImpact []PolicyFilterIncidentImpact` Used for configuring incident_alert - `const PolicyFilterIncidentImpactIncidentImpactNone PolicyFilterIncidentImpact = "INCIDENT_IMPACT_NONE"` - `const PolicyFilterIncidentImpactIncidentImpactMinor PolicyFilterIncidentImpact = "INCIDENT_IMPACT_MINOR"` - `const PolicyFilterIncidentImpactIncidentImpactMajor PolicyFilterIncidentImpact = "INCIDENT_IMPACT_MAJOR"` - `const PolicyFilterIncidentImpactIncidentImpactCritical PolicyFilterIncidentImpact = "INCIDENT_IMPACT_CRITICAL"` - `InputID []string` Used for configuring stream_live_notifications - `InsightClass []string` Used for configuring security_insights_alert - `Limit []string` Used for configuring billing_usage_alert - `LogoTag []string` Used for configuring logo_match_alert - `MegabitsPerSecond []string` Used for configuring advanced_ddos_attack_l4_alert - `NewHealth []string` Used for configuring load_balancing_health_alert - `NewStatus []string` Used for configuring tunnel_health_event - `PacketsPerSecond []string` Used for configuring advanced_ddos_attack_l4_alert - `PoolID []string` Usage depends on specific alert type - `POPNames []string` Usage depends on specific alert type - `Product []string` Used for configuring billing_usage_alert - `ProjectID []string` Used for configuring pages_event_alert - `Protocol []string` Used for configuring advanced_ddos_attack_l4_alert - `QueryTag []string` Usage depends on specific alert type - `RequestsPerSecond []string` Used for configuring advanced_ddos_attack_l7_alert - `Selectors []string` Usage depends on specific alert type - `Services []string` Used for configuring clickhouse_alert_fw_ent_anomaly - `Slo []string` Usage depends on specific alert type - `Status []string` Used for configuring health_check_status_notification - `TargetHostname []string` Used for configuring advanced_ddos_attack_l7_alert - `TargetIP []string` Used for configuring advanced_ddos_attack_l4_alert - `TargetZoneName []string` Used for configuring advanced_ddos_attack_l7_alert - `TrafficExclusions []PolicyFilterTrafficExclusion` Used for configuring traffic_anomalies_alert - `const PolicyFilterTrafficExclusionSecurityEvents PolicyFilterTrafficExclusion = "security_events"` - `TunnelID []string` Used for configuring tunnel_health_event - `TunnelName []string` Usage depends on specific alert type - `Type []string` Usage depends on specific alert type - `Where []string` Usage depends on specific alert type - `Zones []string` 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 []MechanismEmail` - `ID string` The email address - `Pagerduty []MechanismPagerduty` - `ID string` UUID - `Webhooks []MechanismWebhook` - `ID string` UUID - `Modified Time` - `Name string` Name of the policy. ### 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.Get( context.TODO(), "0da2b59ef118439d8097bdfb215203c9", alerting.PolicyGetParams{ 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": "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" } } ```