Skip to content

Get Chat History

GET
/api/chat/history

Get chat conversation history with optional filtering

Retrieves conversation history from SQLite persistence layer with support for filtering by thread_id and limiting result count.

Query Parameters:

  • thread_id: Optional thread identifier to filter (replaces conversation_id)
  • limit: Maximum number of messages to return (default: 50)

Returns:

  • messages: List of conversation messages
  • total: Total message count
  • conversation_id: Thread identifier if filtered

Use Case: Chat history display, conversation retrieval, context loading

thread_id
Any of:
string
<= 100 characters
limit
Limit
integer
default: 50 >= 1 <= 500

Successful Response

ChatHistoryResponse

Response for /api/chat/history endpoint - ULTRA-COMPLETE (50+ fields).

Provides chat conversation history with optional filtering by conversation ID.

object
messages
required
Messages

List of chat messages

Array<object>
ChatMessageInfo

Chat message information for history retrieval - ULTRA-COMPLETE (45+ fields)

object
id
required
Id

Message unique identifier

string
role
required
Role

Message role (user or assistant)

string
content
required
Content

Message content text

string
timestamp
required
Timestamp

Message creation timestamp

string format: date-time
agentUsed
Any of:
string
messageId
Any of:
string
threadId
Any of:
string
conversationId
Any of:
string
uuid
Any of:
string
modelUsed
Any of:
string
persona
Any of:
string
stance
Any of:
string
projectId
Any of:
string
isEdited
Any of:
boolean
isDeleted
Any of:
boolean
isPinned
Any of:
boolean
responseTimeMs
Any of:
number
tokensUsed
Any of:
integer
promptTokens
Any of:
integer
completionTokens
Any of:
integer
contextSources
Any of:
Array<object>
ContextSourceInfo

RAG context source information for chat responses.

Represents a single document or source used to provide context for AI responses through Retrieval-Augmented Generation (RAG). Includes relevance scoring and source metadata for attribution and transparency.

Fields: source: Document or source identifier score: Semantic similarity score (0.0-1.0, higher is more relevant) title: Human-readable source title content_preview: Preview snippet of relevant content document_type: Type of document (e.g., ‘lore’, ‘character’, ‘world’) collection: ChromaDB collection name

Used By: - ChatResponse.context_sources - EnhancedChatResponse.context_sources - ChatMessage.context_sources - ChatMessageInfo.context_sources

object
source
required
Source

Document or source identifier

string
score
required
Score

Semantic similarity score (0.0-1.0)

number
<= 1
title
Any of:
string
contentPreview
Any of:
string
documentType
Any of:
string
collection
Any of:
string
chunkIndex
Any of:
integer
metadata
Any of:
object
key
additional properties
string
ragEnabled
Any of:
boolean
qualityScore
Any of:
number
<= 100
relevanceScore
Any of:
number
<= 1
confidenceScore
Any of:
number
<= 1
parentMessageId
Any of:
string
previousMessageId
Any of:
string
nextMessageId
Any of:
string
createdAt
Any of:
string
modifiedAt
Any of:
string
editedAt
Any of:
string
userId
Any of:
string
sessionId
Any of:
string
requestId
Any of:
string
tags
Any of:
Array<string>
customMetadata
Any of:
CustomMetadataInfo

Custom metadata container for extensibility.

Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.

Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version

Used By: - Various models’ custom_metadata fields

object
tags
Any of:
Array<string>
labels
Any of:
object
key
additional properties
string
annotations
Any of:
object
key
additional properties
string
source
Any of:
string
version
Any of:
string
extra
Any of:
object
key
additional properties
string
thinkingSteps
Any of:
Array<string>
error
Any of:
string
warnings
Any of:
Array<string>
extra
Any of:
CustomMetadataInfo

Custom metadata container for extensibility.

Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.

Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version

Used By: - Various models’ custom_metadata fields

object
tags
Any of:
Array<string>
labels
Any of:
object
key
additional properties
string
annotations
Any of:
object
key
additional properties
string
source
Any of:
string
version
Any of:
string
extra
Any of:
object
key
additional properties
string
total
required
Total

Total number of messages

integer
conversationId
Any of:
string
message
required
Message

Status or informational message

string
status
Any of:
string
page
Any of:
integer
>= 1
pageSize
Any of:
integer
>= 1
totalPages
Any of:
integer
hasNext
Any of:
boolean
hasPrevious
Any of:
boolean
userMessageCount
Any of:
integer
assistantMessageCount
Any of:
integer
totalTokens
Any of:
integer
averageResponseTimeMs
Any of:
number
uniqueThreads
Any of:
integer
uniqueAgents
Any of:
integer
projectId
Any of:
string
projectName
Any of:
string
threadId
Any of:
string
filterRole
Any of:
string
filterAgent
Any of:
string
filterDateFrom
Any of:
string
filterDateTo
Any of:
string
searchQuery
Any of:
string
sortBy
Any of:
string
sortOrder
Any of:
string
queryDurationMs
Any of:
number
cacheHit
Any of:
boolean
cacheAgeSeconds
Any of:
number
requestId
Any of:
string
userId
Any of:
string
sessionId
Any of:
string
traceId
Any of:
string
correlationId
Any of:
string
apiVersion
Any of:
string
serverVersion
Any of:
string
clientVersion
Any of:
string
timestamp
Any of:
string
oldestMessageTimestamp
Any of:
string
newestMessageTimestamp
Any of:
string
errors
Any of:
Array<string>
warnings
Any of:
Array<string>
errorCount
Any of:
integer
warningCount
Any of:
integer
environment
Any of:
string
region
Any of:
string
customMetadata
Any of:
CustomMetadataInfo

Custom metadata container for extensibility.

Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.

Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version

Used By: - Various models’ custom_metadata fields

object
tags
Any of:
Array<string>
labels
Any of:
object
key
additional properties
string
annotations
Any of:
object
key
additional properties
string
source
Any of:
string
version
Any of:
string
extra
Any of:
object
key
additional properties
string
deprecationNotice
Any of:
string
migrationGuide
Any of:
string
extra
Any of:
CustomMetadataInfo

Custom metadata container for extensibility.

Provides a structured container for custom key-value metadata that doesn’t fit into predefined fields. Supports common metadata patterns.

Fields: tags: List of tags for categorization labels: Key-value labels annotations: Additional annotations source: Data source identifier version: Data version

Used By: - Various models’ custom_metadata fields

object
tags
Any of:
Array<string>
labels
Any of:
object
key
additional properties
string
annotations
Any of:
object
key
additional properties
string
source
Any of:
string
version
Any of:
string
extra
Any of:
object
key
additional properties
string

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object