Skip to content
Primary navigation

List ChatKit threads

client.Beta.ChatKit.Threads.List(ctx, query) (*ConversationCursorPage[ChatKitThread], error)
GET/chatkit/threads

List ChatKit threads with optional pagination and user filters.

ParametersExpand Collapse
query BetaChatKitThreadListParams
After param.Field[string]optional

List items created after this thread item ID. Defaults to null for the first page.

Before param.Field[string]optional

List items created before this thread item ID. Defaults to null for the newest results.

Limit param.Field[int64]optional

Maximum number of thread items to return. Defaults to 20.

minimum0
maximum100
Order param.Field[BetaChatKitThreadListParamsOrder]optional

Sort order for results by creation time. Defaults to desc.

const BetaChatKitThreadListParamsOrderAsc BetaChatKitThreadListParamsOrder = "asc"
const BetaChatKitThreadListParamsOrderDesc BetaChatKitThreadListParamsOrder = "desc"
User param.Field[string]optional

Filter threads that belong to this user identifier. Defaults to null to return all users.

minLength1
maxLength512
ReturnsExpand Collapse
type ChatKitThread struct{…}

Represents a ChatKit thread and its current status.

ID string

Identifier of the thread.

CreatedAt int64

Unix timestamp (in seconds) for when the thread was created.

Object ChatKitThread

Type discriminator that is always chatkit.thread.

Status ChatKitThreadStatusUnion

Current status for the thread. Defaults to active for newly created threads.

Accepts one of the following:
type ChatKitThreadStatusActive struct{…}

Indicates that a thread is active.

Type Active

Status discriminator that is always active.

type ChatKitThreadStatusLocked struct{…}

Indicates that a thread is locked and cannot accept new input.

Reason string

Reason that the thread was locked. Defaults to null when no reason is recorded.

Type Locked

Status discriminator that is always locked.

type ChatKitThreadStatusClosed struct{…}

Indicates that a thread has been closed.

Reason string

Reason that the thread was closed. Defaults to null when no reason is recorded.

Type Closed

Status discriminator that is always closed.

Title string

Optional human-readable title for the thread. Defaults to null when no title has been generated.

User string

Free-form string that identifies your end user who owns the thread.

List ChatKit threads

package main

import (
  "context"
  "fmt"

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

func main() {
  client := openai.NewClient()
  page, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "data": [
    {
      "id": "cthr_abc123",
      "object": "chatkit.thread",
      "title": "Customer escalation"
    },
    {
      "id": "cthr_def456",
      "object": "chatkit.thread",
      "title": "Demo feedback"
    }
  ],
  "has_more": false,
  "object": "list"
}
Returns Examples
{
  "data": [
    {
      "id": "cthr_abc123",
      "object": "chatkit.thread",
      "title": "Customer escalation"
    },
    {
      "id": "cthr_def456",
      "object": "chatkit.thread",
      "title": "Demo feedback"
    }
  ],
  "has_more": false,
  "object": "list"
}