Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

List ChatKit thread items

$ openai beta:chatkit:threads list-items
GET
/chatkit/threads/{thread_id}/items

List items that belong to a ChatKit thread.

List ChatKit thread items

openai beta:chatkit:threads list-items \
  --api-key 'My API Key' \
  --thread-id cthr_123
Response example
{
  "data": [
    {
      "id": "cthi_user_001",
      "object": "chatkit.thread_item",
      "type": "chatkit.user_message",
      "content": [
        {
          "type": "input_text",
          "text": "I need help debugging an onboarding issue."
        }
      ],
      "attachments": [],
      "created_at": 1712345600,
      "thread_id": "cthr_abc123",
      "inference_options": null
    },
    {
      "id": "cthi_assistant_002",
      "object": "chatkit.thread_item",
      "type": "chatkit.assistant_message",
      "content": [
        {
          "type": "output_text",
          "text": "Let's start by confirming the workflow version you deployed.",
          "annotations": []
        }
      ],
      "created_at": 1712345601,
      "thread_id": "cthr_abc123"
    }
  ],
  "has_more": false,
  "object": "list",
  "first_id": "cthi_user_001",
  "last_id": "cthi_assistant_002"
}
Parameters
--thread-id: string

Identifier of the ChatKit thread whose items are requested.

--after: optional string

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

--before: optional string

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

--limit: optional number

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

--order: optional "asc" or "desc"

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

Returns
chatkit_thread_item_list: object { data, first_id, has_more, 2 more }

A paginated list of thread items rendered for the ChatKit API.

data: array of ChatKitThreadUserMessageItem { id, attachments, content, 5 more } or ChatKitThreadAssistantMessageItem { id, content, created_at, 3 more } or ChatKitWidgetItem { id, created_at, object, 3 more } or 3 more

A list of items

first_id: string

The ID of the first item in the list.

has_more: boolean

Whether there are more items available.

last_id: string

The ID of the last item in the list.

object: "list"

The type of object returned, must be list.

Returns Examples
Response example
{
  "data": [
    {
      "id": "cthi_user_001",
      "object": "chatkit.thread_item",
      "type": "chatkit.user_message",
      "content": [
        {
          "type": "input_text",
          "text": "I need help debugging an onboarding issue."
        }
      ],
      "attachments": [],
      "created_at": 1712345600,
      "thread_id": "cthr_abc123",
      "inference_options": null
    },
    {
      "id": "cthi_assistant_002",
      "object": "chatkit.thread_item",
      "type": "chatkit.assistant_message",
      "content": [
        {
          "type": "output_text",
          "text": "Let's start by confirming the workflow version you deployed.",
          "annotations": []
        }
      ],
      "created_at": 1712345601,
      "thread_id": "cthr_abc123"
    }
  ],
  "has_more": false,
  "object": "list",
  "first_id": "cthi_user_001",
  "last_id": "cthi_assistant_002"
}