> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Saved Search

> Creates a new saved search.



## OpenAPI

````yaml https://raw.githubusercontent.com/hyperdxio/hyperdx/refs/heads/main/packages/api/openapi.json post /api/v2/saved-searches
openapi: 3.0.0
info:
  title: HyperDX External API
  description: API for managing HyperDX alerts and dashboards
  version: 2.0.0
servers:
  - url: /
    description: Your HyperDX instance (http://<host>:<port>)
security:
  - BearerAuth: []
tags:
  - name: Dashboards
    description: Endpoints for managing dashboards and their visualizations
  - name: Alerts
    description: Endpoints for managing monitoring alerts
  - name: Charts
    description: Endpoints for querying chart data
  - name: Connections
    description: Endpoints for managing ClickHouse connections
  - name: Sources
    description: Endpoints for managing data sources
  - name: Webhooks
    description: Endpoints for managing webhooks
  - name: Search
    description: Endpoints for querying raw data from log and trace sources
paths:
  /api/v2/saved-searches:
    post:
      tags:
        - Saved Searches
      summary: Create Saved Search
      description: Creates a new saved search.
      operationId: createSavedSearch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedSearchInput'
      responses:
        '200':
          description: Successfully created saved search
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedSearchResponseEnvelope'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SavedSearchInput:
      type: object
      required:
        - name
        - sourceId
      properties:
        name:
          type: string
          maxLength: 1024
          description: Display name for the saved search.
          example: Production Errors
        sourceId:
          type: string
          description: ID of the source to query. Must belong to the team.
          example: 507f1f77bcf86cd799439012
        select:
          type: string
          maxLength: 4096
          description: >-
            Comma-separated list of column expressions to display. Empty uses
            the source default.
          example: Timestamp, ServiceName, Body
        where:
          type: string
          maxLength: 8192
          description: Row filter expression. The language is controlled by whereLanguage.
          example: SeverityText:ERROR
        whereLanguage:
          type: string
          enum:
            - lucene
            - sql
          default: lucene
          description: Language used for the where filter.
          example: lucene
        orderBy:
          type: string
          maxLength: 1024
          description: ORDER BY expression. Empty uses the source default.
          example: Timestamp DESC
        tags:
          type: array
          maxItems: 50
          items:
            type: string
            maxLength: 32
          description: Tags used to organize saved searches.
          example:
            - production
            - errors
        filters:
          type: array
          maxItems: 100
          description: Structured pinned filters applied to the search.
          items:
            $ref: '#/components/schemas/SavedSearchFilter'
          example:
            - type: sql
              condition: ServiceName IN ('checkout', 'payments')
    SavedSearchResponseEnvelope:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/SavedSearch'
          description: The saved search object.
    Error:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message.
          example: 'NOT_FOUND: Alert not found'
    SavedSearchFilter:
      type: object
      required:
        - condition
      description: >-
        A single pinned filter applied to the search. New or changed filters
        must use the SQL predicate form the UI produces so they render as a
        sidebar facet: `<column> IN ('<value1>', ...)` (or `NOT IN` /
        `BETWEEN`). Conditions not in this form are rejected on create, and on
        update unless they are echoed back unchanged from the stored saved
        search (so a read-modify-write of a legacy filter still succeeds). Note:
        existing saved searches created in the UI may also return a Lucene text
        filter (`type: lucene`) or a structured comparison (`type: sql_ast` with
        `operator`/`left`/`right`); reads return these stored shapes verbatim,
        and they are preserved on unchanged update.
      properties:
        type:
          type: string
          enum:
            - sql
          default: sql
          description: Always `sql`. Only SQL predicate filters render in the sidebar.
          example: sql
        condition:
          type: string
          maxLength: 8192
          description: SQL predicate applied to the search, in `<column> IN (...)` form.
          example: ServiceName IN ('checkout', 'payments')
    SavedSearch:
      type: object
      required:
        - id
        - name
        - sourceId
      properties:
        id:
          type: string
          readOnly: true
          description: Unique saved search ID. Server-generated.
          example: 507f1f77bcf86cd799439011
        name:
          type: string
          description: Display name for the saved search.
          example: Production Errors
        sourceId:
          type: string
          description: ID of the source this saved search queries.
          example: 507f1f77bcf86cd799439012
        select:
          type: string
          description: >-
            Comma-separated list of column expressions to display. Empty uses
            the source default.
          example: Timestamp, ServiceName, Body
        where:
          type: string
          description: Row filter expression. The language is controlled by whereLanguage.
          example: SeverityText:ERROR
        whereLanguage:
          type: string
          enum:
            - lucene
            - sql
          description: Language used for the where filter.
          example: lucene
        orderBy:
          type: string
          description: ORDER BY expression. Empty uses the source default.
          example: Timestamp DESC
        tags:
          type: array
          maxItems: 50
          items:
            type: string
            maxLength: 32
          description: Tags used to organize saved searches.
          example:
            - production
            - errors
        filters:
          type: array
          maxItems: 100
          description: Structured pinned filters applied to the search.
          items:
            $ref: '#/components/schemas/SavedSearchFilter'
          example:
            - type: sql
              condition: ServiceName IN ('checkout', 'payments')
        teamId:
          type: string
          readOnly: true
          description: ID of the team that owns the saved search.
          example: 507f1f77bcf86cd799439013
        createdAt:
          type: string
          format: date-time
          readOnly: true
          description: Creation timestamp.
          example: '2025-01-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          readOnly: true
          description: Last update timestamp.
          example: '2025-06-15T10:30:00.000Z'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````