cURL
curl --request GET \ --url http://localhost:3000/api/messaging/sessions/{sessionId}/messages
{ "messages": [ { "id": "<string>", "content": "<string>", "authorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", "isAgent": true, "createdAt": "2023-11-07T05:31:56Z", "metadata": {} } ], "hasMore": true, "cursors": { "before": 123, "after": 123 } }
Retrieve messages from a conversation session with cursor-based pagination
Show Message Properties
Show Cursor Properties
// Get the most recent 20 messages const response = await fetch( '/api/messaging/sessions/abc-123/messages?limit=20' ); const { messages, hasMore, cursors } = await response.json();
ID of the session
Maximum number of messages to return
1 <= x <= 100
Get messages before this timestamp
Get messages after this timestamp
Messages retrieved successfully
Show child attributes
Whether there are more messages available
Pagination cursors for fetching additional messages
Use this timestamp to get older messages
Use this timestamp to get newer messages
Was this page helpful?