curl --request GET \ --url https://api.example.com/api/v1/chats/{chat_id}/messages \ --header 'X-API-Key: <x-api-key>'
Copy
{ "messages": [ { "id": "msg-a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d", "content": "Hello, I need help with my account", "sender_role": "user", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:00Z", "metadata": { "user_agent": "Mozilla/5.0..." } }, { "id": "msg-b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "content": "I'd be happy to help you with your account! What specific issue are you experiencing?", "sender_role": "assistant", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:05Z", "metadata": { "model": "gpt-4", "tokens_used": 87 } }, { "id": "msg-c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "content": "I can't log into my account. It says my password is incorrect.", "sender_role": "user", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:30Z", "metadata": {} }, { "id": "msg-d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "content": "I understand you're having trouble logging in. Let me help you troubleshoot this issue. First, let's try resetting your password.", "sender_role": "assistant", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:35Z", "metadata": { "model": "gpt-4", "tokens_used": 124 } } ], "total": 15, "offset": 0, "limit": 50, "has_more": false}
Chats
Get Chat Messages
GET
/
api
/
v1
/
chats
/
{chat_id}
/
messages
Get Chat Messages
Copy
curl --request GET \ --url https://api.example.com/api/v1/chats/{chat_id}/messages \ --header 'X-API-Key: <x-api-key>'
Copy
{ "messages": [ { "id": "msg-a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d", "content": "Hello, I need help with my account", "sender_role": "user", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:00Z", "metadata": { "user_agent": "Mozilla/5.0..." } }, { "id": "msg-b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "content": "I'd be happy to help you with your account! What specific issue are you experiencing?", "sender_role": "assistant", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:05Z", "metadata": { "model": "gpt-4", "tokens_used": 87 } }, { "id": "msg-c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "content": "I can't log into my account. It says my password is incorrect.", "sender_role": "user", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:30Z", "metadata": {} }, { "id": "msg-d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "content": "I understand you're having trouble logging in. Let me help you troubleshoot this issue. First, let's try resetting your password.", "sender_role": "assistant", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:35Z", "metadata": { "model": "gpt-4", "tokens_used": 124 } } ], "total": 15, "offset": 0, "limit": 50, "has_more": false}
This endpoint retrieves paginated messages from a specific chat session. Messages are returned in chronological order and include both user and AI assistant messages.
{ "messages": [ { "id": "msg-a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d", "content": "Hello, I need help with my account", "sender_role": "user", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:00Z", "metadata": { "user_agent": "Mozilla/5.0..." } }, { "id": "msg-b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "content": "I'd be happy to help you with your account! What specific issue are you experiencing?", "sender_role": "assistant", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:05Z", "metadata": { "model": "gpt-4", "tokens_used": 87 } }, { "id": "msg-c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "content": "I can't log into my account. It says my password is incorrect.", "sender_role": "user", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:30Z", "metadata": {} }, { "id": "msg-d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "content": "I understand you're having trouble logging in. Let me help you troubleshoot this issue. First, let's try resetting your password.", "sender_role": "assistant", "media_type": null, "media_url": null, "created_at": "2024-01-15T10:30:35Z", "metadata": { "model": "gpt-4", "tokens_used": 124 } } ], "total": 15, "offset": 0, "limit": 50, "has_more": false}