---
title: "Update User Api Key"
method: PATCH
path: "/api/user/api-keys/{key_id}"
tags: ["User"]
---

# Update User Api Key

`PATCH /api/user/api-keys/{key_id}`

## Request

- Base URL: `https://api.agentstack.tech` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agentstack.tech/api/user/api-keys/{key_id}`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Update a user API key

Updates the name or status of a user API key.

## Path parameters

- `key_id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- UpdateUserAPIKeyRequest
  - `name` string, nullable: New name for the API key
  - `status` string, nullable: New status (active/inactive)

## Response `200`

Successful Response

- UserAPIKeyResponse
  - `key_id` string, required
  - `name` string, required
  - `created_at` string, nullable, required
  - `last_used_at` string, nullable, required
  - `expires_at` string, nullable, required
  - `status` string, required
  - `key_preview` string, nullable
  - `actor_kind` string, nullable
  - `resource_scope` object, nullable
  - `service_caps` string[], nullable
  - `preset` string, nullable
  - `pat_kind` string, nullable
  - `oauth_client_id` string, nullable

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/agentstack/apis/agentstack-core-api.md) · [All operations](https://skmtc.dev/agentstack/apis/agentstack-core-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentstack/apis/agentstack-core-api/revisions/79f4a4dd8813?raw)
