> ## Documentation Index
> Fetch the complete documentation index at: https://help.memoryplugin.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Recall Chat History

> Search and synthesize context from the user's past AI conversations. This is the primary recall endpoint — it performs semantic search, then uses AI to synthesize matching results into a coherent summary with source citations. This is the same function powering the `recall_chat_history` tool in the MCP server.

Supports parallel queries for complex topics that benefit from multiple search angles (e.g., timeline, decisions, people).

## 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](/integrations/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

### When to use this vs. Search

| Endpoint               | Returns                          | Best for                                                         |
| ---------------------- | -------------------------------- | ---------------------------------------------------------------- |
| **Recall** (`/inject`) | AI-synthesized summary + sources | Building context for AI conversations, getting a coherent answer |
| **Search** (`/search`) | Raw matched chunks with scores   | Building 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.

```bash theme={null}
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

```bash theme={null}
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
  }'
```


## OpenAPI

````yaml POST /api/chat-history/inject
openapi: 3.1.0
info:
  title: MemoryPlugin
  version: 1.0.0
  description: API for managing and querying user memories
servers:
  - url: https://www.memoryplugin.com
security: []
paths:
  /api/chat-history/inject:
    post:
      summary: Recall chat history
      description: >-
        Search and synthesize context from the user's past AI conversations.
        This is the primary recall endpoint — it performs semantic search, then
        uses AI to synthesize matching results into a coherent summary with
        source citations. This is the same function powering the
        `recall_chat_history` tool in the MCP server.


        Supports parallel queries for complex topics that benefit from multiple
        search angles (e.g., timeline, decisions, people).
      operationId: RecallChatHistory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatHistoryInjectInput'
      responses:
        '200':
          description: Synthesized context from chat history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatHistoryInjectResponse'
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ChatHistoryInjectInput:
      type: object
      properties:
        query:
          type: string
          description: >-
            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:
          type: integer
          default: 600
          maximum: 2000
          description: >-
            Maximum tokens to allocate for the synthesized context. More tokens
            = richer detail but larger response.
        platform:
          type: string
          enum:
            - claude
            - chatgpt
            - typingmind
          description: >-
            Optional hint about the downstream chat platform to influence
            formatting.
        conversationContext:
          type: string
          description: >-
            Short plaintext summary of the current conversation to ground
            retrieval.
        conversationHistory:
          type: array
          description: Recent dialogue turns to help ground the search.
          items:
            type: object
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
              content:
                type: string
            required:
              - role
              - content
        queries:
          type: array
          description: >-
            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.
          maxItems: 15
          items:
            type: object
            properties:
              query:
                type: string
                description: The search query for this parallel request.
              maxTokens:
                type: integer
                description: Maximum tokens for this query (defaults to 600).
            required:
              - query
    ChatHistoryInjectResponse:
      type: object
      properties:
        content:
          type: string
          description: >-
            AI-synthesized summary of relevant chat history. Ready to inject
            into a conversation as context.
        sources:
          type: array
          description: Source conversations that contributed to the synthesized content.
          items:
            type: object
            properties:
              conversationId:
                type: string
                description: >-
                  Internal conversation ID. Use with the Get Conversation or Get
                  Conversation Summary endpoints to dive deeper.
              conversationTitle:
                type: string
              messageId:
                type: string
              date:
                type: string
              relevanceScore:
                type: number
        tokenCount:
          type: integer
          description: Actual token count of the synthesized content.
        processingTime:
          type: string
          description: Total processing time (e.g., '342ms').
        model:
          type: string
          description: AI model used for synthesis.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        text:
          type: string
        score:
          type: number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````