---
title: update-firewall-configuration
product: vercel
url: /docs/rest-api/security/update-firewall-configuration
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about update-firewall-configuration on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Update Firewall Configuration

```http
PATCH /v1/security/firewall/config
```

Process updates to modify the existing firewall config for a project

## Authentication

**bearerToken**: HTTP bearer

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `projectId` | string | Yes |  |
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Request body

Required: Yes

Content-Type: `application/json`

```json
{
  "oneOf": [
    {
      "type": "object",
      "description": "Enable Firewall",
      "required": [
        "action",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "firewallEnabled"
          ]
        },
        "id": {
          "nullable": true
        },
        "value": {
          "type": "boolean"
        }
      }
    },
    {
      "type": "object",
      "description": "Add a custom rule",
      "required": [
        "action",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "rules.insert"
          ]
        },
        "id": {
          "nullable": true
        },
        "value": {
          "type": "object",
          "required": [
            "name",
            "active",
            "conditionGroup",
            "action"
          ],
          "properties": {
            "name": {
              "type": "string",
              "maxLength": 160
            },
            "description": {
              "type": "string",
              "maxLength": 256
            },
            "active": {
              "type": "boolean"
            },
            "conditionGroup": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "conditions"
                ],
                "properties": {
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "op"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "host",
                            "path",
                            "method",
                            "header",
                            "query",
                            "cookie",
                            "target_path",
                            "route",
                            "raw_path",
                            "ip_address",
                            "region",
                            "protocol",
                            "scheme",
                            "environment",
                            "user_agent",
                            "geo_continent",
                            "geo_country",
                            "geo_country_region",
                            "geo_city",
                            "geo_as_number",
                            "ja4_digest",
                            "ja3_digest",
                            "rate_limit_api_id",
                            "server_action",
                            "bot_name",
                            "bot_category"
                          ]
                        },
                        "op": {
                          "type": "string",
                          "enum": [
                            "re",
                            "eq",
                            "neq",
                            "ex",
                            "nex",
                            "inc",
                            "ninc",
                            "pre",
                            "suf",
                            "sub",
                            "gt",
                            "gte",
                            "lt",
                            "lte"
                          ]
                        },
                        "neg": {
                          "type": "boolean"
                        },
                        "key": {
                          "type": "string"
                        },
                        "value": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "number"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            },
            "action": {
              "type": "object",
              "properties": {
                "mitigate": {
                  "type": "object",
                  "required": [
                    "action"
                  ],
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": [
                        "log",
                        "challenge",
                        "deny",
                        "bypass",
                        "rate_limit",
                        "redirect"
                      ]
                    },
                    "rateLimit": {
                      "nullable": true,
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "algo",
                            "window",
                            "limit",
                            "keys"
                          ],
                          "properties": {
                            "algo": {
                              "type": "string",
                              "enum": [
                                "fixed_window",
                                "token_bucket"
                              ]
                            },
                            "window": {
                              "type": "number"
                            },
                            "limit": {
                              "type": "number"
                            },
                            "keys": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "action": {
                              "nullable": true,
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "log",
                                    "challenge",
                                    "deny",
                                    "rate_limit"
                                  ]
                                },
                                {}
                              ]
                            }
                          }
                        },
                        {}
                      ]
                    },
                    "redirect": {
                      "nullable": true,
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "location",
                            "permanent"
                          ],
                          "properties": {
                            "location": {
                              "type": "string"
                            },
                            "permanent": {
                              "type": "boolean"
                            }
                          }
                        },
                        {}
                      ]
                    },
                    "actionDuration": {
                      "type": "string",
                      "nullable": true
                    },
                    "bypassSystem": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "logHeaders": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            },
            "valid": {
              "type": "boolean"
            },
            "validationErrors": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "string"
                }
              ]
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "Update a custom rule",
      "required": [
        "action",
        "id",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "rules.update"
          ]
        },
        "id": {
          "type": "string"
        },
        "value": {
          "type": "object",
          "required": [
            "name",
            "active",
            "conditionGroup",
            "action"
          ],
          "properties": {
            "name": {
              "type": "string",
              "maxLength": 160
            },
            "description": {
              "type": "string",
              "maxLength": 256
            },
            "active": {
              "type": "boolean"
            },
            "conditionGroup": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "conditions"
                ],
                "properties": {
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "op"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "host",
                            "path",
                            "method",
                            "header",
                            "query",
                            "cookie",
                            "target_path",
                            "route",
                            "raw_path",
                            "ip_address",
                            "region",
                            "protocol",
                            "scheme",
                            "environment",
                            "user_agent",
                            "geo_continent",
                            "geo_country",
                            "geo_country_region",
                            "geo_city",
                            "geo_as_number",
                            "ja4_digest",
                            "ja3_digest",
                            "rate_limit_api_id",
                            "server_action",
                            "bot_name",
                            "bot_category"
                          ]
                        },
                        "op": {
                          "type": "string",
                          "enum": [
                            "re",
                            "eq",
                            "neq",
                            "ex",
                            "nex",
                            "inc",
                            "ninc",
                            "pre",
                            "suf",
                            "sub",
                            "gt",
                            "gte",
                            "lt",
                            "lte"
                          ]
                        },
                        "neg": {
                          "type": "boolean"
                        },
                        "key": {
                          "type": "string"
                        },
                        "value": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "number"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            },
            "action": {
              "type": "object",
              "properties": {
                "mitigate": {
                  "type": "object",
                  "required": [
                    "action"
                  ],
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": [
                        "log",
                        "challenge",
                        "deny",
                        "bypass",
                        "rate_limit",
                        "redirect"
                      ]
                    },
                    "rateLimit": {
                      "nullable": true,
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "algo",
                            "window",
                            "limit",
                            "keys"
                          ],
                          "properties": {
                            "algo": {
                              "type": "string",
                              "enum": [
                                "fixed_window",
                                "token_bucket"
                              ]
                            },
                            "window": {
                              "type": "number"
                            },
                            "limit": {
                              "type": "number"
                            },
                            "keys": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "action": {
                              "nullable": true,
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "log",
                                    "challenge",
                                    "deny",
                                    "rate_limit"
                                  ]
                                },
                                {}
                              ]
                            }
                          }
                        },
                        {}
                      ]
                    },
                    "redirect": {
                      "nullable": true,
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "location",
                            "permanent"
                          ],
                          "properties": {
                            "location": {
                              "type": "string"
                            },
                            "permanent": {
                              "type": "boolean"
                            }
                          }
                        },
                        {}
                      ]
                    },
                    "actionDuration": {
                      "type": "string",
                      "nullable": true
                    },
                    "bypassSystem": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "logHeaders": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            },
            "valid": {
              "type": "boolean"
            },
            "validationErrors": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "string"
                }
              ]
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "Remove a custom rule",
      "required": [
        "action",
        "id"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "rules.remove"
          ]
        },
        "id": {
          "type": "string"
        },
        "value": {
          "nullable": true
        }
      }
    },
    {
      "type": "object",
      "description": "Reorder a custom rule",
      "required": [
        "action",
        "id",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "rules.priority"
          ]
        },
        "id": {
          "type": "string"
        },
        "value": {
          "type": "number"
        }
      }
    },
    {
      "type": "object",
      "description": "Enable a managed rule",
      "required": [
        "action",
        "id",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "crs.update"
          ]
        },
        "id": {
          "type": "string",
          "enum": [
            "sd",
            "ma",
            "lfi",
            "rfi",
            "rce",
            "php",
            "gen",
            "xss",
            "sqli",
            "sf",
            "java"
          ]
        },
        "value": {
          "type": "object",
          "required": [
            "active",
            "action"
          ],
          "properties": {
            "active": {
              "type": "boolean"
            },
            "action": {
              "type": "string",
              "enum": [
                "deny",
                "log"
              ]
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "Disable a managed rule",
      "required": [
        "action"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "crs.disable"
          ]
        },
        "id": {
          "nullable": true
        },
        "value": {
          "nullable": true
        }
      }
    },
    {
      "type": "object",
      "description": "Add an IP Blocking rule",
      "required": [
        "action",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "ip.insert"
          ]
        },
        "id": {
          "nullable": true
        },
        "value": {
          "type": "object",
          "required": [
            "hostname",
            "ip",
            "action"
          ],
          "properties": {
            "hostname": {
              "type": "string"
            },
            "ip": {
              "type": "string"
            },
            "notes": {
              "type": "string"
            },
            "action": {
              "type": "string",
              "enum": [
                "deny",
                "challenge",
                "log",
                "bypass"
              ]
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "Update an IP Blocking rule",
      "required": [
        "action",
        "id",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "ip.update"
          ]
        },
        "id": {
          "type": "string"
        },
        "value": {
          "type": "object",
          "required": [
            "hostname",
            "ip",
            "action"
          ],
          "properties": {
            "hostname": {
              "type": "string"
            },
            "ip": {
              "type": "string"
            },
            "notes": {
              "type": "string"
            },
            "action": {
              "type": "string",
              "enum": [
                "deny",
                "challenge",
                "log",
                "bypass"
              ]
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "Remove an IP Blocking rule",
      "required": [
        "action",
        "id"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "ip.remove"
          ]
        },
        "id": {
          "type": "string"
        },
        "value": {
          "nullable": true
        }
      }
    },
    {
      "type": "object",
      "description": "Update a managed ruleset",
      "required": [
        "action",
        "id",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "managedRules.update"
          ]
        },
        "id": {
          "type": "string",
          "enum": [
            "ai_bots",
            "bot_filter",
            "bot_protection",
            "vercel_ruleset",
            "owasp"
          ]
        },
        "value": {
          "type": "object",
          "required": [
            "active"
          ],
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "log",
                "challenge",
                "deny"
              ]
            },
            "active": {
              "type": "boolean"
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "Update a managed rule group",
      "required": [
        "action",
        "id",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string"
        },
        "id": {
          "type": "string",
          "enum": [
            "ai_bots",
            "bot_filter",
            "bot_protection",
            "vercel_ruleset",
            "owasp"
          ]
        },
        "value": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "required": [
              "active"
            ],
            "properties": {
              "active": {
                "type": "boolean"
              },
              "action": {
                "type": "string",
                "enum": [
                  "log",
                  "challenge",
                  "deny"
                ]
              }
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "Toggle bot ID",
      "required": [
        "action",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "value": {
          "type": "boolean"
        }
      }
    },
    {
      "type": "object",
      "description": "Update log headers configuration",
      "required": [
        "action",
        "value"
      ],
      "properties": {
        "action": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "value": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "string"
            }
          ]
        }
      }
    }
  ]
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object"
}
```

### 400: One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.

### 401: The request is not authorized.

### 402: No description

### 403: You do not have permission to access this resource.

### 404: No description

### 500: No description

---

## Related

- [security endpoints](/docs/rest-api#security)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://openapi.vercel.sh/) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
