Skip to content

Delete thread

Deprecated
client.Beta.Threads.Delete(ctx, threadID) (*ThreadDeleted, error)
DELETE/threads/{thread_id}

Delete a thread.

ParametersExpand Collapse
threadID string
ReturnsExpand Collapse
type ThreadDeleted struct{…}
ID string
Deleted bool
Object ThreadDeleted

Delete thread

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"),
  )
  threadDeleted, err := client.Beta.Threads.Delete(context.TODO(), "thread_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", threadDeleted.ID)
}
{
  "id": "id",
  "deleted": true,
  "object": "thread.deleted"
}
Returns Examples
{
  "id": "id",
  "deleted": true,
  "object": "thread.deleted"
}