To search through your memories, send a POST request to /search:

curl -X POST https://v2.api.supermemory.ai/search \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "machine learning concepts",
    "limit": 10
  }'

The API will return relevant matches with their similarity scores:

{
  "results": [
    {
      "documentId": "doc_xyz789",
      "chunks": [
        {
          "content": "Machine learning is a subset of artificial intelligence...",
          "isRelevant": true,
          "score": 0.85
        }
      ],
      "score": 0.95,
      "metadata": {
        "source": "web",
        "category": "technology"
      },
      "title": "Introduction to Machine Learning"
    }
  ],
  "total": 1,
  "timing": 123.45
}

Search Parameters

{
  "q": "search query",              // Required: Search query string
  "limit": 10,                      // Optional: Max results (default: 10)
  "documentThreshold": 0.5,         // Optional: Min document score (0-1)
  "chunkThreshold": 0.5,           // Optional: Min chunk score (0-1)
  "onlyMatchingChunks": false,     // Optional: Skip context chunks
  "docId": "doc_id",               // Optional: Search in specific doc
  "userId": "user_123",            // Optional: Search in user's space
  "includeSummary": false,         // Optional: Include doc summaries
  "filters": {                     // Optional: Metadata filters
    "AND": [
      { 
        "key": "category",
        "value": "technology"
      }
    ]
  },
  "categoriesFilter": [            // Optional: Category filters
    "technology",
    "science"
  ]
}

Search Response

The search response includes:

{
  "results": [{
    "documentId": "string",     // Document ID
    "chunks": [{                // Matching chunks
      "content": "string",     // Chunk content
      "isRelevant": true,      // Is directly relevant
      "score": 0.95           // Similarity score
    }],
    "score": 0.95,             // Document score
    "metadata": {},            // Document metadata
    "title": "string",        // Document title
    "createdAt": "string",    // Creation date
    "updatedAt": "string"     // Last update date
  }],
  "total": 1,                 // Total results
  "timing": 123.45           // Search time (ms)
}

Next Steps

Explore more advanced features in our API Reference.