---
title: "Generate a firewall rule from natural language"
method: POST
path: "/v1/security/firewall/config/generate-rule"
tags: ["security"]
---

# Generate a firewall rule from natural language

`POST /v1/security/firewall/config/generate-rule`

## Request

- Base URL: `https://api.vercel.com`
- URL: `https://api.vercel.com/v1/security/firewall/config/generate-rule`
- Auth: HTTP bearer

Generate a firewall rule from a natural language description.

## Query parameters

- `projectId` string
- `teamId` string
- `slug` string

## Response `200`

- object
  - `error` string
  - `rule` object
    - `action` object, required
      - `mitigate` object
        - `action` string, required
        - `actionDuration` string, nullable
        - `rateLimit` object, nullable
          - `action` string, nullable
          - `algo` string, required
          - `keys` string[], required
          - `limit` number, required
          - `window` number, required
        - `redirect` object, nullable
          - `location` string, required
          - `permanent` false | true, required
    - `active` false | true, required
    - `conditionGroup` object[], required
      - `conditions` object[], required
        - `key` string
        - `neg` false | true, required
        - `op` string, required
        - `type` string, required
        - `value` union
          - string
          - number
          - string[]
    - `description` string
    - `name` string, required

## Other responses

- `400`: One of the provided values in the request query is invalid.
- `401`: The request is not authorized.
- `403`: You do not have permission to access this resource.
- `404`
- `408`
- `410`
- `500`

## Changes

- **2026-10-22** `7e27743fb7b3`: 1 info
  - the response property `rule/conditionGroup/items/conditions/items/neg` became required for the status `200`
- **2026-07-31** `e20468c66692`: 3 info
  - api tag `security` added
  - api tag `firewall` removed
  - the `query` request parameter `projectId` became optional
- **2026-07-21** `2ae10ee9d21c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vercel/apis/vercel-api/changes/v1/security/firewall/config/generate-rule/post.md)

---

[API](https://skmtc.dev/vercel/apis/vercel-api.md) - [All operations](https://skmtc.dev/vercel/apis/vercel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vercel/apis/vercel-api/revisions/60686c0e1f6a?raw)
