GET
/
v2
/
threads
/
{threadId}
/
messages

This endpoint allows you to retrieve a list of messages for a specific thread. Messages are an essential part of the thread, representing the conversation history between the user and the AI assistant.

Pagination

This endpoint supports pagination in the same way as the Threads API. It uses the limit parameter to specify the maximum number of messages per request, and the after parameter as a cursor for pagination. The response includes a has_more parameter to indicate if more results are available.

For detailed information on how pagination works, refer to the Threads API documentation.

Headers

X-API-Key
string
required

Your Langtail API Key

Path Parameters

threadId
string
required

The ID of the thread to retrieve messages from.

Query Parameters

limit
number | null

The maximum number of threads to return. Default is 100.

after
string | null

A cursor for use in pagination. 'after' is a thread ID that defines your place in the list. For instance, if you make a list request and receive 100 threads, ending with thread 'xyz', your subsequent call can include after='xyz' in order to fetch the next page of the list. Pagination works the same as in the OpenAI API https://platform.openai.com/docs/api-reference/assistants/listAssistants.

Response

200 - application/json
data
object[]
required
has_more
boolean
required

Whether there are more threads available after this batch.

object
enum<string>

The object type, which is always 'list' for a list of messages.

Available options:
list
first_id
string | null

The ID of the first thread in the list, or null if the list is empty.

last_id
string | null

The ID of the last thread in the list, or null if the list is empty.