---
title: "PATCH /api-keys/{id}"
method: PATCH
path: "/api-keys/{id}"
tags: ["API Keys"]
---

# PATCH /api-keys/{id}

`PATCH /api-keys/{id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/api-keys/{id}`
- Auth: HTTP bearer

## Path parameters

- `id` integer, required

## Request body

- UpdateApiKeyRequest
  - `expires_at` string, date-time, nullable
  - `is_active` boolean, nullable
  - `name` string, nullable
  - `permissions` string[], nullable

## Response `200`

API key updated successfully

- ApiKeyResponse
  - `created_at` string, date-time, required
  - `environment_id` integer, nullable
  - `expires_at` string, date-time, nullable
  - `id` integer, required
  - `is_active` boolean, required
  - `key_prefix` string, required
  - `last_used_at` string, date-time, nullable
  - `name` string, required
  - `permissions` string[], nullable
  - `project_id` integer, nullable: Immutable optional deployment resource scope.
  - `role_type` string, required

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `409`: Conflict - API key name already exists
- `500`: Internal server error

## Changes

- **2026-11-16** `eb31063c55e2`: 2 info
  - added the optional property `environment_id` to the response with the `200` status
  - added the optional property `project_id` to the response with the `200` status
- **2026-11-06** `6ad6cfa11620`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/api-keys/:id/patch.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
