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

# Search Notes

> Search notes using a required free-text query and structured filters.
When multiple `filter_by_contains_*` fields are true, a note may match any of them.
Returns note results from a bounded search snapshot with deterministic offset pagination.
Query-based searches are relevance-ranked within the bounded search snapshot window.
Reuse the returned `snapshot_id` when requesting later pages.
The returned `total` reflects the bounded search snapshot, capped by the 100-result search window.
For deterministic chronological pagination across all accessible notes, use `GET /v2/notes`.



## OpenAPI

````yaml POST /v2/notes/search
openapi: 3.1.0
info:
  title: Mem API
  description: An API that allows you to interact with the Mem platform.
  version: 1.0.0
servers:
  - url: https://api.mem.ai
security:
  - bearerAuth: []
paths:
  /v2/notes/search:
    post:
      tags:
        - external
        - external-v2
      summary: Search Notes
      description: >-
        Search notes using a required free-text query and structured filters.

        When multiple `filter_by_contains_*` fields are true, a note may match
        any of them.

        Returns note results from a bounded search snapshot with deterministic
        offset pagination.

        Query-based searches are relevance-ranked within the bounded search
        snapshot window.

        Reuse the returned `snapshot_id` when requesting later pages.

        The returned `total` reflects the bounded search snapshot, capped by the
        100-result search window.

        For deterministic chronological pagination across all accessible notes,
        use `GET /v2/notes`.
      operationId: app_src_api_routes_external_v2_notes_views_search_notes
      parameters:
        - in: query
          name: limit
          schema:
            anyOf:
              - maximum: 50
                minimum: 1
                type: integer
              - type: 'null'
            default: 20
            description: |-
              Maximum number of notes in this search page.
              Use smaller values for lower latency.
              Default is 20; valid range is 1 to 50.
            title: Limit
          required: false
          description: |-
            Maximum number of notes in this search page.
            Use smaller values for lower latency.
            Default is 20; valid range is 1 to 50.
        - in: query
          name: offset
          schema:
            default: 0
            description: |-
              Number of matching notes to skip before returning results.
              This value is zero-based.
            minimum: 0
            title: Offset
            type: integer
          required: false
          description: |-
            Number of matching notes to skip before returning results.
            This value is zero-based.
        - in: query
          name: snapshot_id
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            description: >-
              Opaque search snapshot identifier returned by a previous search
              page.

              Required when requesting later pages with `offset > 0`.
            title: Snapshot Id
          required: false
          description: >-
            Opaque search snapshot identifier returned by a previous search
            page.

            Required when requesting later pages with `offset > 0`.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NoteSearchRequestSchema'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NoteSearchResponseSchema'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            curl "https://api.mem.ai/v2/notes/search?limit=20&offset=0" \
                 --header "Content-Type: application/json" \
                 --header "Authorization: Bearer $MEM_API_KEY" \
                 --data '{
                     "query": "sales"
                 }'
components:
  schemas:
    NoteSearchRequestSchema:
      properties:
        query:
          description: >-
            Required text query for relevance matching.

            The query must contain at least one non-whitespace character.

            This endpoint does not provide exhaustive chronological pagination;
            for that, use

            `GET /v2/notes`.
          minLength: 1
          title: Query
          type: string
        filter_by_collection_ids:
          anyOf:
            - type: array
              items:
                type: string
                format: uuid
            - type: 'null'
          description: >-
            Optional collection UUID filters.

            When provided, results are limited to notes in any listed
            collection.
          title: Filter By Collection Ids
        filter_by_created_after:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: >-
            Optional inclusive lower bound for note creation time (ISO 8601).

            The timestamp must include a timezone offset such as `Z` or
            `+01:00`.
          examples:
            - '2025-04-01T14:30:45Z'
            - '2023-12-15T09:45:30+01:00'
          title: Filter By Created After
        filter_by_created_before:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: >-
            Optional inclusive upper bound for note creation time (ISO 8601).

            The timestamp must include a timezone offset such as `Z` or
            `+01:00`.
          examples:
            - '2025-04-30T23:59:59Z'
            - '2023-12-31T18:00:00+01:00'
          title: Filter By Created Before
        filter_by_updated_after:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: >-
            Optional inclusive lower bound for note update time (ISO 8601).

            The timestamp must include a timezone offset such as `Z` or
            `+01:00`.
          examples:
            - '2025-04-01T14:30:45Z'
            - '2023-12-15T09:45:30+01:00'
          title: Filter By Updated After
        filter_by_updated_before:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: >-
            Optional inclusive upper bound for note update time (ISO 8601).

            The timestamp must include a timezone offset such as `Z` or
            `+01:00`.
          examples:
            - '2025-04-30T23:59:59Z'
            - '2023-12-31T18:00:00+01:00'
          title: Filter By Updated Before
        filter_by_contains_open_tasks:
          default: false
          description: When true, include notes that contain at least one open task item.
          title: Filter By Contains Open Tasks
          type: boolean
        filter_by_contains_tasks:
          default: false
          description: |-
            When true, include notes that contain at least one task item
            (open or closed).
          title: Filter By Contains Tasks
          type: boolean
        filter_by_contains_images:
          default: false
          description: |-
            When true, include notes that contain image media
            (including image and GIF kinds).
          title: Filter By Contains Images
          type: boolean
        filter_by_contains_files:
          default: false
          description: |-
            When true, include notes that contain file-like attachments
            (including file and PDF kinds).
          title: Filter By Contains Files
          type: boolean
        config:
          allOf:
            - $ref: '#/components/schemas/NoteResultsConfigSchema'
          description: Configuration flags controlling search response payload shape.
      required:
        - query
      title: NoteSearchRequestSchema
      type: object
    NoteSearchResponseSchema:
      example:
        has_next_page: true
        limit: 1
        offset: 0
        request_id: api-request-018f8d0d-5a3c-7afc-8321-2f6f6e0fefab
        results:
          - audio_recording_ids:
              - 78ff64bc-09e3-4fd7-a4b9-53c258f35619
            collection_ids:
              - 59508b41-8770-4855-aa37-302b1e09aee7
            content: |
              # Recipe Notes

              - Lemon pasta
              - Chili oil dumplings
            created_at: '2025-03-18T11:00:00Z'
            id: 018f8d0d-5a3c-7afc-8321-2f6f6e0fefab
            snippet: Dinner ideas
            title: Recipe Notes
            updated_at: '2025-04-22T16:12:34Z'
        snapshot_id: fd233b1f-25ac-4c0d-94db-4fa0843084ff
        total: 12
      properties:
        request_id:
          description: Identifier for this API request. Useful for tracing and support.
          title: Request Id
          type: string
        results:
          description: Relevance-ranked note results matching the search request.
          items:
            $ref: '#/components/schemas/NoteSearchItemResponseSchema'
          title: Results
          type: array
        total:
          description: >-
            Number of matching notes captured in the bounded search snapshot,
            capped by the 100-result search window.
          title: Total
          type: integer
        offset:
          description: Zero-based offset applied before returning results.
          title: Offset
          type: integer
        limit:
          description: Limit applied to this search page.
          title: Limit
          type: integer
        has_next_page:
          description: >-
            Whether another request within the 100-result search window can
            return more matching notes.
          title: Has Next Page
          type: boolean
        snapshot_id:
          description: Opaque snapshot identifier to reuse for deterministic later pages.
          format: uuid
          title: Snapshot Id
          type: string
      required:
        - request_id
        - results
        - total
        - offset
        - limit
        - has_next_page
        - snapshot_id
      title: NoteSearchResponseSchema
      type: object
    NoteResultsConfigSchema:
      properties:
        include_note_content:
          default: false
          description: |-
            When true, include full markdown content for each returned note.
            Keep false for lightweight metadata/snippet responses.
          title: Include Note Content
          type: boolean
      title: NoteResultsConfigSchema
      type: object
    NoteSearchItemResponseSchema:
      properties:
        id:
          description: UUID of the note.
          format: uuid
          title: Id
          type: string
        title:
          description: Current title of the note.
          title: Title
          type: string
        content:
          anyOf:
            - type: string
            - type: 'null'
          description: |-
            Full markdown content for the note.
            Included only when `config.include_note_content=true` is requested.
          title: Content
        collection_ids:
          description: Collection UUIDs currently associated with the note.
          items:
            type: string
            format: uuid
          title: Collection Ids
          type: array
        audio_recording_ids:
          description: Audio Recording UUIDs currently associated with the note.
          items:
            type: string
            format: uuid
          title: Audio Recording Ids
          type: array
        snippet:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Optional derived preview text for quick display and ranking context.

            It may be truncated and is not guaranteed to contain full note
            context.
          title: Snippet
        created_at:
          description: Creation timestamp for the note in ISO 8601 format.
          format: date-time
          title: Created At
          type: string
        updated_at:
          description: Last modification timestamp for the note in ISO 8601 format.
          format: date-time
          title: Updated At
          type: string
      required:
        - id
        - title
        - collection_ids
        - audio_recording_ids
        - created_at
        - updated_at
      title: NoteSearchItemResponseSchema
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````