Claude Platform Docs

Delete External Key

client.beta.organization.externalKeys.delete(externalKeyID, options?): ExternalKeyDeleteResponse
DELETE/v1/organizations/external_keys/{external_key_id}

Delete an external key config.

The request is rejected if any workspace still references this config.

Parameters
externalKeyID: string⁠Path parameter

ID of the External Key.

maxLength2048
Returns
interface ExternalKeyDeleteResponse { type: "external_key_deleted"; id }
type: "external_key_deleted"
defaultexternal_key_deleted
id: string

ID of the deleted External Key.

Errors

Any method can also return the general HTTP errors.

ExternalKeyInWorkspacePolicyErrorHTTP status 400error code external_key_in_workspace_policy

The External Key can't be deleted or reconfigured while the organization's Workspace Policy lists it as an allowed key.

SandboxEgressRestrictedErrorHTTP status 403error code sandbox_egress_restricted

The request came from a Claude sandbox with restricted network access, which is not allowed to make this change. Send it from outside the sandbox, or from a sandbox with unrestricted network access.

Delete External 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 externalKey = await client.beta.organization.externalKeys.delete("external_key_id");

console.log(externalKey.id);
Returns Examples
Response 200
{
  "id": "ekey_01AbCdEfGhIjKlMnOpQrStUv",
  "type": "external_key_deleted"
}