---
title: "Update an AI Gateway key"
method: PATCH
path: "/project/{project}/ai-gateway/keys/{key_id}"
tags: ["AIGateway"]
---

# Update an AI Gateway key

`PATCH /project/{project}/ai-gateway/keys/{key_id}`

## Request

- Base URL: `https://api.aiven.io/v1`
- URL: `https://api.aiven.io/v1/project/{project}/ai-gateway/keys/{key_id}`
- Auth: HTTP bearer and OAuth 2
  - Authorization code: `https://console.aiven.io/oauth/authorize`
  - Token URL: `https://api.aiven.io/v1/oauth2/token` scopes: `projects:write`

> This endpoint **may be changed or removed at any time**. Don't use it in production environments.

Only the description can be changed, and only while the key is usable. A key's expiry time cannot be extended; mint a new key instead.

## Path parameters

- `project` string, required
- `key_id` string, required

## Request body

- AIGatewayKeyUpdateRequestBody: AIGatewayKeyUpdateRequestBody
  - `description` string: Longer description on how the key is used
  - `name` string: Short human readable identifier for the key

## Response `200`

Response

- AIGatewayKeyUpdateResponse: AIGatewayKeyUpdateResponse
  - `create_time` string, required: Time the key was created
  - `description` string: Longer description on how the key is used
  - `expiry_time` string: Time the key expires
  - `key_id` string, required: Key ID
  - `key_suffix` string, required: Last characters of the key
  - `name` string, required: Short human readable identifier for the key
  - `revocation_time` string: Time the key was revoked

## Other responses

- `400`: The name is blank
- `403`: AI Gateway is not enabled for this organization
- `404`: Key not found
- `409`: The key has expired or has been revoked
- `503`: AI Gateway keys are unavailable

## Changes

- **2026-10-14** `890113a87c87`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/aiven/apis/aiven-api-documentation/changes/project/:project/ai-gateway/keys/:key_id/patch.md)

---

[API](https://skmtc.dev/aiven/apis/aiven-api-documentation.md) - [All operations](https://skmtc.dev/aiven/apis/aiven-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/aiven/apis/aiven-api-documentation/revisions/562453405db0?raw)
