# Update an API key

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

:::code-group
```bash title="cURL"
curl --request PATCH \
  --url https://api.pinecone.io/admin/api-keys/{api_key_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "devkey",
  "roles": [
    "ProjectEditor"
  ]
}'
```

```json title="200"
{
  "id": "<string>",
  "name": "<string>",
  "project_id": "<string>",
  "roles": [
    "ProjectEditor"
  ]
}
```
:::

## Authorizations

- `Authorization` (header, string, required) — Bearer authentication header of the form `Bearer <token>`.

## Path Parameters

- `api_key_id` (path, string, required) — API key ID

## Headers

- `X-Pinecone-Api-Version` (header, string, required) — Required date-based version header

## Body

- `name` (body, 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` (body, 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.
- `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.

## Related pages

- [List API keys](./admin-2-2026-07-admin-api-keys-list-api-keys.md)
- [Create an API key](./admin-2-2026-07-admin-api-keys-create-an-api-key.md)
- [Get API key details](./admin-2-2026-07-admin-api-keys-get-api-key-details.md)
- [Delete an API key](./admin-2-2026-07-admin-api-keys-delete-an-api-key.md)
- [Create an API key](./admin-2-2026-04-admin-create-api-key.md)
- [Create an API key](./admin-2-2026-04-admin-assistant-create-api-key.md)
- [List API keys](./admin-2-2026-04-admin-assistant-list-api-keys.md)
- [Get API key details](./admin-2-2026-04-admin-assistant-fetch-api-key.md)
- [Update an API key](./admin-2-2026-04-admin-assistant-update-api-key.md)
- [Delete an API key](./admin-2-2026-04-admin-assistant-delete-api-key.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
