Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Delete admin API key

admin.organization.admin_api_keys.delete(key_id) -> AdminAPIKeyDeleteResponse
DELETE
/organization/admin_api_keys/{key_id}

Delete an organization admin API key

Delete admin API key

import os
from openai import OpenAI

client = OpenAI(
    admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"),  # This is the default and can be omitted
)
admin_api_key = client.admin.organization.admin_api_keys.delete(
    "key_id",
)
print(admin_api_key.id)
Response example
{
  "id": "key_abc",
  "object": "organization.admin_api_key.deleted",
  "deleted": true
}
Parameters
key_id: str

The ID of the API key to be deleted.

Returns
class AdminAPIKeyDeleteResponse: …
id: str
deleted: bool
object: Literal["organization.admin_api_key.deleted"]
Returns Examples
Response example
{
  "id": "key_abc",
  "object": "organization.admin_api_key.deleted",
  "deleted": true
}