Claude Platform Docs

Update API Key

client.beta.organization.apiKeys.update(apiKeyID, body, options?): BetaAPIKey
POST/v1/organizations/api_keys/{api_key_id}

Update API Key

Parameters
apiKeyID: string⁠Path parameter

ID of the API key.

body: APIKeyUpdateParams { name; status }
name?: string | null

Name of the API key.

minLength1
maxLength500
status?: "active" | "archived" | "inactive" | null

Status of the API key.

One of the following:
"active"
"archived"
"inactive"
Returns
interface BetaAPIKey { type: "api_key"; id; created_at; /* 7 more */ }
Update API Key
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env["ANTHROPIC_API_KEY"] // This is the default and can be omitted
});

const betaAPIKey = await client.beta.organization.apiKeys.update("api_key_id", {});

console.log(betaAPIKey.id);
Returns Examples
Response 200
{
  "id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
  "created_at": "2024-10-30T23:58:27.427722Z",
  "created_by": {
    "id": "user_01WxYzAbCdEfGhJkMnPqRsTu",
    "type": "user"
  },
  "expires_at": "2024-10-30T23:58:27.427722Z",
  "name": "Developer Key",
  "partial_key_hint": "sk-ant-api03-R2D...igAA",
  "principal": {
    "type": "user_actor",
    "user_id": "user_01WxYzAbCdEfGhJkMnPqRsTu"
  },
  "scope": {
    "type": "workspace",
    "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
  },
  "status": "active",
  "type": "api_key"
}