Skip to content

List ChatKit thread items

ThreadListItemsPage beta().chatkit().threads().listItems(ThreadListItemsParamsparams = ThreadListItemsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/chatkit/threads/{thread_id}/items

List ChatKit thread items

ParametersExpand Collapse
ThreadListItemsParams params
Optional<String> threadId
Optional<String> after

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

Optional<String> before

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

Optional<Long> limit

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

minimum0
maximum100
Optional<Order> order

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

ASC("asc")
DESC("desc")
ReturnsExpand Collapse
class Data: A class that can be one of several variants.union

User-authored messages within a thread.

class ChatKitThreadUserMessageItem:

User-authored messages within a thread.

String id

Identifier of the thread item.

List<ChatKitAttachment> attachments

Attachments associated with the user message. Defaults to an empty list.

String id

Identifier for the attachment.

String mimeType

MIME type of the attachment.

String name

Original display name for the attachment.

Optional<String> previewUrl

Preview URL for rendering the attachment inline.

Type type

Attachment discriminator.

Accepts one of the following:
IMAGE("image")
FILE("file")
List<Content> content

Ordered content elements supplied by the user.

Accepts one of the following:
class InputText:

Text block that a user contributed to the thread.

String text

Plain-text content supplied by the user.

JsonValue; type "input_text"constant"input_text"constant

Type discriminator that is always input_text.

class QuotedText:

Quoted snippet that the user referenced in their message.

String text

Quoted text content.

JsonValue; type "quoted_text"constant"quoted_text"constant

Type discriminator that is always quoted_text.

long createdAt

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

Optional<InferenceOptions> inferenceOptions

Inference overrides applied to the message. Defaults to null when unset.

Optional<String> model

Model name that generated the response. Defaults to null when using the session default.

Optional<ToolChoice> toolChoice

Preferred tool to invoke. Defaults to null when ChatKit should auto-select.

String id

Identifier of the requested tool.

JsonValue; object_ "chatkit.thread_item"constant"chatkit.thread_item"constant

Type discriminator that is always chatkit.thread_item.

String threadId

Identifier of the parent thread.

JsonValue; type "chatkit.user_message"constant"chatkit.user_message"constant
class ChatKitThreadAssistantMessageItem:

Assistant-authored message within a thread.

String id

Identifier of the thread item.

Ordered assistant response segments.

List<Annotation> annotations

Ordered list of annotations attached to the response text.

Accepts one of the following:
class File:

Annotation that references an uploaded file.

Source source

File attachment referenced by the annotation.

String filename

Filename referenced by the annotation.

JsonValue; type "file"constant"file"constant

Type discriminator that is always file.

JsonValue; type "file"constant"file"constant

Type discriminator that is always file for this annotation.

class Url:

Annotation that references a URL.

Source source

URL referenced by the annotation.

JsonValue; type "url"constant"url"constant

Type discriminator that is always url.

String url

URL referenced by the annotation.

JsonValue; type "url"constant"url"constant

Type discriminator that is always url for this annotation.

String text

Assistant generated text.

JsonValue; type "output_text"constant"output_text"constant

Type discriminator that is always output_text.

long createdAt

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

JsonValue; object_ "chatkit.thread_item"constant"chatkit.thread_item"constant

Type discriminator that is always chatkit.thread_item.

String threadId

Identifier of the parent thread.

JsonValue; type "chatkit.assistant_message"constant"chatkit.assistant_message"constant

Type discriminator that is always chatkit.assistant_message.

class ChatKitWidgetItem:

Thread item that renders a widget payload.

String id

Identifier of the thread item.

long createdAt

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

JsonValue; object_ "chatkit.thread_item"constant"chatkit.thread_item"constant

Type discriminator that is always chatkit.thread_item.

String threadId

Identifier of the parent thread.

JsonValue; type "chatkit.widget"constant"chatkit.widget"constant

Type discriminator that is always chatkit.widget.

String widget

Serialized widget payload rendered in the UI.

class ChatKitClientToolCall:

Record of a client side tool invocation initiated by the assistant.

String id

Identifier of the thread item.

String arguments

JSON-encoded arguments that were sent to the tool.

String callId

Identifier for the client tool call.

long createdAt

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

String name

Tool name that was invoked.

JsonValue; object_ "chatkit.thread_item"constant"chatkit.thread_item"constant

Type discriminator that is always chatkit.thread_item.

Optional<String> output

JSON-encoded output captured from the tool. Defaults to null while execution is in progress.

Status status

Execution status for the tool call.

Accepts one of the following:
IN_PROGRESS("in_progress")
COMPLETED("completed")
String threadId

Identifier of the parent thread.

JsonValue; type "chatkit.client_tool_call"constant"chatkit.client_tool_call"constant

Type discriminator that is always chatkit.client_tool_call.

class ChatKitTask:

Task emitted by the workflow to show progress and status updates.

String id

Identifier of the thread item.

long createdAt

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

Optional<String> heading

Optional heading for the task. Defaults to null when not provided.

JsonValue; object_ "chatkit.thread_item"constant"chatkit.thread_item"constant

Type discriminator that is always chatkit.thread_item.

Optional<String> summary

Optional summary that describes the task. Defaults to null when omitted.

TaskType taskType

Subtype for the task.

Accepts one of the following:
CUSTOM("custom")
THOUGHT("thought")
String threadId

Identifier of the parent thread.

JsonValue; type "chatkit.task"constant"chatkit.task"constant

Type discriminator that is always chatkit.task.

class ChatKitTaskGroup:

Collection of workflow tasks grouped together in the thread.

String id

Identifier of the thread item.

long createdAt

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

JsonValue; object_ "chatkit.thread_item"constant"chatkit.thread_item"constant

Type discriminator that is always chatkit.thread_item.

List<Task> tasks

Tasks included in the group.

Optional<String> heading

Optional heading for the grouped task. Defaults to null when not provided.

Optional<String> summary

Optional summary that describes the grouped task. Defaults to null when omitted.

Type type

Subtype for the grouped task.

Accepts one of the following:
CUSTOM("custom")
THOUGHT("thought")
String threadId

Identifier of the parent thread.

JsonValue; type "chatkit.task_group"constant"chatkit.task_group"constant

Type discriminator that is always chatkit.task_group.

List ChatKit thread items

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.beta.chatkit.threads.ThreadListItemsPage;
import com.openai.models.beta.chatkit.threads.ThreadListItemsParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        ThreadListItemsPage page = client.beta().chatkit().threads().listItems("cthr_123");
    }
}
{
  "data": [
    {
      "id": "cthi_user_001",
      "object": "chatkit.thread_item",
      "type": "user_message",
      "content": [
        {
          "type": "input_text",
          "text": "I need help debugging an onboarding issue."
        }
      ],
      "attachments": []
    },
    {
      "id": "cthi_assistant_002",
      "object": "chatkit.thread_item",
      "type": "assistant_message",
      "content": [
        {
          "type": "output_text",
          "text": "Let's start by confirming the workflow version you deployed."
        }
      ]
    }
  ],
  "has_more": false,
  "object": "list"
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "attachments": [
        {
          "id": "id",
          "mime_type": "mime_type",
          "name": "name",
          "preview_url": "preview_url",
          "type": "image"
        }
      ],
      "content": [
        {
          "text": "text",
          "type": "input_text"
        }
      ],
      "created_at": 0,
      "inference_options": {
        "model": "model",
        "tool_choice": {
          "id": "id"
        }
      },
      "object": "chatkit.thread_item",
      "thread_id": "thread_id",
      "type": "chatkit.user_message"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}