Skip to main content
POST
/
api
/
chat-history
/
inject
Recall chat history
curl --request POST \
  --url https://www.memoryplugin.com/api/chat-history/inject \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "What decisions did I make about the database schema?",
  "maxTokens": 600,
  "platform": "claude",
  "conversationContext": "<string>",
  "conversationHistory": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "queries": [
    {
      "query": "<string>",
      "maxTokens": 123
    }
  ]
}
'
{
  "content": "<string>",
  "sources": [
    {
      "conversationId": "<string>",
      "conversationTitle": "<string>",
      "messageId": "<string>",
      "date": "<string>",
      "relevanceScore": 123
    }
  ],
  "tokenCount": 123,
  "processingTime": "<string>",
  "model": "<string>"
}

Overview

This is the primary endpoint for retrieving context from a user’s past AI conversations. It searches across all imported chat history, then uses AI to synthesize the results into a coherent summary with source citations. This is the same function that powers the recall_chat_history tool in the MCP server.

How it works

  1. Your query is embedded and searched against all conversation chunks (vector + keyword hybrid search)
  2. Results are filtered and ranked by relevance
  3. An AI model synthesizes the top results into a coherent narrative
  4. Source citations are attached so you can trace back to specific conversations
EndpointReturnsBest for
Recall (/inject)AI-synthesized summary + sourcesBuilding context for AI conversations, getting a coherent answer
Search (/search)Raw matched chunks with scoresBuilding custom UIs, debugging, fine-grained control

Parallel queries

For complex topics, use the queries array to search from multiple angles simultaneously. Each query is searched and synthesized independently.
curl -X POST https://www.memoryplugin.com/api/chat-history/inject \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "queries": [
      { "query": "what database schema decisions were made", "maxTokens": 500 },
      { "query": "authentication architecture discussions", "maxTokens": 500 }
    ]
  }'

Single query

curl -X POST https://www.memoryplugin.com/api/chat-history/inject \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "what did I decide about the API rate limiting approach?",
    "maxTokens": 800
  }'

Authorizations

Authorization
string
header
required

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

Body

application/json
query
string

Natural-language description of what you're looking for in the user's chat history.

Example:

"What decisions did I make about the database schema?"

maxTokens
integer
default:600

Maximum tokens to allocate for the synthesized context. More tokens = richer detail but larger response.

Required range: x <= 2000
platform
enum<string>

Optional hint about the downstream chat platform to influence formatting.

Available options:
claude,
chatgpt,
typingmind
conversationContext
string

Short plaintext summary of the current conversation to ground retrieval.

conversationHistory
object[]

Recent dialogue turns to help ground the search.

queries
object[]

Array of parallel queries for complex topics (max 15). Each query is searched and synthesized independently. Use when a topic benefits from multiple search angles.

Maximum array length: 15

Response

Synthesized context from chat history

content
string

AI-synthesized summary of relevant chat history. Ready to inject into a conversation as context.

sources
object[]

Source conversations that contributed to the synthesized content.

tokenCount
integer

Actual token count of the synthesized content.

processingTime
string

Total processing time (e.g., '342ms').

model
string

AI model used for synthesis.