---
title: "Update rule"
method: PATCH
path: "/ai-gateway/rules"
tags: ["ai-gateway"]
---

# Update rule

`PATCH /ai-gateway/rules`

## Request

- Base URL: `https://api.vercel.com`
- URL: `https://api.vercel.com/ai-gateway/rules`
- Auth: HTTP bearer

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

## Query parameters

- `teamId` string
- `slug` string

## Response `200`

- AiGatewayRule: Public response shape for AI Gateway routing rules. Used so OpenAPI generation can avoid ElectroDB's recursive EntityItem types.
  - `action` object
    - `reason` string
    - `rewriteModel` string
  - `createdAt` number, required
  - `createdBy` string
  - `deleted` false | true
  - `description` string
  - `enabled` false | true, required
  - `match` object
    - `model` string
  - `ownerId` string, required
  - `ruleId` string, required
  - `type` 'deny' | 'rewrite', required
  - `updatedAt` number, required
  - `updatedBy` string

## Other responses

- `400`
- `401`: The request is not authorized.
- `403`: You do not have permission to access this resource.
- `404`
- `410`
- `500`

## Changes

- **2026-09-30** `6f68095b42b1`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vercel/apis/api/changes/ai-gateway/rules/patch.md)

---

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