---
title: update-rule
product: vercel
url: /docs/rest-api/api-ai-gateway/update-rule
canonical_url: "https://vercel.com/docs/rest-api/api-ai-gateway/update-rule"
last_updated: 2026-07-15
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about update-rule on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Update rule

```http
PATCH /v1/ai-gateway/rules
```

Update a routing rule (enabled, action, or description)

## Authentication

**bearerToken**: HTTP bearer

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `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. |


## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "description": "Public response shape for AI Gateway routing rules. Used so OpenAPI generation can avoid ElectroDB's recursive EntityItem types.",
  "required": [
    "createdAt",
    "enabled",
    "ownerId",
    "ruleId",
    "type",
    "updatedAt"
  ],
  "properties": {
    "ownerId": {
      "type": "string"
    },
    "ruleId": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "deny",
        "rewrite"
      ]
    },
    "match": {
      "type": "object",
      "properties": {
        "model": {
          "type": "string"
        }
      }
    },
    "action": {
      "type": "object",
      "properties": {
        "rewriteModel": {
          "type": "string"
        },
        "reason": {
          "type": "string"
        }
      }
    },
    "enabled": {
      "type": "boolean",
      "enum": [
        false,
        true
      ]
    },
    "deleted": {
      "type": "boolean",
      "enum": [
        false,
        true
      ]
    },
    "description": {
      "type": "string"
    },
    "createdBy": {
      "type": "string"
    },
    "updatedBy": {
      "type": "string"
    },
    "createdAt": {
      "type": "number"
    },
    "updatedAt": {
      "type": "number"
    }
  }
}
```

### 400: No description

### 401: The request is not authorized.

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

### 404: No description

### 500: No description

---

## Related

- [api-ai-gateway endpoints](/docs/rest-api#api-ai-gateway)

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

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

---

[View full sitemap](/docs/sitemap)
