Get Chat History
This endpoint is used to retrieve chat conversation history based on the X-SESSION-ID.
Endpoint
GET
https://api.raga.ziwardingai.xyz/v1/api/open-api/workspaces/:workspace_id/historyPath Parameter
| Parameter | Type | Description |
|---|---|---|
workspace_id | String | Your workspace ID in the RAGA system. Required in the URL path. |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | Integer | Optional. Page number for pagination. Default: 1 |
limit | Integer | Optional. Number of records per page. Default: 300, Maximum: 10,000 |
Headers
| Header | Type | Description |
|---|---|---|
Authorization | String | Required. Contains Bearer {app_key} for authentication. |
X-SESSION-ID | String | Required. Chat session ID used to retrieve conversation history. |
Description
- Ensure a valid
X-SESSION-IDis provided to retrieve chat history data. - Pagination can be controlled using the
pageandlimitquery parameters.
Example Request (cURL)
bash
curl --location 'https://api.raga.ziwardingai.xyz/v1/api/open-api/workspaces/123e4567-e89b-12d3-a456-426614174000/history?page=1&limit=10' \
--header 'X-SESSION-ID: f1e47f853c06ba8b25c86ff0cc28dab1' \
--header 'Authorization: Bearer YOUR_APP_KEY'Successful Response Example (HTTP 200)
json
{
"code": 200,
"data": {
"results": [
{
"session_id": "9cdad43a61aba0bddd69ff283fc3301f",
"workspace_id": "993e80fb-4a78-491b-9b5b-1cc8bb336afb",
"chat": "hello",
"like": false,
"dislike": false,
"id": "2f9ea87a-6408-4da4-9eed-139a2101b2ff",
"llm": "local_v2",
"response": "Hello! How can I assist you today?",
"knowledge_source_detail": [
{
"type": "basic",
"topic_id": [
"1685d466-ddbd-4150-9750-2b1a56aa5bdd"
]
}
],
"created_at": "2025-06-18T05:38:19.742Z",
"updated_at": "2025-06-18T05:38:19.742Z"
}
],
"total": 23,
"page": 1,
"limit": 300
}
}Response Fields
| Field | Type | Description |
|---|---|---|
code | Integer | HTTP status code of the response (200 on success). |
results | Array | List of chat history objects. Index 0 is the most recent chat. |
total | Integer | Total number of chat messages in the session. |
page | Integer | Current page number. |
limit | Integer | Number of records per page. |
Each item in results has the same structure as the Send Chat response:
| Field | Type | Description |
|---|---|---|
session_id | String | Chat session ID. |
workspace_id | String | Workspace ID. |
chat | String | User message content. |
like | Boolean | Indicates whether the user liked the response. |
dislike | Boolean | Indicates whether the user disliked the response. |
id | String | Unique chat message ID. |
llm | String | LLM model used. |
response | String | Chatbot response. |
knowledge_source_detail | Array | Knowledge sources used to generate the response. |
created_at | String | Timestamp when the record was created. |
updated_at | String | Timestamp when the record was last updated. |
API Responses
| Status Code | Description | Message |
|---|---|---|
| 200 | OK (Success) | Request successful, chat history returned. |
| 403 | Forbidden | Invalid app key or unauthorized access. |