Overview

The Get Memory API retrieves the most recent thread memory summary for a specified external user. This endpoint provides access to conversation context and summaries that have been stored by Melodi’s intelligence system.

Authentication

This endpoint requires a Private API Key. The API key can be passed as a header or query parameter:
  • Header: Authorization: Bearer YOUR_API_KEY
  • Query Parameter: ?apiKey=YOUR_API_KEY
For more information about API authentication, see API Access.

Request Parameters

Query Parameters

ParameterTypeRequiredDescription
userExternalIdstringYesThe external identifier for the user whose memory should be retrieved

Response

Success Response (200)

The API returns the memory summary from the most recent thread for the specified user.
{
  "userExternalId": "string",
  "threadId": "number",
  "threadExternalId": "string | null", 
  "summary": "string",
  "createdAt": "string"
}
Response Fields:
  • userExternalId - The external identifier for the user
  • threadId - Internal thread identifier (number)
  • threadExternalId - External thread identifier (can be null if not provided when thread was created)
  • summary - The AI-generated memory summary content from the most recent thread
  • createdAt - ISO 8601 timestamp when the thread was created

Error Responses

Status CodeDescriptionResponse Body
400Missing required parameter{"error": "Missing required parameter: userExternalId"}
401Invalid or missing API key{"error": "Unauthorized - Invalid or missing API key"}
404User not found or no memory available{"error": "No user or no memory found"}

Usage Examples

cURL

curl -X GET "https://app.melodi.fyi/api/external/memory?userExternalId=user-123" \
  -H "Authorization: Bearer YOUR_PRIVATE_API_KEY" \
  -H "Content-Type: application/json"

Python

import requests

url = "https://app.melodi.fyi/api/external/memory"
headers = {
    "Authorization": "Bearer YOUR_PRIVATE_API_KEY",
    "Content-Type": "application/json"
}
params = {
    "userExternalId": "user-123"
}

response = requests.get(url, headers=headers, params=params)
memory_data = response.json()

TypeScript/JavaScript

const response = await fetch(
  "https://app.melodi.fyi/api/external/memory?userExternalId=user-123",
  {
    method: "GET",
    headers: {
      "Authorization": "Bearer YOUR_PRIVATE_API_KEY",
      "Content-Type": "application/json",
    },
  }
);

const memoryData = await response.json();

Example Response

{
  "userExternalId": "user-123",
  "threadId": 456,
  "threadExternalId": "thread-external-789",
  "summary": "User discussed implementing a new authentication system for their web application. They're particularly interested in OAuth integration and session management best practices. Previous conversation covered JWT token implementation and security considerations.",
  "createdAt": "2024-01-15T10:30:45.123Z"
}

Use Cases

  • Context Retrieval: Get conversation context when a user returns to continue a previous conversation
  • Personalization: Use memory summaries to personalize user experiences
  • Integration: Incorporate user memory into external systems or applications
  • Analysis: Access stored conversation context for analysis or reporting
  • Create Thread - Create new threads that generate memory summaries
  • Get Threads - Retrieve multiple threads for a user
  • Create User - Create users who can have memory summaries