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

# Search Memories

> Search memories for the current user.

Supports different retrieval methods:
- agentic: AI-powered semantic search (default)
- last_n: Most recent memories
- first_n: Oldest memories



## OpenAPI

````yaml api-reference/openapi.json post /api/v1/memories/search
openapi: 3.1.0
info:
  title: FastAPI app
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/memories/search:
    post:
      tags:
        - Memory
      summary: Search Memories
      description: |-
        Search memories for the current user.

        Supports different retrieval methods:
        - agentic: AI-powered semantic search (default)
        - last_n: Most recent memories
        - first_n: Oldest memories
      operationId: search_memories_api_v1_memories_search_post
      parameters:
        - name: X-Workspace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The workspace ID
            title: X-Workspace-Id
          description: The workspace ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MemorySearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemorySearchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - DualAuthScheme: []
components:
  schemas:
    MemorySearchRequest:
      properties:
        query:
          type: string
          title: Query
          description: Search query for memories.
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: User ID.
        limit:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 1
            - type: 'null'
          title: Limit
          description: Maximum number of memories to return.
          default: 10
        retrieval_method:
          anyOf:
            - type: string
            - type: 'null'
          title: Retrieval Method
          description: >-
            Retrieval method: 'agentic', 'agentic_vector', 'agentic_hybrid',
            'agentic_keyword', 'vector', 'hybrid', 'keyword', 'last_n', or
            'first_n'.
          default: agentic
      type: object
      required:
        - query
      title: MemorySearchRequest
      description: Schema for memory search request.
    MemorySearchResponse:
      properties:
        memories:
          items:
            $ref: '#/components/schemas/MemoryResponse'
          type: array
          title: Memories
          description: List of matching memories.
        total_results:
          type: integer
          title: Total Results
          description: Total number of memories found.
        query:
          type: string
          title: Query
          description: The search query used.
        retrieval_method:
          type: string
          title: Retrieval Method
          description: The retrieval method used.
      type: object
      required:
        - memories
        - total_results
        - query
        - retrieval_method
      title: MemorySearchResponse
      description: Schema for memory search response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MemoryResponse:
      properties:
        memory_id:
          type: string
          title: Memory Id
          description: Unique identifier for the memory.
        user_id:
          type: string
          title: User Id
          description: User ID who owns the memory.
        memory:
          type: string
          title: Memory
          description: The memory content.
        topics:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Topics
          description: Topics associated with the memory.
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: When the memory was created.
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: When the memory was last updated.
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Additional metadata for the memory.
      type: object
      required:
        - memory_id
        - user_id
        - memory
      title: MemoryResponse
      description: Schema for memory response.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    DualAuthScheme:
      type: http
      scheme: bearer

````