---
title: "PATCH /api-keys/{id}"
method: PATCH
path: "/api-keys/{id}"
---

# PATCH /api-keys/{id}

`PATCH /api-keys/{id}`

## Request

- Base URL: `https://api.useanima.sh/v1`
- URL: `https://api.useanima.sh/v1/api-keys/{id}`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

## Path parameters

- `id` string, required: Unique identifier of the API key to update

## Request body

- object: Request body for updating an existing API key
  - `name` string: Updated human-readable label
  - `scopes` string[]: Updated permission scopes
  - `expiresAt` string, date-time, nullable: Updated expiration timestamp, or null to remove expiration

## Response `200`

OK

- object: API key resource without the secret value
  - `id` string, required: Unique identifier for the API key
  - `orgId` string, required: Organization that owns this API key
  - `agentId` string, nullable, required: Agent this key is restricted to, null if unrestricted
  - `name` string, nullable, required: Human-readable label for the API key
  - `prefix` string, required: Non-secret prefix of the key for identification
  - `mode` 'LIVE' | 'TEST', required: Environment mode of the key
  - `scopes` string[], required: Permission scopes granted to this key
  - `revoked` boolean, required: Whether the key has been revoked
  - `createdAt` string, date-time, required: ISO 8601 timestamp when the key was created
  - `lastUsedAt` string, date-time, nullable, required: ISO 8601 timestamp when the key was last used, null if never used
  - `expiresAt` string, date-time, nullable, required: ISO 8601 timestamp when the key expires, null if no expiration
  - `createdBy` string, nullable, required: User ID of the key creator, null if created by system
  - `extension` object, nullable: Extension-token settings surfaced from metadata. Present only for extension:bridge keys.
    - `authPolicy` 'session' | 'pre_approved' | 'prompt_owner', required
    - `tokenTtl` '15m' | '1h' | 'session', required

---

[API](https://skmtc.dev/useanima/apis/anima-api.md) · [All operations](https://skmtc.dev/useanima/apis/anima-api/llms.txt) · [OpenAPI document](https://skmtc.dev/useanima/apis/anima-api/revisions/aaa148188980?raw)
