Skip to content
Primary navigation

Delete organization role

client.Admin.Organization.Roles.Delete(ctx, roleID) (*AdminOrganizationRoleDeleteResponse, error)
DELETE/organization/roles/{role_id}

Deletes a custom role from the organization.

ParametersExpand Collapse
roleID string
ReturnsExpand Collapse
type AdminOrganizationRoleDeleteResponse struct{…}

Confirmation payload returned after deleting a role.

ID string

Identifier of the deleted role.

Deleted bool

Whether the role was deleted.

Object RoleDeleted

Always role.deleted.

Delete organization role

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"),
  )
  role, err := client.Admin.Organization.Roles.Delete(context.TODO(), "role_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", role.ID)
}
{
    "object": "role.deleted",
    "id": "role_01J1F8ROLE01",
    "deleted": true
}
Returns Examples
{
    "object": "role.deleted",
    "id": "role_01J1F8ROLE01",
    "deleted": true
}