---
title: "Update Key"
method: PATCH
path: "/v1/keys/{key_id}"
tags: ["keys"]
---

# Update Key

`PATCH /v1/keys/{key_id}`

Update an API key.

Requires master key authentication.

## Path parameters

- `key_id` string, required

## Request body

- UpdateKeyRequest — Request model for updating a key.
  - `allowed_models` string[], nullable
  - `capture_agent_telemetry` boolean, nullable
  - `exclude_from_budget` boolean, nullable
  - `expires_at` string, date-time, nullable
  - `is_active` boolean, nullable
  - `key_name` string, nullable
  - `metadata` object, nullable
  - `reject_user_mismatch` boolean, nullable

## Response `200`

Successful Response

- KeyInfo — Response model for key information.
  - `allowed_models` string[], nullable, required
  - `capture_agent_telemetry` boolean, nullable, required
  - `created_at` string, required
  - `exclude_from_budget` boolean, required
  - `expires_at` string, nullable, required
  - `id` string, required
  - `is_active` boolean, required
  - `key_name` string, nullable, required
  - `key_prefix` string, nullable, required
  - `last_used_at` string, nullable, required
  - `metadata` object, required
  - `reject_user_mismatch` boolean, nullable, required
  - `user_id` string, nullable, required
  - `workspace_id` string, uuid, required

## Other responses

- `422` — Validation Error

## Changes

- **2026-08-19** `3945cde96091` — 1 info
  - added the required property `workspace_id` to the response with the `200` status
- **2026-08-12** `4891ca15ef2b` — 2 info
  - added the new optional request property `capture_agent_telemetry`
  - added the required property `capture_agent_telemetry` to the response with the `200` status
- **2026-08-06** `f7875304ff05` — 2 info
  - added the new optional request property `reject_user_mismatch`
  - added the required property `reject_user_mismatch` to the response with the `200` status
- **2026-07-23** `2a163c690f59` — 2 info
  - added the new optional request property `exclude_from_budget`
  - added the required property `exclude_from_budget` to the response with the `200` status
- **2026-07-20** `bcd0082085cb` — 3 info
  - added the new optional request property `allowed_models`
  - added the required property `allowed_models` to the response with the `200` status
  - added the required property `key_prefix` to the response with the `200` status

[Full history](https://skmtc.dev/mozilla-ai/apis/otari/changes/v1/keys/:key_id/patch.md)

---

[API](https://skmtc.dev/mozilla-ai/apis/otari.md) · [All operations](https://skmtc.dev/mozilla-ai/apis/otari/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/mozilla-ai/otari/revisions/cea76e85cdac/schema)
