Skip to content
Start here

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.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Zero Trust: PII ReadNotifications WriteNotifications ReadAccount Settings WriteAccount Settings Read
ParametersExpand Collapse
policyID string

The unique identifier of a notification policy

maxLength32
query PolicyGetParams
AccountID param.Field[string]

The account id

maxLength32
ReturnsExpand Collapse
type Policy struct{…}
ID stringoptional

The unique identifier of a notification policy

maxLength32
AlertInterval stringoptional

Optional specification of how often to re-alert from the same incident, not support on all alert types.

AlertType PolicyAlertTypeoptional

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.

One of the following:
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 Timeoptional
formatdate-time
Description stringoptional

Optional description for the Notification policy.

Enabled booloptional

Whether or not the Notification policy is enabled.

Filters PolicyFilteroptional

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 []stringoptional

Usage depends on specific alert type

AffectedASNs []stringoptional

Used for configuring radar_notification

AffectedComponents []stringoptional

Used for configuring incident_alert

AffectedLocations []stringoptional

Used for configuring radar_notification

AirportCode []stringoptional

Used for configuring maintenance_event_notification

AlertTriggerPreferences []stringoptional

Usage depends on specific alert type

AlertTriggerPreferencesValue []stringoptional

Usage depends on specific alert type

Enabled []stringoptional

Used for configuring load_balancing_pool_enablement_alert

Environment []stringoptional

Used for configuring pages_event_alert

Event []stringoptional

Used for configuring pages_event_alert

EventSource []stringoptional

Used for configuring load_balancing_health_alert

EventType []stringoptional

Usage depends on specific alert type

GroupBy []stringoptional

Usage depends on specific alert type

HealthCheckID []stringoptional

Used for configuring health_check_status_notification

IncidentImpact []PolicyFilterIncidentImpactoptional

Used for configuring incident_alert

One of the following:
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 []stringoptional

Used for configuring stream_live_notifications

InsightClass []stringoptional

Used for configuring security_insights_alert

Limit []stringoptional

Used for configuring billing_usage_alert

LogoTag []stringoptional

Used for configuring logo_match_alert

MegabitsPerSecond []stringoptional

Used for configuring advanced_ddos_attack_l4_alert

NewHealth []stringoptional

Used for configuring load_balancing_health_alert

NewStatus []stringoptional

Used for configuring tunnel_health_event

PacketsPerSecond []stringoptional

Used for configuring advanced_ddos_attack_l4_alert

PoolID []stringoptional

Usage depends on specific alert type

POPNames []stringoptional

Usage depends on specific alert type

Product []stringoptional

Used for configuring billing_usage_alert

ProjectID []stringoptional

Used for configuring pages_event_alert

Protocol []stringoptional

Used for configuring advanced_ddos_attack_l4_alert

QueryTag []stringoptional

Usage depends on specific alert type

RequestsPerSecond []stringoptional

Used for configuring advanced_ddos_attack_l7_alert

Selectors []stringoptional

Usage depends on specific alert type

Services []stringoptional

Used for configuring clickhouse_alert_fw_ent_anomaly

Slo []stringoptional

Usage depends on specific alert type

Status []stringoptional

Used for configuring health_check_status_notification

TargetHostname []stringoptional

Used for configuring advanced_ddos_attack_l7_alert

TargetIP []stringoptional

Used for configuring advanced_ddos_attack_l4_alert

TargetZoneName []stringoptional

Used for configuring advanced_ddos_attack_l7_alert

TrafficExclusions []PolicyFilterTrafficExclusionoptional

Used for configuring traffic_anomalies_alert

TunnelID []stringoptional

Used for configuring tunnel_health_event

TunnelName []stringoptional

Usage depends on specific alert type

Type []stringoptional

Usage depends on specific alert type

Where []stringoptional

Usage depends on specific alert type

Zones []stringoptional

Usage depends on specific alert type

Mechanisms Mechanismoptional

List of IDs that will be used when dispatching a notification. IDs for email type will be the email address.

Email []MechanismEmailoptional
ID stringoptional

The email address

Pagerduty []MechanismPagerdutyoptional
ID stringoptional

UUID

maxLength32
Webhooks []MechanismWebhookoptional
ID stringoptional

UUID

maxLength32
Modified Timeoptional
formatdate-time
Name stringoptional

Name of the policy.

Get a Notification policy

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)
}
{
  "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"
  }
}
Returns Examples
{
  "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"
  }
}