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

# Search memories

> Search saved memories with a natural-language query. Use filters such
as scope, project, and category when your app needs narrower results.




## OpenAPI

````yaml /openapi.yaml get /api/memories/search
openapi: 3.1.0
info:
  title: MemContext API
  version: 1.1.0
  description: |
    REST API for persistent, evolving AI memory. Save, search, and manage
    memories with automatic deduplication, version chains, and hybrid retrieval.
servers:
  - url: https://api.memcontext.in
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Memories
    description: Save, search, list, update, and delete memories.
  - name: History
    description: Inspect how memories evolve over time.
  - name: Feedback
    description: Rate retrieval quality to improve future results.
  - name: Profiles
    description: Pre-aggregated user context from memory.
  - name: Workspaces
    description: >-
      Company/team account boundaries for billing, members, API keys, and
      vaults.
  - name: API Keys
    description: Workspace-bound API keys for server-side integrations.
  - name: Subscription
    description: Workspace-owned billing and member-memory limits.
  - name: Context Vault
    description: Document ingestion and workspace RAG retrieval.
paths:
  /api/memories/search:
    get:
      tags:
        - Memories
      summary: Search memories
      description: |
        Search saved memories with a natural-language query. Use filters such
        as scope, project, and category when your app needs narrower results.
      operationId: searchMemories
      parameters:
        - in: query
          name: query
          required: true
          schema:
            type: string
            maxLength: 1000
          description: Natural language search query. Use full sentences for best results.
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 10
            default: 5
          description: Maximum number of results to return.
        - in: query
          name: category
          schema:
            $ref: '#/components/schemas/MemoryCategory'
          description: Filter results to a single category.
        - in: query
          name: scope
          schema:
            type: string
            maxLength: 200
          description: >-
            Hard isolation boundary. When provided, search runs only inside that
            scope. Omit to search only unscoped/global memories.
        - in: query
          name: project
          schema:
            type: string
          description: Filter results to a specific project within the selected scope.
        - in: query
          name: threshold
          schema:
            type: number
            minimum: 0
            maximum: 1
          description: |
            Search strictness. Higher values return broader matches. Use `0.6`
            as the default unless you have tested a different value.
      responses:
        '200':
          description: Ranked search results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchMemoryResponse'
components:
  schemas:
    MemoryCategory:
      type: string
      enum:
        - preference
        - fact
        - decision
        - context
      description: |
        - `preference` - User likes or dislikes (e.g. "prefers dark mode").
        - `fact` - Objective information (e.g. "uses macOS").
        - `decision` - Choices made (e.g. "chose the new billing provider").
        - `context` - Background information (e.g. "working on e-commerce app").
    SearchMemoryResponse:
      type: object
      required:
        - found
        - memories
      properties:
        found:
          type: integer
          description: Number of results returned.
        memories:
          type: array
          items:
            $ref: '#/components/schemas/SearchMemoryResult'
    SearchMemoryResult:
      type: object
      required:
        - id
        - content
        - relevance
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        content:
          type: string
        category:
          $ref: '#/components/schemas/MemoryCategory'
        scope:
          type: string
          nullable: true
        project:
          type: string
          nullable: true
        relevance:
          type: number
          minimum: 0
          maximum: 1
          description: Relevance score from 0 (least relevant) to 1 (most relevant).
        createdAt:
          type: string
          format: date-time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >
        API key created from the MemContext dashboard. Keys are prefixed with
        `mc_`, bound to one workspace, and API-key requests cannot override that
        workspace.

````