List messages
Deprecated
GET/threads/{thread_id}/messages
Returns a list of messages for a given thread.
Path Parameters
thread_id: string
Query Parameters
after: optional string
A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
before: optional string
A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
limit: optional number
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
run_id: optional string
Filter messages by the run ID that generated them.
Returns
first_id: string
has_more: boolean
last_id: string
object: string
List messages
curl https://api.openai.com/v1/threads/$THREAD_ID/messages \
-H 'OpenAI-Beta: assistants=v2' \
-H "Authorization: Bearer $OPENAI_API_KEY"{
"data": [
{
"id": "id",
"assistant_id": "assistant_id",
"attachments": [
{
"file_id": "file_id",
"tools": [
{
"type": "code_interpreter"
}
]
}
],
"completed_at": 0,
"content": [
{
"image_file": {
"file_id": "file_id",
"detail": "auto"
},
"type": "image_file"
}
],
"created_at": 0,
"incomplete_at": 0,
"incomplete_details": {
"reason": "content_filter"
},
"metadata": {
"foo": "string"
},
"object": "thread.message",
"role": "user",
"run_id": "run_id",
"status": "in_progress",
"thread_id": "thread_id"
}
],
"first_id": "msg_abc123",
"has_more": false,
"last_id": "msg_abc123",
"object": "list"
}Returns Examples
{
"data": [
{
"id": "id",
"assistant_id": "assistant_id",
"attachments": [
{
"file_id": "file_id",
"tools": [
{
"type": "code_interpreter"
}
]
}
],
"completed_at": 0,
"content": [
{
"image_file": {
"file_id": "file_id",
"detail": "auto"
},
"type": "image_file"
}
],
"created_at": 0,
"incomplete_at": 0,
"incomplete_details": {
"reason": "content_filter"
},
"metadata": {
"foo": "string"
},
"object": "thread.message",
"role": "user",
"run_id": "run_id",
"status": "in_progress",
"thread_id": "thread_id"
}
],
"first_id": "msg_abc123",
"has_more": false,
"last_id": "msg_abc123",
"object": "list"
}