API for managing personal memory items with authentication and user-specific data.
API for managing personal memory items with authentication and user-specific data.
This API supports three authentication methods:
X-API-Key headerX-API-Key: <your-api-key>X-Session-Token headerX-Session-Token: <your-session-token>Authorization headerAuthorization: Bearer <token>All endpoints require one of these authentication methods.
Store a chat message and queue it for AI analysis and memory creation.
Authentication Required: Bearer token, API key, or session token
Processing Control:
process_messages: true (default) to enable full AI analysis and memory creationprocess_messages: false to store messages only without processing into memoriesProcessing Flow (when process_messages=true):
Role-Based Categories:
Session Management:
sessionId is required to group related messagessessionId for an entire conversationtitle: Set a human-readable title for the conversation (e.g., "Q4 Planning Session")The content of the chat message - can be a simple string or structured content objects
The content of the chat message - can be a simple string or structured content objects
The content of the chat message - can be a simple string or structured content objects
Optional title for the conversation session. Sets the Chat.title in Parse Server for easy identification.
Optional title for the conversation session. Sets the Chat.title in Parse Server for easy identification.
Optional title for the conversation session. Sets the Chat.title in Parse Server for easy identification.
Optional metadata for the message (topics, location, etc.)
Optional metadata for the message (topics, location, etc.)
Optional context for the message (conversation history or relevant context)
Optional context for the message (conversation history or relevant context)
Optional array of relationships for Graph DB (Neo4j)
Optional array of relationships for Graph DB (Neo4j)
Whether to process messages into memories (true) or just store them (false). Default is true.
Unified policy for graph generation and OMO safety. Use mode='auto' (LLM extraction), 'manual' (exact nodes), or 'hybrid' (LLM with constraints). Includes consent, risk, and ACL settings.
Unified policy for graph generation and OMO safety. Use mode='auto' (LLM extraction), 'manual' (exact nodes), or 'hybrid' (LLM with constraints). Includes consent, risk, and ACL settings.
Optional organization ID for multi-tenant message scoping
Optional organization ID for multi-tenant message scoping
Optional organization ID for multi-tenant message scoping
Optional namespace ID for multi-tenant message scoping
Optional namespace ID for multi-tenant message scoping
Optional namespace ID for multi-tenant message scoping
curl -i -X POST \
http://memory.papr.ai/v1/messages \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY_HERE' \
-d '{
"content": "Can you help me plan the Q4 product roadmap?",
"metadata": {
"location": "Office",
"topics": [
"product",
"planning",
"roadmap"
]
},
"process_messages": true,
"role": "user",
"sessionId": "session_123",
"title": "Q4 Product Planning"
}'Message stored and queued for processing
Content of the message - can be a simple string or structured content objects
Content of the message - can be a simple string or structured content objects
Content of the message - can be a simple string or structured content objects
When the message was created
{ "content": "Can you help me plan the Q4 product roadmap?", "createdAt": "2024-01-15T10:30:00Z", "objectId": "msg_abc123", "processing_status": "queued", "role": "user", "sessionId": "session_123" }
Retrieve message history for a specific conversation session.
Authentication Required: Bearer token, API key, or session token
Pagination:
limit and skip parameters for paginationtotal_count indicates total messages in the sessionSummaries (if available):
context_for_llm field with pre-compressed context/sessions/{session_id}/compress endpoint to retrieve on-demandAccess Control:
curl -i -X GET \
'http://memory.papr.ai/v1/messages/sessions/{session_id}?limit=50&skip=0' \
-H 'X-API-Key: YOUR_API_KEY_HERE'Message history retrieved
List of messages in chronological order
Parse Server objectId of the stored message
Role of the message sender
Content of the message - can be a simple string or structured content objects
Content of the message - can be a simple string or structured content objects
Content of the message - can be a simple string or structured content objects
When the message was created
Hierarchical conversation summaries for context compression
Hierarchical conversation summaries for context compression
Pre-formatted compressed context ready for LLM consumption (summaries + recent messages)
Pre-formatted compressed context ready for LLM consumption (summaries + recent messages)
Pre-formatted compressed context ready for LLM consumption (summaries + recent messages)
{ "context_for_llm": "FULL SESSION: Product planning and strategy conversation\nRECENT (last ~100): Ongoing product planning discussion for Q4\nCURRENT (last 15): User requested help planning Q4 product roadmap", "messages": [ { … }, { … } ], "sessionId": "session_123", "summaries": { "long_term": "Product planning and strategy conversation", "medium_term": "Ongoing product planning discussion for Q4", "short_term": "User requested help planning Q4 product roadmap", "topics": [ … ] }, "total_count": 2 }
Update session properties (e.g., title, metadata).
Authentication Required: Bearer token, API key, or session token
Updatable Fields:
title: Update the conversation titlemetadata: Update session metadata (merged with existing)Example Request:
{
"title": "Updated Session Title",
"metadata": {"custom_field": "value"}
}New title for the session
New title for the session
New title for the session
curl -i -X PATCH \
'http://memory.papr.ai/v1/messages/sessions/{session_id}' \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"title": "string",
"metadata": {}
}'curl -i -X GET \
'http://memory.papr.ai/v1/messages/sessions/{session_id}/status' \
-H 'Authorization: Bearer <YOUR_JWT_HERE>'Get compressed conversation context for a session.
Compress your conversation into hierarchical summaries with rich metadata, perfect for reducing token usage in LLM context windows.
Authentication Required: Bearer token, API key, or session token
What it returns:
Perfect for:
Input: Just the session ID - all context is extracted automatically
curl -i -X GET \
'http://memory.papr.ai/v1/messages/sessions/{session_id}/compress' \
-H 'Authorization: Bearer <YOUR_JWT_HERE>'Session summary (compressed context)
Hierarchical conversation summaries
Summary of last 15 messages
Summary of last 15 messages
Summary of last 15 messages
Summary of last ~100 messages
Summary of last ~100 messages
Summary of last ~100 messages
Full session summary
Full session summary
Full session summary
Key topics discussed
Instructions for AI agents on how to search for more details about this conversation
Whether summaries were retrieved from cache (true) or just generated (false)
{ "ai_agent_note": "To find more details about this conversation, search memories with metadata filter: sessionId='session_123'", "from_cache": true, "session_id": "session_123", "summaries": { "last_updated": "2024-01-15T10:31:00Z", "long_term": "Product planning and strategy conversation focused on Q4 roadmap development and execution.", "medium_term": "Ongoing product planning discussion for Q4, covering objectives, timelines, and resource allocation.", "short_term": "User requested help planning Q4 product roadmap. Assistant offered to help identify key objectives.", "topics": [ … ] } }
Process all stored messages in a session that were previously stored with process_messages=false.
Authentication Required: Bearer token, API key, or session token
This endpoint allows you to retroactively process messages that were initially stored without processing. Useful for:
Processing Behavior:
curl -i -X POST \
'http://memory.papr.ai/v1/messages/sessions/{session_id}/process' \
-H 'Authorization: Bearer <YOUR_JWT_HERE>'