Create rules
Create network monitoring rules for account. Currently only supports creating a single rule per API request.
Security
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Accepted Permissions (at least one required)
Body ParametersJSON
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.
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.
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.
Create rules
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/mnm/rules \
-H 'Content-Type: application/json' \
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_API_KEY" \
-d '{
"duration": "1m",
"name": "my_rule_1",
"bandwidth": 1000,
"packet_threshold": 10000
}'{
"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
}Returns Examples
{
"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
}