---
title: "Update an API key"
method: PATCH
path: "/admin/api-keys/{api_key_id}"
tags: ["API Keys"]
---

# Update an API key

`PATCH /admin/api-keys/{api_key_id}`

Update the name and roles of an API key.

## Path parameters

- `api_key_id` string, uuid, required

## Headers

- `X-Pinecone-Api-Version` string, required

## Request body

- AdminUpdateAPIKeyRequest
  - `name` string — A new name for the API key. The name must be 1-80 characters long. If omitted, the name will not be updated.
  - `roles` string[] — A new set of roles for the API key. Existing roles will be removed if not included. If this field is omitted, the roles will not be updated.

## Response `200`

API key updated successfully.

- AdminAPIKey — The details of an API key, without the secret.
  - `id` string, uuid, required — The unique ID of the API key.
  - `name` string, required — The name of the API key.
  - `project_id` string, uuid, required — The ID of the project containing the API key.
  - `roles` string[], required — The roles assigned to the API key.

## Other responses

- `400` — Bad request. The request body included invalid request parameters.
- `401` — Unauthorized. Possible causes: Invalid API key.
- `403` — Forbidden
- `500` — Internal server error.
- `4XX` — Unexpected error on request.

---

[API](https://skmtc.net/pinecone/apis/pinecone-api.md) · [All operations](https://skmtc.net/pinecone/apis/pinecone-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pinecone/pinecone-api/revisions/35876583485d/schema)
