List ChatKit thread items
client.beta.chatkit.threads.listItems(stringthreadID , ThreadListItemsParams { after, before, limit, order } query ?, RequestOptionsoptions ?): ConversationCursorPage<ChatKitThreadUserMessageItem { id, attachments, content, 5 more } | ChatKitThreadAssistantMessageItem { id, content, created_at, 3 more } | ChatKitWidgetItem { id, created_at, object, 3 more } | 3 more>
GET
/chatkit/threads/{thread_id}/itemsList ChatKit thread items
import OpenAI from 'openai';
const client = new OpenAI();
// Automatically fetches more pages as needed.
for await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {
console.log(thread);
}
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"
}
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"
}