Creates a new IP Access rule for all zones owned by the current user. Note: To create an IP Access rule that applies to a specific zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.
/user/firewall/access_rules/rules
post
IP Access rules for a user
ip-access-rules-for-a-user-create-an-ip-access-rule
{
"business": true,
"enterprise": true,
"free": true,
"pro": true
} null [] {
"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
} {
"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": {
"properties": {
"allowed_modes": {
"description": "The available actions that a rule can apply to a matched request.",
"example": [
"whitelist",
"block",
"challenge",
"js_challenge",
"managed_challenge"
],
"items": {
"description": "The action to apply to a matched request.",
"enum": [
"block",
"challenge",
"whitelist",
"js_challenge",
"managed_challenge"
],
"example": "challenge",
"type": "string"
},
"readOnly": true,
"type": "array"
},
"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"
},
"created_on": {
"description": "The timestamp of when the rule was created.",
"example": "2014-01-01T05:20:00.12345Z",
"format": "date-time",
"readOnly": true,
"type": "string"
},
"id": {
"description": "The unique identifier of the IP Access rule.",
"example": "92f17202ed8bd63d69a66b86a49a8f6b",
"maxLength": 32,
"readOnly": true,
"type": "string"
},
"mode": {
"description": "The action to apply to a matched request.",
"enum": [
"block",
"challenge",
"whitelist",
"js_challenge",
"managed_challenge"
],
"example": "challenge",
"type": "string"
},
"modified_on": {
"description": "The timestamp of when the rule was last modified.",
"example": "2014-01-01T05:20:00.12345Z",
"format": "date-time",
"readOnly": true,
"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": [
"id",
"mode",
"allowed_modes",
"configuration"
],
"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": {
"properties": {
"allowed_modes": {
"description": "The available actions that a rule can apply to a matched request.",
"example": [
"whitelist",
"block",
"challenge",
"js_challenge",
"managed_challenge"
],
"items": {
"description": "The action to apply to a matched request.",
"enum": [
"block",
"challenge",
"whitelist",
"js_challenge",
"managed_challenge"
],
"example": "challenge",
"type": "string"
},
"readOnly": true,
"type": "array"
},
"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"
},
"created_on": {
"description": "The timestamp of when the rule was created.",
"example": "2014-01-01T05:20:00.12345Z",
"format": "date-time",
"readOnly": true,
"type": "string"
},
"id": {
"description": "The unique identifier of the IP Access rule.",
"example": "92f17202ed8bd63d69a66b86a49a8f6b",
"maxLength": 32,
"readOnly": true,
"type": "string"
},
"mode": {
"description": "The action to apply to a matched request.",
"enum": [
"block",
"challenge",
"whitelist",
"js_challenge",
"managed_challenge"
],
"example": "challenge",
"type": "string"
},
"modified_on": {
"description": "The timestamp of when the rule was last modified.",
"example": "2014-01-01T05:20:00.12345Z",
"format": "date-time",
"readOnly": true,
"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": [
"id",
"mode",
"allowed_modes",
"configuration"
],
"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"
}
} [
{
"api_email": [],
"api_key": []
},
{
"api_token": []
}
]