Create an IP Access rule

Creates a new IP Access rule for an account. The rule will apply to all zones in the account. Note: To create an IP Access rule that applies to a single zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.

/accounts/{account_identifier}/firewall/access_rules/rules

post

IP Access rules for an account

ip-access-rules-for-an-account-create-an-ip-access-rule

Debug "planAvailability"

{
  "business": true,
  "enterprise": true,
  "free": true,
  "pro": true
}

Debug "tokenPermissions"

{
  "enum": [
    "#waf:edit"
  ]
}

Debug "parameters"

[
  {
    "in": "path",
    "name": "account_identifier",
    "required": true,
    "schema": {}
  }
]

Debug "requestBody"

{
  "content": {
    "application/json": {
      "schema": {
        "properties": {
          "configuration": {
            "description": "The rule configuration.",
            "oneOf": [
              {
                "properties": {
                  "target": {
                    "description": "The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",
                    "enum": [
                      "ip"
                    ],
                    "example": "ip"
                  },
                  "value": {
                    "description": "The IP address to match. This address will be compared to the IP address of incoming requests.",
                    "example": "198.51.100.4",
                    "type": "string"
                  }
                },
                "title": "An IP address configuration."
              },
              {
                "properties": {
                  "target": {
                    "description": "The configuration target. You must set the target to `ip6` when specifying an IPv6 address in the rule.",
                    "enum": [
                      "ip6"
                    ],
                    "example": "ip6"
                  },
                  "value": {
                    "description": "The IPv6 address to match.",
                    "example": "2001:DB8:100::CF",
                    "type": "string"
                  }
                },
                "title": "An IPv6 address configuration."
              },
              {
                "properties": {
                  "target": {
                    "description": "The configuration target. You must set the target to `ip_range` when specifying an IP address range in the rule.",
                    "enum": [
                      "ip_range"
                    ],
                    "example": "ip_range"
                  },
                  "value": {
                    "description": "The IP address range to match. You can only use prefix lengths `/16` and `/24` for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges.",
                    "example": "198.51.100.4/16",
                    "type": "string"
                  }
                },
                "title": "An IP address range configuration."
              },
              {
                "properties": {
                  "target": {
                    "description": "The configuration target. You must set the target to `asn` when specifying an Autonomous System Number (ASN) in the rule.",
                    "enum": [
                      "asn"
                    ],
                    "example": "asn"
                  },
                  "value": {
                    "description": "The AS number to match.",
                    "example": "AS12345",
                    "type": "string"
                  }
                },
                "title": "An ASN configuration."
              },
              {
                "properties": {
                  "target": {
                    "description": "The configuration target. You must set the target to `country` when specifying a country code in the rule.",
                    "enum": [
                      "country"
                    ],
                    "example": "country"
                  },
                  "value": {
                    "description": "The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country).",
                    "example": "US",
                    "type": "string"
                  }
                },
                "title": "A country configuration."
              }
            ],
            "type": "object"
          },
          "mode": {
            "description": "The action to apply to a matched request.",
            "enum": [
              "block",
              "challenge",
              "whitelist",
              "js_challenge",
              "managed_challenge"
            ],
            "example": "challenge",
            "type": "string"
          },
          "notes": {
            "description": "An informative summary of the rule, typically used as a reminder or explanation.",
            "example": "This rule is enabled because of an event that occurred on date X.",
            "type": "string"
          }
        },
        "required": [
          "mode",
          "configuration"
        ]
      }
    }
  },
  "required": true
}

Debug "responses"

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "allOf": [
                {
                  "properties": {
                    "errors": {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    },
                    "messages": {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "type": "object"
                        },
                        {
                          "items": {},
                          "type": "array"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "success": {
                      "description": "Whether the API call was successful",
                      "enum": [
                        true
                      ],
                      "example": true,
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success",
                    "errors",
                    "messages",
                    "result"
                  ],
                  "type": "object"
                },
                {
                  "properties": {
                    "result": {
                      "anyOf": [
                        {
                          "type": "object"
                        },
                        {
                          "type": "string"
                        }
                      ],
                      "nullable": true
                    }
                  }
                }
              ],
              "type": "object"
            },
            {
              "properties": {
                "result": {
                  "type": "object"
                }
              },
              "type": "object"
            }
          ]
        }
      }
    },
    "description": "Create an IP Access rule response"
  },
  "4xx": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "allOf": [
                {
                  "allOf": [
                    {
                      "properties": {
                        "errors": {
                          "example": [],
                          "items": {
                            "properties": {
                              "code": {
                                "minimum": 1000,
                                "type": "integer"
                              },
                              "message": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "code",
                              "message"
                            ],
                            "type": "object",
                            "uniqueItems": true
                          },
                          "type": "array"
                        },
                        "messages": {
                          "example": [],
                          "items": {
                            "properties": {
                              "code": {
                                "minimum": 1000,
                                "type": "integer"
                              },
                              "message": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "code",
                              "message"
                            ],
                            "type": "object",
                            "uniqueItems": true
                          },
                          "type": "array"
                        },
                        "result": {
                          "anyOf": [
                            {
                              "type": "object"
                            },
                            {
                              "items": {},
                              "type": "array"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "success": {
                          "description": "Whether the API call was successful",
                          "enum": [
                            true
                          ],
                          "example": true,
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "success",
                        "errors",
                        "messages",
                        "result"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "result": {
                          "anyOf": [
                            {
                              "type": "object"
                            },
                            {
                              "type": "string"
                            }
                          ],
                          "nullable": true
                        }
                      }
                    }
                  ],
                  "type": "object"
                },
                {
                  "properties": {
                    "result": {
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              ]
            },
            {
              "properties": {
                "errors": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": [
                    {
                      "code": 7003,
                      "message": "No route for the URI"
                    }
                  ],
                  "minLength": 1
                },
                "messages": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": []
                },
                "result": {
                  "enum": [
                    null
                  ],
                  "nullable": true,
                  "type": "object"
                },
                "success": {
                  "description": "Whether the API call was successful",
                  "enum": [
                    false
                  ],
                  "example": false,
                  "type": "boolean"
                }
              },
              "required": [
                "success",
                "errors",
                "messages",
                "result"
              ],
              "type": "object"
            }
          ]
        }
      }
    },
    "description": "Create an IP Access rule response failure"
  }
}

Debug "security"

[
  {
    "api_email": [],
    "api_key": []
  },
  {
    "api_token": []
  }
]