Skip to main content
POST
/
user_memory
/
generate_user_memory
Generate User Memory
curl --request POST \
  --url https://api.usecortex.ai/user_memory/generate_user_memory \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "user_message": "I prefer detailed technical explanations and works in the Pacific timezone",
  "user_name": "John Doe"
}'
{
  "success": true,
  "generated_user_memories": [
    {
      "memory_id": "memory_1234",
      "memory_content": "User prefers detailed technical explanations and works in the Pacific timezone"
    },
    {
      "memory_id": "memory_4567",
      "memory_content": "User prefers dark mode"
    }
  ]
}
Hit the Try it button to try this API now in our playground. It’s the best way to check the full request and response in one place, customize your parameters, and generate ready-to-use code snippets.

Sample Request

curl --request POST \
  --url 'https://api.usecortex.ai/user_memory/generate_user_memory?tenant_id=tenant_1234&sub_tenant_id=sub_tenant_4567' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "user_message": "<string>",
  "user_name": "<string>"
}'

Overview

The Generate User Memory endpoint is the most sophisticated user memory endpoint that automatically creates and stores multiple user memories based on a user message. It combines AI-powered message processing, intelligent memory generation, and automatic storage to build a comprehensive memory network for each user.

What Makes This API Special?

This API goes beyond simple memory storage by:
  • AI-Powered Analysis: Uses advanced AI to analyze user messages and extract meaningful insights
  • Multiple Memory Generation: Creates several related memories from a single message
  • Automatic Storage: Stores all generated memories without requiring separate API calls
  • Memory Network Building: Creates interconnected memories that form a “second brain” for the user
  • Contextual Understanding: Generates memories that are contextually relevant and useful for future interactions

Functionality

  • Intelligent Message Processing: Analyzes user messages to understand intent and extract key information
  • Multi-Memory Generation: Creates multiple related memories from a single message
  • Automatic Vector Storage: Stores all generated memories in the vector database for semantic retrieval
  • User Context Integration: Incorporates user name and context for personalized memory generation
  • Tenant Isolation: Ensures all generated memories are properly isolated by tenant and sub-tenant
  • Automatic Provisioning: Provisions tenant/sub-tenant for user memory if not already set up

Use Cases

  • Conversation Analysis: Generate memories from user conversations or chat logs
  • Document Processing: Extract key insights from user-uploaded documents
  • Meeting Notes: Convert meeting transcripts into structured user memories
  • Feedback Processing: Transform user feedback into actionable memory insights
  • Learning Path Creation: Generate memories that help track user learning progress

Advanced Usage: Meeting Notes Processing

curl -X POST "https://api.cortex.com/user_memory/generate_user_memory" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "company_123",
    "sub_tenant_id": "product_team",
    "user_message": "In today's product meeting, Sarah mentioned she's concerned about user onboarding complexity. She suggested we implement a guided tutorial and reduce the number of required fields in the signup form. The team agreed to prioritize this for the next sprint.",
    "user_name": "Sarah Johnson"
  }'

Important Notes

Automatic Tenant Provisioning: If you receive an error stating “Tenant-id/sub-tenant-id combination either does not exist or is not provisioned for user memory”, this means the tenant/sub-tenant combination hasn’t been set up for user memory functionality yet. This will be automatically provisioned when you generate your first user memory for this combination.
Memory Quality: The quality of generated memories depends on the clarity and detail of the input message. Provide rich, contextual information for best results.
Best Practices:
  • Use detailed, contextual messages for better memory generation
  • Include relevant background information in your messages
  • Consider breaking complex topics into multiple focused messages
  • Review generated memories to ensure they capture the intended insights
  • Use this API for processing longer text inputs like documents or conversations
Pro Tip: This API is particularly powerful when processing user feedback, meeting notes, or any text that contains multiple insights about a user’s preferences, experiences, or context.

Error Responses

All endpoints return consistent error responses following the standard format. For detailed error information, see our Error Responses documentation.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

tenant_id
string
required

Unique identifier for the tenant/organization

Example:

"tenant_1234"

sub_tenant_id
string
default:""

Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.

Example:

"sub_tenant_4567"

Body

application/json

Request body containing the user query and context

user_message
string
required

Your query or context for AI memory generation

Example:

"I prefer detailed technical explanations and works in the Pacific timezone"

user_name
string
required

Your name to personalize the generated memories

Example:

"John Doe"

Response

Successful Response

Response model for AI-generated user memories.

success
boolean
required

Indicates whether the memory generation operation was successful

Example:

true

generated_user_memories
UserMemory · object[]

Array of AI-generated memories based on your query and user context

Example:
[
{
"memory_id": "memory_1234",
"memory_content": "User prefers detailed technical explanations and works in the Pacific timezone"
},
{
"memory_id": "memory_4567",
"memory_content": "User prefers dark mode"
}
]
I