Skip to main content

List Messages

Returns a list of messages for a given thread.

Path Parameters
thread_id Thread Id REQUIRED
Query Parameters
limit Limit
order Order3

Possible values: [asc, desc]

An enumeration.

after After
before Before
Responses
200

Successful Response

Schema OPTIONAL
object Object
data object[]
_id Id OPTIONAL

MongoDB document ObjectID

id Id

The identifier, which can be referenced in API endpoints.

object Object25

Possible values: [thread.message]

The object type, which is always thread.message.

created_at Created At

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

thread_id Thread Id

The thread ID that this message belongs to.

role Role7

Possible values: [user, assistant, tool_call, tool_output]

The entity that produced the message. One of user or assistant.

content undefined[]

The content of the message in array of text and/or images.

assistant_id Assistant Id

If applicable, the ID of the assistant that authored this message.

run_id Run Id

If applicable, the ID of the run associated with the authoring of this message.

file_ids string[]

A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message.

metadata object

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.

first_id First Id
last_id Last Id
has_more Has More
422

Validation Error

Schema OPTIONAL
detail object[] OPTIONAL
loc undefined[]
msg Message
type Error Type