# Rules ## List rules `client.magicNetworkMonitoring.rules.list(RuleListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/mnm/rules` Lists network monitoring rules for account. ### Parameters - `params: RuleListParams` - `account_id: string` ### Returns - `MagicNetworkMonitoringRule | null` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `name: string` The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `prefixes: Array` - `type: "threshold" | "zscore" | "advanced_ddos"` MNM rule type. - `"threshold"` - `"zscore"` - `"advanced_ddos"` - `id?: string` The id of the rule. Must be unique. - `bandwidth_threshold?: number` The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `packet_threshold?: number` The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefix_match?: "exact" | "subnet" | "supernet" | null` Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule. - `"exact"` - `"subnet"` - `"supernet"` - `zscore_sensitivity?: "low" | "medium" | "high" | null` Level of sensitivity set for zscore rules. - `"low"` - `"medium"` - `"high"` - `zscore_target?: "bits" | "packets" | null` Target of the zscore rule analysis. - `"bits"` - `"packets"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const magicNetworkMonitoringRule of client.magicNetworkMonitoring.rules.list({ account_id: '6f91088a406011ed95aed352566e8d4c', })) { console.log(magicNetworkMonitoringRule.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "automatic_advertisement": true, "name": "my_rule_1", "prefixes": [ "203.0.113.1/32" ], "type": "zscore", "id": "2890e6fa406311ed9b5a23f70f6fb8cf", "bandwidth_threshold": 1000, "duration": "1m", "packet_threshold": 10000, "prefix_match": "exact", "zscore_sensitivity": "high", "zscore_target": "bits" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get rule `client.magicNetworkMonitoring.rules.get(stringruleId, RuleGetParamsparams, RequestOptionsoptions?): MagicNetworkMonitoringRule | null` **get** `/accounts/{account_id}/mnm/rules/{rule_id}` List a single network monitoring rule for account. ### Parameters - `ruleId: string` The id of the rule. Must be unique. - `params: RuleGetParams` - `account_id: string` ### Returns - `MagicNetworkMonitoringRule | null` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `name: string` The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `prefixes: Array` - `type: "threshold" | "zscore" | "advanced_ddos"` MNM rule type. - `"threshold"` - `"zscore"` - `"advanced_ddos"` - `id?: string` The id of the rule. Must be unique. - `bandwidth_threshold?: number` The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `packet_threshold?: number` The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefix_match?: "exact" | "subnet" | "supernet" | null` Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule. - `"exact"` - `"subnet"` - `"supernet"` - `zscore_sensitivity?: "low" | "medium" | "high" | null` Level of sensitivity set for zscore rules. - `"low"` - `"medium"` - `"high"` - `zscore_target?: "bits" | "packets" | null` Target of the zscore rule analysis. - `"bits"` - `"packets"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const magicNetworkMonitoringRule = await client.magicNetworkMonitoring.rules.get( '2890e6fa406311ed9b5a23f70f6fb8cf', { account_id: '6f91088a406011ed95aed352566e8d4c' }, ); console.log(magicNetworkMonitoringRule.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "automatic_advertisement": true, "name": "my_rule_1", "prefixes": [ "203.0.113.1/32" ], "type": "zscore", "id": "2890e6fa406311ed9b5a23f70f6fb8cf", "bandwidth_threshold": 1000, "duration": "1m", "packet_threshold": 10000, "prefix_match": "exact", "zscore_sensitivity": "high", "zscore_target": "bits" }, "success": true } ``` ## Create rules `client.magicNetworkMonitoring.rules.create(RuleCreateParamsparams, RequestOptionsoptions?): MagicNetworkMonitoringRule | null` **post** `/accounts/{account_id}/mnm/rules` Create network monitoring rules for account. Currently only supports creating a single rule per API request. ### Parameters - `params: RuleCreateParams` - `account_id: string` Path param - `duration: "1m" | "5m" | "10m" | 5 more` Body param: The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `name: string` Body param: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `automatic_advertisement?: boolean | null` Body param: Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `bandwidth?: number` Body param: The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `packet_threshold?: number` Body param: The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefixes?: Array` Body param ### Returns - `MagicNetworkMonitoringRule | null` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `name: string` The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `prefixes: Array` - `type: "threshold" | "zscore" | "advanced_ddos"` MNM rule type. - `"threshold"` - `"zscore"` - `"advanced_ddos"` - `id?: string` The id of the rule. Must be unique. - `bandwidth_threshold?: number` The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `packet_threshold?: number` The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefix_match?: "exact" | "subnet" | "supernet" | null` Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule. - `"exact"` - `"subnet"` - `"supernet"` - `zscore_sensitivity?: "low" | "medium" | "high" | null` Level of sensitivity set for zscore rules. - `"low"` - `"medium"` - `"high"` - `zscore_target?: "bits" | "packets" | null` Target of the zscore rule analysis. - `"bits"` - `"packets"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const magicNetworkMonitoringRule = await client.magicNetworkMonitoring.rules.create({ account_id: '6f91088a406011ed95aed352566e8d4c', duration: '1m', name: 'my_rule_1', }); console.log(magicNetworkMonitoringRule.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "automatic_advertisement": true, "name": "my_rule_1", "prefixes": [ "203.0.113.1/32" ], "type": "zscore", "id": "2890e6fa406311ed9b5a23f70f6fb8cf", "bandwidth_threshold": 1000, "duration": "1m", "packet_threshold": 10000, "prefix_match": "exact", "zscore_sensitivity": "high", "zscore_target": "bits" }, "success": true } ``` ## Update rules `client.magicNetworkMonitoring.rules.update(RuleUpdateParamsparams, RequestOptionsoptions?): MagicNetworkMonitoringRule | null` **put** `/accounts/{account_id}/mnm/rules` Update network monitoring rules for account. ### Parameters - `params: RuleUpdateParams` - `account_id: string` Path param - `duration: "1m" | "5m" | "10m" | 5 more` Body param: The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `name: string` Body param: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `id?: string` Body param: The id of the rule. Must be unique. - `automatic_advertisement?: boolean | null` Body param: Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `bandwidth?: number` Body param: The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `packet_threshold?: number` Body param: The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefixes?: Array` Body param ### Returns - `MagicNetworkMonitoringRule | null` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `name: string` The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `prefixes: Array` - `type: "threshold" | "zscore" | "advanced_ddos"` MNM rule type. - `"threshold"` - `"zscore"` - `"advanced_ddos"` - `id?: string` The id of the rule. Must be unique. - `bandwidth_threshold?: number` The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `packet_threshold?: number` The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefix_match?: "exact" | "subnet" | "supernet" | null` Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule. - `"exact"` - `"subnet"` - `"supernet"` - `zscore_sensitivity?: "low" | "medium" | "high" | null` Level of sensitivity set for zscore rules. - `"low"` - `"medium"` - `"high"` - `zscore_target?: "bits" | "packets" | null` Target of the zscore rule analysis. - `"bits"` - `"packets"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const magicNetworkMonitoringRule = await client.magicNetworkMonitoring.rules.update({ account_id: '6f91088a406011ed95aed352566e8d4c', duration: '1m', name: 'my_rule_1', }); console.log(magicNetworkMonitoringRule.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "automatic_advertisement": true, "name": "my_rule_1", "prefixes": [ "203.0.113.1/32" ], "type": "zscore", "id": "2890e6fa406311ed9b5a23f70f6fb8cf", "bandwidth_threshold": 1000, "duration": "1m", "packet_threshold": 10000, "prefix_match": "exact", "zscore_sensitivity": "high", "zscore_target": "bits" }, "success": true } ``` ## Update rule `client.magicNetworkMonitoring.rules.edit(stringruleId, RuleEditParamsparams, RequestOptionsoptions?): MagicNetworkMonitoringRule | null` **patch** `/accounts/{account_id}/mnm/rules/{rule_id}` Update a network monitoring rule for account. ### Parameters - `ruleId: string` The id of the rule. Must be unique. - `params: RuleEditParams` - `account_id: string` Path param - `automatic_advertisement?: boolean | null` Body param: Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `bandwidth?: number` Body param: The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` Body param: The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `name?: string` Body param: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `packet_threshold?: number` Body param: The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefixes?: Array` Body param ### Returns - `MagicNetworkMonitoringRule | null` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `name: string` The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `prefixes: Array` - `type: "threshold" | "zscore" | "advanced_ddos"` MNM rule type. - `"threshold"` - `"zscore"` - `"advanced_ddos"` - `id?: string` The id of the rule. Must be unique. - `bandwidth_threshold?: number` The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `packet_threshold?: number` The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefix_match?: "exact" | "subnet" | "supernet" | null` Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule. - `"exact"` - `"subnet"` - `"supernet"` - `zscore_sensitivity?: "low" | "medium" | "high" | null` Level of sensitivity set for zscore rules. - `"low"` - `"medium"` - `"high"` - `zscore_target?: "bits" | "packets" | null` Target of the zscore rule analysis. - `"bits"` - `"packets"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const magicNetworkMonitoringRule = await client.magicNetworkMonitoring.rules.edit( '2890e6fa406311ed9b5a23f70f6fb8cf', { account_id: '6f91088a406011ed95aed352566e8d4c' }, ); console.log(magicNetworkMonitoringRule.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "automatic_advertisement": true, "name": "my_rule_1", "prefixes": [ "203.0.113.1/32" ], "type": "zscore", "id": "2890e6fa406311ed9b5a23f70f6fb8cf", "bandwidth_threshold": 1000, "duration": "1m", "packet_threshold": 10000, "prefix_match": "exact", "zscore_sensitivity": "high", "zscore_target": "bits" }, "success": true } ``` ## Delete rule `client.magicNetworkMonitoring.rules.delete(stringruleId, RuleDeleteParamsparams, RequestOptionsoptions?): MagicNetworkMonitoringRule | null` **delete** `/accounts/{account_id}/mnm/rules/{rule_id}` Delete a network monitoring rule for account. ### Parameters - `ruleId: string` The id of the rule. Must be unique. - `params: RuleDeleteParams` - `account_id: string` ### Returns - `MagicNetworkMonitoringRule | null` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `name: string` The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `prefixes: Array` - `type: "threshold" | "zscore" | "advanced_ddos"` MNM rule type. - `"threshold"` - `"zscore"` - `"advanced_ddos"` - `id?: string` The id of the rule. Must be unique. - `bandwidth_threshold?: number` The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `packet_threshold?: number` The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefix_match?: "exact" | "subnet" | "supernet" | null` Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule. - `"exact"` - `"subnet"` - `"supernet"` - `zscore_sensitivity?: "low" | "medium" | "high" | null` Level of sensitivity set for zscore rules. - `"low"` - `"medium"` - `"high"` - `zscore_target?: "bits" | "packets" | null` Target of the zscore rule analysis. - `"bits"` - `"packets"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const magicNetworkMonitoringRule = await client.magicNetworkMonitoring.rules.delete( '2890e6fa406311ed9b5a23f70f6fb8cf', { account_id: '6f91088a406011ed95aed352566e8d4c' }, ); console.log(magicNetworkMonitoringRule.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "automatic_advertisement": true, "name": "my_rule_1", "prefixes": [ "203.0.113.1/32" ], "type": "zscore", "id": "2890e6fa406311ed9b5a23f70f6fb8cf", "bandwidth_threshold": 1000, "duration": "1m", "packet_threshold": 10000, "prefix_match": "exact", "zscore_sensitivity": "high", "zscore_target": "bits" }, "success": true } ``` ## Domain Types ### Magic Network Monitoring Rule - `MagicNetworkMonitoringRule` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. - `name: string` The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters. - `prefixes: Array` - `type: "threshold" | "zscore" | "advanced_ddos"` MNM rule type. - `"threshold"` - `"zscore"` - `"advanced_ddos"` - `id?: string` The id of the rule. Must be unique. - `bandwidth_threshold?: number` The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `duration?: "1m" | "5m" | "10m" | 5 more` The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. - `"1m"` - `"5m"` - `"10m"` - `"15m"` - `"20m"` - `"30m"` - `"45m"` - `"60m"` - `packet_threshold?: number` The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum. - `prefix_match?: "exact" | "subnet" | "supernet" | null` Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule. - `"exact"` - `"subnet"` - `"supernet"` - `zscore_sensitivity?: "low" | "medium" | "high" | null` Level of sensitivity set for zscore rules. - `"low"` - `"medium"` - `"high"` - `zscore_target?: "bits" | "packets" | null` Target of the zscore rule analysis. - `"bits"` - `"packets"` # Advertisements ## Update advertisement for rule `client.magicNetworkMonitoring.rules.advertisements.edit(stringruleId, AdvertisementEditParamsparams, RequestOptionsoptions?): Advertisement | null` **patch** `/accounts/{account_id}/mnm/rules/{rule_id}/advertisement` Update advertisement for rule. ### Parameters - `ruleId: string` The id of the rule. Must be unique. - `params: AdvertisementEditParams` - `account_id: string` Path param - `body: unknown` Body param ### Returns - `Advertisement | null` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const advertisement = await client.magicNetworkMonitoring.rules.advertisements.edit( '2890e6fa406311ed9b5a23f70f6fb8cf', { account_id: '6f91088a406011ed95aed352566e8d4c', body: {}, }, ); console.log(advertisement.automatic_advertisement); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "automatic_advertisement": true }, "success": true } ``` ## Domain Types ### Advertisement - `Advertisement` - `automatic_advertisement: boolean | null` Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit.