---
title: "Update API key"
method: PATCH
path: "/keys/{keyId}"
tags: ["Key Management"]
---

# Update API key

`PATCH /keys/{keyId}`

## Request

- Base URL: `https://app.arkova.ai/api/v1`
- URL: `https://app.arkova.ai/api/v1/keys/{keyId}`
- Auth: HTTP bearer

Update a key name, revoke it, or change its expiry. Version 1 member identity and workspace are immutable; revoke the existing key and authorize a new key to change the acting member. Add context=personal to manage only the JWT owner's personal key, including after joining an organization or losing paid eligibility. Expiry is set with expires_in_days (a duration from now; null removes it) — expires_at is not settable. An expiry sent alongside a revoke (is_active: false) is dropped and the revoke is honoured; an expiry cannot be combined with reactivating a key.

## Path parameters

- `keyId` string, uuid, required

## Query parameters

- `context` 'personal'

## Headers

- `X-Org-Id` string, uuid

## Request body

- object
  - `name` string
  - `scopes` string[]
  - `expires_in_days` integer, nullable: Set the expiry this many days from now, or null to remove the expiry entirely. REPLACES any existing expiry — it does not add to it — so a value earlier than the current expiry is refused with 409 api_key_expiry_would_shorten unless allow_shorten is true.
  - `assigned_user_id` string, uuid, nullable: UAT-21: reassign the key to another current organization member, or null to unassign it. 400 assignee_not_org_member otherwise.
  - `allow_shorten` boolean: Acknowledge that expires_in_days moves the expiry EARLIER (or gives an unexpiring key an expiry). Required for such a change; ignored otherwise.

## Response `200`

Key updated

## Other responses

- `400`: Invalid request
- `401`: Authentication required
- `404`: Resource not found
- `409`: api_key_already_revoked — revocation is terminal, so the key cannot be reactivated or extended; or api_key_expiry_would_shorten — the requested expiry is earlier than the current one and allow_shorten was not set; or api_key_changed — expiry or revocation changed concurrently, so refresh before retrying.

---

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