> ## 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.

# Search inside a saved view

> Runs a full Memex search constrained to the content matched by a saved view. Use `viewId` for an authenticated accessible view, or `token` for a public shared view token. This endpoint returns the full/raw search shape; use `POST /search` with `viewIds` when you need the LLM-ready compact response.



## OpenAPI

````yaml /api-reference/openapi.json post /execute-view-search
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:
  /execute-view-search:
    post:
      summary: Search inside a saved view
      description: >-
        Runs a full Memex search constrained to the content matched by a saved
        view. Use `viewId` for an authenticated accessible view, or `token` for
        a public shared view token. This endpoint returns the full/raw search
        shape; use `POST /search` with `viewIds` when you need the LLM-ready
        compact response.
      operationId: executeViewSearch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteViewSearchRequest'
            examples:
              authenticatedView:
                summary: Search an accessible view by ID
                value:
                  viewId: view_123
                  query: vector database benchmarks
                  limit: 10
                  enableRerank: true
              publicToken:
                summary: Search a public shared view by token
                value:
                  token: public_view_token
                  query: launch notes
                  limit: 10
      responses:
        '200':
          description: Raw scoped search response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchContentFullResponse'
        '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'
      security:
        - bearerAuth: []
        - {}
components:
  schemas:
    ExecuteViewSearchRequest:
      type: object
      anyOf:
        - required:
            - viewId
        - required:
            - token
      properties:
        viewId:
          type: string
          description: Saved view ID accessible to the authenticated user.
        token:
          type: string
          description: >-
            Public token for a shared view. Can be used without bearer auth when
            the view is public.
        query:
          type: string
        rewriteQuery:
          type: boolean
        forceFullQueryProcessing:
          type: boolean
        enableRerank:
          type: boolean
        rerankWindow:
          type: integer
          minimum: 1
          maximum: 100
        includeChunkContext:
          type: boolean
        tagIds:
          type: array
          items:
            type: string
          description: >-
            Optional tag IDs to further filter the view. IDs must already belong
            to the view scope.
        contentTypes:
          type: array
          items:
            $ref: '#/components/schemas/ContentEntityType'
        timeRange:
          type: object
          properties:
            start:
              type: number
              description: Unix timestamp in milliseconds.
            end:
              type: number
              description: Unix timestamp in milliseconds.
          additionalProperties: false
        sortBy:
          type: string
          enum:
            - date-desc
            - date-asc
        offset:
          type: integer
          minimum: 0
          default: 0
        limit:
          type: integer
          minimum: 1
          maximum: 500
          default: 30
      additionalProperties: false
    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.
    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.
    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
    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.
    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.