Endpoint: GET /v1/sessions/{session_id}/history
Retrieve the chat history for a specific session. This endpoint provides details on all interactions between the user and the assistant during the session.
Path Parameters
The unique ID of the session.
Query String Parameters
Optional, filter results by Unix timestamp if needed.
curl -X GET "https://agent.api.lyzr.app/v1/sessions/{session_id}/history" \
-H "x-api-key: your_api_key_here"
import requests
session_id = "IITZ"
url = f"https://agent.api.lyzr.app/v1/sessions/{session_id}/history"
headers = {
"x-api-key": "your_api_key_here"
}
response = requests.get(url, headers=headers)
[
{
"role": "user",
"content": "want to buy property between $400000 to $700000 in new jearsey.",
"created_at": "2024-08-30T09:41:44.355000"
},
{
"role": "assistant",
"content": "Based on your budget of $400,000 to $700,000.",
"created_at": "2024-08-30T09:41:44.357000"
}
]
Response Parameters
Role of the participant (user
or assistant
).
The content of the message exchanged.
Timestamp of when the message was created.