API for managing memory, context, and retrieval for AI agents or apps with authentication and user-specific data.
API for managing memory, context, and retrieval for AI agents or apps 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.
Add a new memory item to the system with size validation and background processing.
Authentication Required: One of the following authentication methods must be used:
Authorization headerX-API-Key headerX-Session-Token headerRequired Headers:
Role-Based Memory Categories:
New Metadata Fields:
metadata.role: Optional field to specify who generated the memory (user or assistant)metadata.category: Optional field for memory categorization based on roleThe API validates content size against MAX_CONTENT_LENGTH environment variable (defaults to 15000 bytes).
Graph generation configuration. Defaults to auto mode with AI-selected schema.
Graph generation configuration. Defaults to auto mode with AI-selected schema.
The content of the memory item you want to add to memory
Memory item type; defaults to 'text' if omitted
Metadata used in Neo4J and Pinecone for a memory item. Include role and category here.
Metadata used in Neo4J and Pinecone for a memory item. Include role and category here.
Context can be conversation history or any relevant context for a memory item
Context can be conversation history or any relevant context for a memory item
Array of relationships that we can use in Graph DB (neo4J)
Array of relationships that we can use in Graph DB (neo4J)
Optional organization ID for multi-tenant memory scoping. When provided, memory is associated with this organization.
Optional organization ID for multi-tenant memory scoping. When provided, memory is associated with this organization.
Optional organization ID for multi-tenant memory scoping. When provided, memory is associated with this organization.
Optional namespace ID for multi-tenant memory scoping. When provided, memory is associated with this namespace.
Optional namespace ID for multi-tenant memory scoping. When provided, memory is associated with this namespace.
Optional namespace ID for multi-tenant memory scoping. When provided, memory is associated with this namespace.
curl -i -X POST \
'http://memory.papr.ai/v1/memory?skip_background_processing=false' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY_HERE' \
-d '{
"content": "Meeting with John Smith from Acme Corp about the Q4 project timeline",
"context": [
{
"content": "Let'\''s discuss the Q4 project timeline with John",
"role": "user"
},
{
"content": "I'\''ll help you prepare for the timeline discussion. What are your key milestones?",
"role": "assistant"
}
],
"graph_override": {
"nodes": [
{
"id": "person_john_smith",
"label": "Person",
"properties": {
"name": "John Smith",
"role": "Project Manager",
"description": "Senior PM at Acme Corp"
}
},
{
"id": "company_acme_corp",
"label": "Company",
"properties": {
"name": "Acme Corp",
"description": "Client company for Q4 project"
}
}
],
"relationships": [
{
"properties": {
"role": "Project Manager"
},
"relationship_type": "WORKS_FOR",
"source_node_id": "person_john_smith",
"target_node_id": "company_acme_corp"
}
]
},
"metadata": {
"conversationId": "conv-123",
"createdAt": "2024-10-04T10:00:00Z",
"emoji_tags": "📅,👥,📋",
"emotion_tags": "focused, productive",
"external_user_id": "external_user_123",
"external_user_read_access": [
"external_user_123",
"external_user_789"
],
"external_user_write_access": [
"external_user_123"
],
"hierarchical_structures": "Business/Meetings/Project Planning",
"location": "Conference Room A",
"sourceUrl": "https://calendar.example.com/meeting/123",
"topics": [
"product",
"planning"
]
},
"type": "text"
}'{ "code": 200, "status": "success", "data": [ { … } ] }
Update an existing memory item by ID.
Authentication Required: One of the following authentication methods must be used:
Authorization headerX-API-Key headerX-Session-Token headerRequired Headers:
The API validates content size against MAX_CONTENT_LENGTH environment variable (defaults to 15000 bytes).
The new content of the memory item
The new content of the memory item
The new content of the memory item
Content type of the memory item
Content type of the memory item
Content type of the memory item
Updated metadata for Neo4J and Pinecone
Updated metadata for Neo4J and Pinecone
Updated context for the memory item
Updated context for the memory item
Updated relationships for Graph DB (neo4J)
Updated relationships for Graph DB (neo4J)
Optional organization ID for multi-tenant memory scoping. When provided, update is scoped to memories within this organization.
Optional organization ID for multi-tenant memory scoping. When provided, update is scoped to memories within this organization.
Optional organization ID for multi-tenant memory scoping. When provided, update is scoped to memories within this organization.
Optional namespace ID for multi-tenant memory scoping. When provided, update is scoped to memories within this namespace.
Optional namespace ID for multi-tenant memory scoping. When provided, update is scoped to memories within this namespace.
Optional namespace ID for multi-tenant memory scoping. When provided, update is scoped to memories within this namespace.
curl -i -X PUT \
'http://memory.papr.ai/v1/memory/{memory_id}' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY_HERE' \
-d '{
"content": "Updated meeting notes from the product planning session",
"context": [
{
"content": "Let'\''s update the Q2 product roadmap",
"role": "user"
},
{
"content": "I'\''ll help you update the roadmap. What changes would you like to make?",
"role": "assistant"
}
],
"metadata": {
"emoji tags": "📊,💡,📝,✨",
"emotion tags": "focused, productive, satisfied",
"hierarchical structures": "Business/Planning/Product/Updates",
"topics": "product, planning, updates"
},
"relationships_json": [
{
"metadata": {
"relevance": "high"
},
"related_item_id": "previous_memory_item_id",
"related_item_type": "TextMemoryItem",
"relation_type": "updates"
}
],
"type": "text"
}'Memory successfully updated
List of updated memory items if successful
List of updated memory items if successful
Error message if failed
Error message if failed
Error message if failed
Additional error details or context
Additional error details or context
Additional error details or context
Status message
Status message
Status message
{ "code": 200, "status": "success", "memory_items": [ { … } ], "error": "string", "details": {}, "message": "string", "status_obj": { "pinecone": false, "neo4j": false, "parse": false } }
curl -i -X DELETE \
'http://memory.papr.ai/v1/memory/{memory_id}?skip_parse=false' \
-H 'X-API-Key: YOUR_API_KEY_HERE'{ "code": 200, "status": "success", "message": "string", "error": "string", "memoryId": "", "objectId": "", "deletion_status": { "pinecone": false, "neo4j": false, "parse": false, "qdrant": false }, "details": {} }
curl -i -X GET \
'http://memory.papr.ai/v1/memory/{memory_id}' \
-H 'X-API-Key: YOUR_API_KEY_HERE'Memory successfully retrieved
Search results if successful
Search results if successful
Error message if failed
Error message if failed
Error message if failed
Additional error details or context
Additional error details or context
Additional error details or context
Unique identifier for this search query, maps to QueryLog objectId in Parse Server
Unique identifier for this search query, maps to QueryLog objectId in Parse Server
Unique identifier for this search query, maps to QueryLog objectId in Parse Server
{ "code": 200, "data": { "memories": [], "nodes": [] }, "search_id": "abc123def456", "status": "success" }
Add multiple memory items in a batch with size validation and background processing.
Authentication Required: One of the following authentication methods must be used:
Authorization headerX-API-Key headerX-Session-Token headerRequired Headers:
The API validates individual memory content size against MAX_CONTENT_LENGTH environment variable (defaults to 15000 bytes).
Graph generation configuration. Defaults to auto mode with AI-selected schema.
Graph generation configuration. Defaults to auto mode with AI-selected schema.
Internal user ID for all memories in the batch. If not provided, developer's user ID will be used.
Internal user ID for all memories in the batch. If not provided, developer's user ID will be used.
Internal user ID for all memories in the batch. If not provided, developer's user ID will be used.
External user ID for all memories in the batch. If provided and user_id is not, will be resolved to internal user ID.
External user ID for all memories in the batch. If provided and user_id is not, will be resolved to internal user ID.
External user ID for all memories in the batch. If provided and user_id is not, will be resolved to internal user ID.
Optional organization ID for multi-tenant batch memory scoping. When provided, all memories in the batch are associated with this organization.
Optional organization ID for multi-tenant batch memory scoping. When provided, all memories in the batch are associated with this organization.
Optional organization ID for multi-tenant batch memory scoping. When provided, all memories in the batch are associated with this organization.
Optional namespace ID for multi-tenant batch memory scoping. When provided, all memories in the batch are associated with this namespace.
Optional namespace ID for multi-tenant batch memory scoping. When provided, all memories in the batch are associated with this namespace.
Optional namespace ID for multi-tenant batch memory scoping. When provided, all memories in the batch are associated with this namespace.
List of memory items to add in batch
Graph generation configuration. Defaults to auto mode with AI-selected schema.
Graph generation configuration. Defaults to auto mode with AI-selected schema.
The content of the memory item you want to add to memory
Memory item type; defaults to 'text' if omitted
Metadata used in Neo4J and Pinecone for a memory item. Include role and category here.
Metadata used in Neo4J and Pinecone for a memory item. Include role and category here.
Context can be conversation history or any relevant context for a memory item
Context can be conversation history or any relevant context for a memory item
Array of relationships that we can use in Graph DB (neo4J)
Array of relationships that we can use in Graph DB (neo4J)
Optional organization ID for multi-tenant memory scoping. When provided, memory is associated with this organization.
Optional organization ID for multi-tenant memory scoping. When provided, memory is associated with this organization.
Optional organization ID for multi-tenant memory scoping. When provided, memory is associated with this organization.
Optional namespace ID for multi-tenant memory scoping. When provided, memory is associated with this namespace.
Optional namespace ID for multi-tenant memory scoping. When provided, memory is associated with this namespace.
Optional namespace ID for multi-tenant memory scoping. When provided, memory is associated with this namespace.
Number of items to process in parallel
Number of items to process in parallel
Number of items to process in parallel
Optional webhook URL to notify when batch processing is complete. The webhook will receive a POST request with batch completion details.
Optional webhook URL to notify when batch processing is complete. The webhook will receive a POST request with batch completion details.
Optional webhook URL to notify when batch processing is complete. The webhook will receive a POST request with batch completion details.
Optional secret key for webhook authentication. If provided, will be included in the webhook request headers as 'X-Webhook-Secret'.
Optional secret key for webhook authentication. If provided, will be included in the webhook request headers as 'X-Webhook-Secret'.
Optional secret key for webhook authentication. If provided, will be included in the webhook request headers as 'X-Webhook-Secret'.
curl -i -X POST \
'http://memory.papr.ai/v1/memory/batch?skip_background_processing=false' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY_HERE' \
-d '{
"batch_size": 10,
"external_user_id": "external_user_abcde",
"memories": [
{
"content": "Meeting notes from the product planning session",
"metadata": {
"createdAt": "2024-03-21T10:00:00Z",
"emoji tags": "📊,💡,📝",
"emotion tags": "focused, productive",
"hierarchical structures": "Business/Planning/Product",
"topics": "product, planning"
},
"type": "text"
},
{
"content": "Follow-up tasks from the planning meeting",
"metadata": {
"createdAt": "2024-03-21T11:00:00Z",
"emoji tags": "✅,📋",
"emotion tags": "organized",
"hierarchical structures": "Business/Tasks/Planning",
"topics": "tasks, planning"
},
"type": "text"
}
],
"user_id": "internal_user_id_12345"
}'Memories successfully added
Human-readable status message
Human-readable status message
Human-readable status message
Batch-level error message, if any
Batch-level error message, if any
Batch-level error message, if any
Additional error details or context
Additional error details or context
Additional error details or context
{ "code": 200, "status": "success", "message": "string", "error": "string", "details": {}, "successful": [ { … } ], "errors": [ { … } ], "total_processed": 0, "total_successful": 0, "total_failed": 0, "total_content_size": 0, "total_storage_size": 0 }
Delete all memory items for a user.
Authentication Required: One of the following authentication methods must be used:
Authorization headerX-API-Key headerX-Session-Token headerUser Resolution:
Required Headers:
WARNING: This operation cannot be undone. All memories for the resolved user will be permanently deleted.
Optional user ID to delete memories for (if not provided, uses authenticated user)
Optional user ID to delete memories for (if not provided, uses authenticated user)
Optional user ID to delete memories for (if not provided, uses authenticated user)
Optional external user ID to resolve and delete memories for
Optional external user ID to resolve and delete memories for
Optional external user ID to resolve and delete memories for
curl -i -X DELETE \
'http://memory.papr.ai/v1/memory/all?external_user_id=string&skip_parse=false&user_id=string' \
-H 'X-API-Key: YOUR_API_KEY_HERE'All memories successfully deleted
Human-readable status message
Human-readable status message
Human-readable status message
Batch-level error message, if any
Batch-level error message, if any
Batch-level error message, if any
Additional error details or context
Additional error details or context
Additional error details or context
{ "code": 200, "status": "success", "message": "string", "error": "string", "details": {}, "successful": [ { … } ], "errors": [ { … } ], "total_processed": 0, "total_successful": 0, "total_failed": 0, "total_content_size": 0, "total_storage_size": 0 }
Search through memories with authentication required.
Authentication Required: One of the following authentication methods must be used:
Authorization headerX-API-Key headerX-Session-Token headerCustom Schema Support: This endpoint supports both system-defined and custom user-defined node types:
When custom schema nodes are returned:
schema_id field referencing the UserGraphSchemaschemas_used array listing all schema IDs usedGET /v1/schemas/{schema_id} to retrieve full schema definitions including:Recommended Headers:
Accept-Encoding: gzipThe API supports response compression for improved performance. Responses larger than 1KB will be automatically compressed when this header is present.
HIGHLY RECOMMENDED SETTINGS FOR BEST RESULTS:
enable_agentic_graph: true for intelligent, context-aware search that can understand ambiguous referencesmax_memories: 15-20 for comprehensive memory coveragemax_nodes: 10-15 for comprehensive graph entity relationshipsAgentic Graph Benefits: When enabled, the system can understand vague references by first identifying specific entities from your memory graph, then performing targeted searches. For example:
Role-Based Memory Filtering: Filter memories by role and category using metadata fields:
metadata.role: Filter by "user" or "assistant"metadata.category: Filter by category (user: preference, task, goal, facts, context | assistant: skills, learning)User Resolution Precedence:
HIGHLY RECOMMENDED: Maximum number of memories to return. Use at least 15-20 for comprehensive results. Lower values (5-10) may miss relevant information. Default is 20 for optimal coverage.
Detailed search query describing what you're looking for. For best results, write 2-3 sentences that include specific details, context, and time frame. Examples: 'Find recurring customer complaints about API performance from the last month. Focus on issues where customers specifically mentioned timeout errors or slow response times in their conversations.' 'What are the main issues and blockers in my current projects? Focus on technical challenges and timeline impacts.' 'Find insights about team collaboration and communication patterns from recent meetings and discussions.'
Whether to enable additional ranking of search results. Default is false because results are already ranked when using an LLM for search (recommended approach). Only enable this if you're not using an LLM in your search pipeline and need additional result ranking.
HIGHLY RECOMMENDED: Enable agentic graph search for intelligent, context-aware results. When enabled, the system can understand ambiguous references by first identifying specific entities from your memory graph, then performing targeted searches. Examples: 'customer feedback' → identifies your customers first, then finds their specific feedback; 'project issues' → identifies your projects first, then finds related issues; 'team meeting notes' → identifies team members first, then finds meeting notes. This provides much more relevant and comprehensive results. Set to false only if you need faster, simpler keyword-based search.
Optional internal user ID to filter search results by a specific user. If not provided, results are not filtered by user. If both user_id and external_user_id are provided, user_id takes precedence.
Optional internal user ID to filter search results by a specific user. If not provided, results are not filtered by user. If both user_id and external_user_id are provided, user_id takes precedence.
Optional internal user ID to filter search results by a specific user. If not provided, results are not filtered by user. If both user_id and external_user_id are provided, user_id takes precedence.
Optional external user ID to filter search results by a specific external user. If both user_id and external_user_id are provided, user_id takes precedence.
Optional external user ID to filter search results by a specific external user. If both user_id and external_user_id are provided, user_id takes precedence.
Optional external user ID to filter search results by a specific external user. If both user_id and external_user_id are provided, user_id takes precedence.
Optional organization ID for multi-tenant search scoping. When provided, search is scoped to memories within this organization.
Optional organization ID for multi-tenant search scoping. When provided, search is scoped to memories within this organization.
Optional organization ID for multi-tenant search scoping. When provided, search is scoped to memories within this organization.
Optional namespace ID for multi-tenant search scoping. When provided, search is scoped to memories within this namespace.
Optional namespace ID for multi-tenant search scoping. When provided, search is scoped to memories within this namespace.
Optional namespace ID for multi-tenant search scoping. When provided, search is scoped to memories within this namespace.
Optional user-defined schema ID to use for this search. If provided, this schema (plus system schema) will be used for query generation. If not provided, system will automatically select relevant schema based on query content.
Optional user-defined schema ID to use for this search. If provided, this schema (plus system schema) will be used for query generation. If not provided, system will automatically select relevant schema based on query content.
Optional user-defined schema ID to use for this search. If provided, this schema (plus system schema) will be used for query generation. If not provided, system will automatically select relevant schema based on query content.
If true, uses simple schema mode: system schema + ONE most relevant user schema. This ensures better consistency between add/search operations and reduces query complexity. Recommended for production use.
Optional metadata filter. Any field in MemoryMetadata (including custom fields) can be used for filtering.
Optional metadata filter. Any field in MemoryMetadata (including custom fields) can be used for filtering.
OPTIONAL: Override automatic search query generation with your own exact graph pattern and filters. ⚡ AUTOMATIC BY DEFAULT: If not provided, the system automatically generates optimized Cypher queries using AI - no action required! 🎯 USE WHEN: You want precise control over search patterns, have specific graph traversals in mind, or want to bypass AI query generation for performance. 📋 VALIDATION: All patterns and filters must comply with your schema definitions.
OPTIONAL: Override automatic search query generation with your own exact graph pattern and filters. ⚡ AUTOMATIC BY DEFAULT: If not provided, the system automatically generates optimized Cypher queries using AI - no action required! 🎯 USE WHEN: You want precise control over search patterns, have specific graph traversals in mind, or want to bypass AI query generation for performance. 📋 VALIDATION: All patterns and filters must comply with your schema definitions.
curl -i -X POST \
'http://memory.papr.ai/v1/memory/search?max_memories=20&max_nodes=15' \
-H 'Accept-Encoding: gzip' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY_HERE' \
-d '{
"enable_agentic_graph": false,
"external_user_id": "external_user_123",
"query": "Find recurring customer complaints about API performance from the last month. Focus on issues that multiple customers have mentioned and any specific feature requests or workflow improvements they'\''ve suggested.",
"rank_results": true
}'Successfully retrieved memories
Search results if successful
Search results if successful
Error message if failed
Error message if failed
Error message if failed
Additional error details or context
Additional error details or context
Additional error details or context
Unique identifier for this search query, maps to QueryLog objectId in Parse Server
Unique identifier for this search query, maps to QueryLog objectId in Parse Server
Unique identifier for this search query, maps to QueryLog objectId in Parse Server
Standard response when only system-defined node types are found
{ "code": 200, "status": "success", "data": { "memories": [ … ], "nodes": [ … ] }, "search_id": "search-789" }