Skip to content

Delete a conversation

client.Conversations.Delete(ctx, conversationID) (*ConversationDeletedResource, error)
DELETE/conversations/{conversation_id}

Delete a conversation. Items in the conversation will not be deleted.

ParametersExpand Collapse
conversationID string
ReturnsExpand Collapse
type ConversationDeletedResource struct{…}
ID string
Deleted bool
Object ConversationDeleted

Delete a conversation

package main

import (
  "context"
  "fmt"

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

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  conversationDeletedResource, err := client.Conversations.Delete(context.TODO(), "conv_123")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", conversationDeletedResource.ID)
}
{
  "id": "id",
  "deleted": true,
  "object": "conversation.deleted"
}
Returns Examples
{
  "id": "id",
  "deleted": true,
  "object": "conversation.deleted"
}