curl -X GET "https://agent.api.lyzr.app/v1/sessions/{session_id}/history" \
-H "x-api-key: your_api_key_here"
[
  {
    "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"
  }
]

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

session_id
string
required

The unique ID of the session.

Query String Parameters

unix
boolean

Optional, filter results by Unix timestamp if needed.

Curl
curl -X GET "https://agent.api.lyzr.app/v1/sessions/{session_id}/history" \
-H "x-api-key: your_api_key_here"
Python
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
string

Role of the participant (user or assistant).

content
string

The content of the message exchanged.

created_at
string

Timestamp of when the message was created.