Skip to content
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

ParametersExpand Collapse
keyID string

The ID of the API key to be deleted.

ReturnsExpand Collapse
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
}