---
title: "Update a Key"
method: PATCH
path: "/keys/{KeyIdOrName}"
tags: ["Keys"]
---

# Update a Key

`PATCH /keys/{KeyIdOrName}`

Update a Key

## Request body

- Key
  - `created_at` integer — Unix epoch when the resource was created.
  - `id` string
  - `jwk` string — A JSON Web Key represented as a string.
  - `kid` string — A unique identifier for a key.
  - `name` string — The name to associate with the given keys.
  - `pem` object — A keypair in PEM format.
    - `private_key` string
    - `public_key` string
  - `set` object — The id (an UUID) of the key-set with which to associate the key.
    - `id` string
  - `tags` string[] — An optional set of strings associated with the Key for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.

## Response `200`

Successfully updated Key

- Key
  - `created_at` integer — Unix epoch when the resource was created.
  - `id` string
  - `jwk` string — A JSON Web Key represented as a string.
  - `kid` string — A unique identifier for a key.
  - `name` string — The name to associate with the given keys.
  - `pem` object — A keypair in PEM format.
    - `private_key` string
    - `public_key` string
  - `set` object — The id (an UUID) of the key-set with which to associate the key.
    - `id` string
  - `tags` string[] — An optional set of strings associated with the Key for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.

## Other responses

- `401` — Unauthorized
- `404` — Resource does not exist

## Changes

> 3 revisions in range; 1 not diffed.

- **2024-09-11** `5bd52189d290` — 1 warning
  - deleted the `path` request parameter `KeyIdOrName`

[Change history](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/changes/keys/:KeyIdOrName/patch.md)

---

[API](https://skmtc.dev/kong/apis/kong-enterprise-admin-api.md) · [All operations](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kong/kong-enterprise-admin-api/revisions/5bd52189d290/schema)
