Skip to content
Primary navigation

Delete user

client.Admin.Organization.Users.Delete(ctx, userID) (*AdminOrganizationUserDeleteResponse, error)
DELETE/organization/users/{user_id}

Deletes a user from the organization.

ParametersExpand Collapse
userID string
ReturnsExpand Collapse
type AdminOrganizationUserDeleteResponse struct{…}
ID string
Deleted bool
Object OrganizationUserDeleted

Delete user

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