Skip to main content

Endpoint

GET /api/history

Overview

Retrieve the chat conversation history for a specific user and optional session.

Request

user_id
string
required
Unique identifier for the user
session_id
string
Optional session ID to filter by specific conversation
limit
integer
Maximum number of messages to return (default: 50, max: 100)
curl "http://localhost:18080/api/history?user_id=user_123&session_id=session_abc&limit=20"

Response

{
  "history": [
    {
      "role": "user",
      "content": "How many steps did I take yesterday?",
      "timestamp": "2024-01-15T10:30:00Z"
    },
    {
      "role": "assistant",
      "content": "Based on your Garmin data, you took 10,543 steps yesterday.",
      "timestamp": "2024-01-15T10:30:02Z"
    }
  ],
  "session_id": "session_abc",
  "total_messages": 2
}