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

Delete admin API key

client.Admin.Organization.AdminAPIKeys.Delete(ctx, keyID) (*AdminOrganizationAdminAPIKeyDeleteResponse, error)
DELETE
/organization/admin_api_keys/{key_id}

Delete an organization admin API key

Parameters
keyID string

The ID of the API key to be deleted.

Returns
type AdminOrganizationAdminAPIKeyDeleteResponse struct{…}
ID string
Deleted bool
Object OrganizationAdminAPIKeyDeleted

Delete admin API key

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAdminAPIKey("My Admin API Key"),
  )
  adminAPIKey, err := client.Admin.Organization.AdminAPIKeys.Delete(context.TODO(), "key_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", adminAPIKey.ID)
}
{
  "id": "key_abc",
  "object": "organization.admin_api_key.deleted",
  "deleted": true
}
Returns Examples
{
  "id": "key_abc",
  "object": "organization.admin_api_key.deleted",
  "deleted": true
}