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

# Unified search across saved Memex content

> Compatibility alias for `/search`. Returns content results, extra entities, resolved references, and optional inline notes. Supports optional reranking.



## OpenAPI

````yaml /api-reference/openapi.json post /search-content
openapi: 3.1.0
info:
  title: Memex REST API
  description: Memex REST API endpoints.
  version: '2026-03-10'
servers:
  - url: https://memex.garden/api
    description: Public edge router
  - url: https://rubctkzqxcdgkbbcprnu.supabase.co/functions/v1
    description: Direct Supabase Edge Functions
security:
  - bearerAuth: []
paths:
  /search-content:
    post:
      summary: Unified search across saved Memex content
      description: >-
        Compatibility alias for `/search`. Returns content results, extra
        entities, resolved references, and optional inline notes. Supports
        optional reranking.
      operationId: searchContent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchContentRequest'
            examples:
              basic:
                summary: Search with rerank and content type filters
                value:
                  query: vector databases
                  contentTypes:
                    - web
                    - pdf
                  limit: 20
                  offset: 0
                  enableRerank: true
                  rerankWindow: 100
              llmViewSearch:
                summary: LLM-ready search inside a saved view
                value:
                  viewIds:
                    - view_123
                  query: vector database benchmarks
                  limit: 10
                  raw: false
              fullViewSearch:
                summary: Full search graph inside a saved view
                value:
                  viewIds:
                    - view_123
                  query: vector database benchmarks
                  limit: 10
                  raw: true
                  includeNotes: true
      responses:
        '200':
          description: Search response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchContentResponse'
        '401':
          description: Authentication required or invalid bearer token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '500':
          description: Unexpected server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    SearchContentRequest:
      type: object
      properties:
        query:
          type: string
          description: 'Search query text. Supports inline tags like #tag-name.'
        rewriteQuery:
          type: boolean
          description: Rewrite query before embedding generation.
        tag:
          type: string
          description: Tag filter string. Multiple values can be comma- or space-separated.
        tag_ids:
          type: array
          items:
            type: string
          description: Explicit tag IDs to filter on.
        tagMatchStrategy:
          type: string
          enum:
            - AND
            - OR
          default: AND
        dateFrom:
          type: string
          description: Start date filter (free text or date string).
        dateTo:
          type: string
          description: End date filter (free text or date string).
        timeRange:
          type: object
          properties:
            start:
              type: number
              description: Unix timestamp in milliseconds.
            end:
              type: number
              description: Unix timestamp in milliseconds.
          additionalProperties: false
        contentTypes:
          type: array
          items:
            $ref: '#/components/schemas/ContentEntityType'
          description: Restrict search to one or more exact `content_entity.type` values.
        feedIds:
          type: array
          items:
            type: string
          description: >-
            Restrict search results to entries from one or more subscribed feed
            IDs returned by /list-feeds.
        feedScope:
          type: string
          enum:
            - all
          description: >-
            Set to all to restrict search results to entries from all subscribed
            feeds. Omit both feedScope and feedIds to search the full library.
        feedReadStates:
          type: array
          items:
            type: string
            enum:
              - unread
              - read
              - archived
          description: >-
            Optional read-state filter for feed entries. Omit to include unread
            and read entries while excluding archived entries.
        sortBy:
          type: string
          enum:
            - date-asc
            - date-desc
          default: date-desc
        offset:
          type: integer
          minimum: 0
          default: 0
        limit:
          type: integer
          minimum: 1
          maximum: 500
          description: Maximum number of results returned per call.
          default: 30
        relevanceThreshold:
          type: number
          description: Semantic relevance threshold for hybrid search.
        enableRerank:
          type: boolean
          default: false
          description: If true and query is non-empty, reranks top candidates with an LLM.
        rerankWindow:
          type: integer
          minimum: 1
          maximum: 100
          default: 100
          description: Maximum candidate window used for reranking.
        includeTags:
          type: boolean
          default: false
          description: Includes related tags in the reference payload.
        includeNotes:
          type: boolean
          default: false
          description: Includes related notes and each note's own references.
        raw:
          type: boolean
          default: false
          description: >-
            Response mode switch. Omit or set false for the LLM-ready compact
            response. Set true for the full machine-readable search graph.
        viewIds:
          type: array
          items:
            type: string
          description: >-
            Restrict search to one or more accessible saved view IDs. Use this
            when you need LLM-ready or full search responses scoped to views.
      additionalProperties: false
    SearchContentResponse:
      oneOf:
        - $ref: '#/components/schemas/SearchContentLlmResponse'
        - $ref: '#/components/schemas/SearchContentFullResponse'
      description: >-
        Search response. Omit `raw` or set `raw: false` for the LLM-ready
        response; set `raw: true` for the full response.
    UnauthorizedError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Unauthorized
      additionalProperties: true
    InternalServerError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          example: Internal server error
        message:
          type: string
      additionalProperties: true
    ContentEntityType:
      type: string
      enum:
        - web
        - pdf
        - youtube
        - twitter
        - instagram
        - tiktok
        - facebook
        - linkedin
        - pinterest
        - reddit
        - chatgpt
        - claude
        - annotation
        - image
        - transcribedMedia
        - audioRecording
        - selector
        - chatThread
        - twitterProfile
        - subreddit
        - youtubeChannel
      description: Exact persisted `content_entity.type` value.
    SearchContentLlmResponse:
      type: object
      description: >-
        LLM-ready compact search response returned when `raw` is omitted or
        `false`.
      required:
        - results
        - meta
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/SearchContentLlmResult'
        meta:
          $ref: '#/components/schemas/SearchMeta'
        error:
          type: string
          description: Present when search execution fails.
        errorCode:
          type: string
          enum:
            - INSUFFICIENT_CREDITS
        upgradeOptions:
          type: object
          additionalProperties: true
      additionalProperties: true
    SearchContentFullResponse:
      type: object
      required:
        - results
        - extraEntities
        - referencesByResultId
        - referencedEntities
        - referencedTags
        - meta
      properties:
        results:
          type: array
          description: >-
            Search results. When `includeNotes` is true, each result includes an
            `annotations` array.
          items:
            $ref: '#/components/schemas/SearchResultEntity'
        extraEntities:
          type: array
          items:
            $ref: '#/components/schemas/ContentEntity'
        referencesByResultId:
          type: object
          description: Map of result content ID to referenced content/tag IDs.
          additionalProperties:
            $ref: '#/components/schemas/ResultReferences'
        referencedEntities:
          type: array
          items:
            $ref: '#/components/schemas/ContentEntity'
        referencedTags:
          type: array
          items:
            $ref: '#/components/schemas/TagEntity'
        meta:
          $ref: '#/components/schemas/SearchMeta'
        error:
          type: string
          description: Present when search execution fails.
      description: >-
        Full machine-readable search response returned when `raw` is `true`.
        Includes search graph fields for programmatic processing.
    SearchContentLlmResult:
      type: object
      required:
        - type
        - url
        - createdAt
        - text
      properties:
        type:
          type: string
        url:
          type: string
        createdAt:
          oneOf:
            - type: string
              format: date-time
            - type: 'null'
        title:
          type: string
        text:
          type: string
          description: >-
            Compiled, LLM-friendly text for the result. Web HTML is normalized
            and annotations are resolved inline when possible.
        media:
          type: array
          items:
            $ref: '#/components/schemas/SearchContentLlmMedia'
        references:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SearchContentLlmReference'
        user_notes:
          type: array
          items:
            $ref: '#/components/schemas/SearchContentLlmReference'
      additionalProperties: true
    SearchMeta:
      type: object
      required:
        - offset
        - limit
        - returnedCount
        - rerankApplied
        - usageMicrosCharged
        - remainingUsageBalance
      properties:
        offset:
          type: integer
        limit:
          type: integer
        returnedCount:
          type: integer
        rerankApplied:
          type: boolean
        usageMicrosCharged:
          type: number
          description: >-
            Dollar-denominated usage micros charged for the search request.
            1,000,000 micros equals $1.00.
        remainingUsageBalance:
          type: object
          required:
            - usageBalancePaygMicros
            - usageBalanceSubscriptionMicros
            - total
          properties:
            usageBalancePaygMicros:
              type: number
              description: Remaining pay-as-you-go balance in USD micros.
            usageBalanceSubscriptionMicros:
              type: number
              description: Remaining subscription balance in USD micros.
            total:
              type: number
              description: Total remaining usage balance in USD micros.
    SearchResultEntity:
      allOf:
        - $ref: '#/components/schemas/ContentEntity'
        - type: object
          properties:
            annotations:
              type: array
              description: >-
                Present when `includeNotes` is true. Each annotation `text` is
                compiled with resolved references inline.
              items:
                $ref: '#/components/schemas/SearchResultAnnotation'
          additionalProperties: true
    ContentEntity:
      oneOf:
        - $ref: '#/components/schemas/WebContentEntity'
        - $ref: '#/components/schemas/TweetContentEntity'
        - $ref: '#/components/schemas/YoutubeContentEntity'
        - $ref: '#/components/schemas/ImageContentEntity'
        - $ref: '#/components/schemas/RedditContentEntity'
        - $ref: '#/components/schemas/OtherContentEntity'
      discriminator:
        propertyName: type
        mapping:
          web: '#/components/schemas/WebContentEntity'
          twitter: '#/components/schemas/TweetContentEntity'
          youtube: '#/components/schemas/YoutubeContentEntity'
          image: '#/components/schemas/ImageContentEntity'
          reddit: '#/components/schemas/RedditContentEntity'
      description: >-
        Union over Memex content entities. API-facing documented variants are
        web, twitter (tweets), youtube, image, and reddit.
    ResultReferences:
      type: object
      required:
        - contentEntityIds
        - tagIds
      properties:
        contentEntityIds:
          type: array
          items:
            type: string
        tagIds:
          type: array
          items:
            type: string
      additionalProperties: false
    TagEntity:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
        name:
          type: string
        created_at:
          type: number
          description: Unix timestamp in milliseconds.
        updated_at:
          type: number
          description: Unix timestamp in milliseconds.
      additionalProperties: true
    SearchContentLlmMedia:
      type: object
      properties:
        type:
          type: string
        imageDescription:
          type: string
        transcriptChunks:
          type: array
          items:
            type: string
        assetUrls:
          type: array
          items:
            type: string
      additionalProperties: true
    SearchContentLlmReference:
      allOf:
        - $ref: '#/components/schemas/SearchContentLlmResult'
    SearchResultAnnotation:
      allOf:
        - $ref: '#/components/schemas/ContentEntity'
        - type: object
          required:
            - resolvedReferences
          properties:
            resolvedReferences:
              type: array
              items:
                $ref: '#/components/schemas/ContentEntity'
            text:
              type: string
              description: Compiled annotation text with resolved references inline.
          additionalProperties: true
    WebContentEntity:
      allOf:
        - $ref: '#/components/schemas/ContentEntityBase'
        - type: object
          required:
            - type
            - title
            - url
            - normalized_url
          properties:
            type:
              type: string
              const: web
            title:
              type: string
            url:
              type: string
            normalized_url:
              type: string
            canonical_url:
              type: string
            favicon_url:
              type: string
            description:
              type: string
            keywords:
              type: string
            author:
              type: string
            date:
              type: string
            html:
              type: string
            full_text:
              type: string
          additionalProperties: true
    TweetContentEntity:
      allOf:
        - $ref: '#/components/schemas/ContentEntityBase'
        - type: object
          required:
            - type
            - author_name
            - author_handle
            - text
          properties:
            type:
              type: string
              const: twitter
            author_name:
              type: string
            author_handle:
              type: string
            title:
              type: string
            text:
              type: string
            published_at:
              type: number
              description: Unix timestamp in milliseconds.
            save_type:
              type: string
              enum:
                - like
                - retweet
                - bookmark
            videos:
              type: array
              items:
                $ref: '#/components/schemas/TweetVideo'
            images:
              type: array
              items:
                type: string
            image_analysis:
              $ref: '#/components/schemas/ImageAnalysisMap'
          additionalProperties: true
    YoutubeContentEntity:
      allOf:
        - $ref: '#/components/schemas/ContentEntityBase'
        - type: object
          required:
            - type
            - title
            - description
            - thumbnail_url
            - published_at
          properties:
            type:
              type: string
              const: youtube
            title:
              type: string
            description:
              type: string
            thumbnail_url:
              type: string
            published_at:
              type: number
              description: Unix timestamp in milliseconds.
            transcript:
              type: object
              description: Map of language code to transcript segments.
              additionalProperties:
                type: array
                items:
                  $ref: '#/components/schemas/YoutubeTranscriptSegment'
            summary:
              type: object
              description: Map of language code to generated summary text.
              additionalProperties:
                type: string
          additionalProperties: true
    ImageContentEntity:
      allOf:
        - $ref: '#/components/schemas/ContentEntityBase'
        - type: object
          required:
            - type
            - description
          properties:
            type:
              type: string
              const: image
            description:
              type: string
            original_url:
              type: string
            is_reference:
              type: boolean
            source_url:
              type: string
            source_title:
              type: string
          additionalProperties: true
    RedditContentEntity:
      allOf:
        - $ref: '#/components/schemas/ContentEntityBase'
        - type: object
          required:
            - type
            - text
            - author_name
            - author_handle
          properties:
            type:
              type: string
              const: reddit
            title:
              type: string
            text:
              type: string
            author_name:
              type: string
            author_handle:
              type: string
            author_favicon_url:
              type: string
            subreddit_favicon_url:
              type: string
            media_urls:
              type: array
              items:
                type: string
            videos:
              type: array
              items:
                $ref: '#/components/schemas/RedditVideo'
            permalink:
              type: string
            subreddit_id:
              type: string
            subreddit_name:
              type: string
            image_analysis:
              $ref: '#/components/schemas/ImageAnalysisMap'
          additionalProperties: true
    OtherContentEntity:
      allOf:
        - $ref: '#/components/schemas/ContentEntityBase'
        - type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - pdf
                - instagram
                - tiktok
                - facebook
                - linkedin
                - pinterest
                - chatgpt
                - claude
                - annotation
                - transcribedMedia
                - audioRecording
                - selector
                - chatThread
                - twitterProfile
                - subreddit
                - youtubeChannel
          additionalProperties: true
    ContentEntityBase:
      type: object
      required:
        - id
        - type
        - created_at
        - updated_at
      properties:
        id:
          type: string
        type:
          $ref: '#/components/schemas/ContentEntityType'
        created_at:
          type: number
          description: Unix timestamp in milliseconds.
        updated_at:
          type: number
          description: Unix timestamp in milliseconds.
        user_id:
          type: string
          description: Owner user ID when present.
        external_id:
          type: string
          description: Deterministic/shared external identifier.
        url:
          type: string
          description: >-
            Resolved source URL when Memex can derive a stable reference link
            for this entity.
        tag_ids:
          type: array
          items:
            type: string
          description: Tag IDs linked directly to this entity.
        reference_content_ids:
          type: array
          items:
            type: string
          description: Referenced content entity IDs.
      additionalProperties: true
    TweetVideo:
      type: object
      required:
        - variants
      properties:
        variants:
          type: array
          items:
            $ref: '#/components/schemas/TweetMediaVariant'
        duration:
          type: number
        preview_url:
          type: string
      additionalProperties: true
    ImageAnalysisMap:
      type: object
      description: Map of image URL to an analysis object.
      additionalProperties:
        $ref: '#/components/schemas/ImageAnalysisEntry'
    YoutubeTranscriptSegment:
      type: object
      required:
        - offset
        - text
        - duration
      properties:
        offset:
          oneOf:
            - type: string
            - type: number
        text:
          type: string
        duration:
          type: number
      additionalProperties: true
    RedditVideo:
      type: object
      required:
        - url
      properties:
        url:
          type: string
        preview_url:
          type: string
      additionalProperties: true
    TweetMediaVariant:
      type: object
      required:
        - url
      properties:
        content_type:
          type: string
        url:
          type: string
        bitrate:
          type: number
      additionalProperties: true
    ImageAnalysisEntry:
      type: object
      required:
        - description
      properties:
        description:
          type: string
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.