Skip to main content

List Messages

This endpoint retrieves a list of messages within a specific chat session in TaskingAI.

Endpoint

  • Method: GET
  • URL: https://api.tasking.ai/v1/assistants/{assistant_id}/chats/{chat_id}/messages

Path Parameters

ParameterTypeDescription
assistant_idstringThe unique identifier for the assistant.
chat_idstringThe unique identifier for the chat.

Header Parameters

All TaskingAI API requests require the following headers:

HeaderTypeDescription
Content-TypestringThe content type of the request. Set to application/json.
AuthorizationstringAPI key for authorization in the format Bearer $TASKINGAI_API_KEY. The key can be obtained in the project settings in your TaskingAI console.

Query Parameters

ParameterTypeRequiredDefaultDescription
limitintegerNo20The maximum number of messages to retrieve.
orderstring or nullNodescDefines the sort order. Can accept values from asc or desc. The sort key is created_timestamp.
afterstring or nullNonullA cursor indicating to retrieve messages after a certain identifier.
beforestring or nullNonullA cursor indicating to retrieve messages before a certain identifier.

Response Example

{
"status": "success",
"data": [
{
"object": "Message",
"message_id": "message_1",
"chat_id": "chat_1",
"assistant_id": "assistant_1",
"role": "assistant",
"content": {"text": "The weather in New York is 75°F and sunny."},
"metadata": {},
"updated_timestamp": 1730210038453,
"created_timestamp": 1730210038453
},
{
"object": "Message",
"message_id": "message_1",
"chat_id": "chat_1",
"assistant_id": "assistant_1",
"role": "user",
"content": {"text": "What's the weather like today in New York?"},
"metadata": {},
"updated_timestamp": 1730210035453,
"created_timestamp": 1730210035453
},
...
],
"fetched_count": 20,
"has_more": true
}