Skip to main content
POST
/
api
/
chat-history
/
search
Search chat history (raw)
curl --request POST \
  --url https://www.memoryplugin.com/api/chat-history/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "how to set up authentication",
  "limit": 20,
  "provider": "all",
  "contextChunks": 4,
  "skipRerank": false
}
'
{
  "results": [
    {
      "conversationId": "<string>",
      "title": "<string>",
      "text": "<string>",
      "score": 123,
      "timestamp": "2023-11-07T05:31:56Z",
      "sender": "human",
      "context": [
        {
          "text": "<string>",
          "sender": "<string>",
          "timestamp": "<string>"
        }
      ]
    }
  ],
  "totalResults": 123,
  "query": "<string>",
  "provider": "<string>",
  "processingTime": 123
}

Overview

Perform semantic search across all imported chat conversations. This endpoint uses hybrid vector + keyword search with AI reranking for high relevance results.

How it works

  1. Your query is embedded and compared against all conversation chunks using vector similarity
  2. Results are enriched with surrounding context messages
  3. An AI reranker scores and orders results by relevance (can be skipped for faster responses)

Example

curl -X POST https://www.memoryplugin.com/api/chat-history/search \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how to set up authentication",
    "limit": 10,
    "provider": "all"
  }'

Authorizations

Authorization
string
header
required

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

Body

application/json
query
string
required

The search query. Semantic search is performed across all imported conversations.

Example:

"how to set up authentication"

limit
integer
default:20

Maximum number of results to return.

Required range: 1 <= x <= 100
provider
string
default:all

Filter results by platform. 'all' searches everything, or specify a platform ID (e.g., 'chatgpt', 'claude', 'custom').

contextChunks
integer
default:4

Number of surrounding message chunks to include for context around each result.

skipRerank
boolean
default:false

Skip the AI reranking step. Faster but potentially less relevant ordering.

Response

Search results

results
object[]
totalResults
integer

Total number of results found.

query
string

The original query.

provider
string

Platform filter applied.

processingTime
integer

Time taken in milliseconds.