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

# Update rule

`PATCH /v1/ai-gateway/rules`

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.
  - `ownerId` string, required
  - `ruleId` string, required
  - `type` 'deny' | 'rewrite', required
  - `match` object
    - `model` string
  - `action` object
    - `rewriteModel` string
    - `reason` string
  - `enabled` false | true, required
  - `deleted` false | true
  - `description` string
  - `createdBy` string
  - `updatedBy` string
  - `createdAt` number, required
  - `updatedAt` number, required

## Other responses

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

## Changes

- **2026-07-21** `2ae10ee9d21c` — 1 info
  - added the non-success response with the status `410`
- **2026-07-14** `314022afff45` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/vercel/apis/api/changes/v1/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-service-production.skmtc.workers.dev/v1/apis/vercel/api/revisions/2ae10ee9d21c/schema)
