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

# Create saved query

> Persist definition and first immutable version. Replay same key/request returns same IDs; conflict on changed request. Query creation alone evaluates nothing.



## OpenAPI

````yaml /openapi.yaml post /v0/saved-queries
openapi: 3.1.0
info:
  title: Quivr V2 public text foundation contract
  version: 0.0.0-draft
  description: >-
    THE-543 and THE-547 evaluation contracts; endpoint implementations are
    separate work. Matching criterion is plugin-owned and deferred. One
    configured webhook destination, immutable Matches, independent at-least-once
    Delivery and reference-only notifications. OpenAPI is authoritative for
    transport shapes. THE-640 adds text search and asynchronous Corpus
    projection rebuild initiation.
servers: []
security:
  - ApiKey: []
paths:
  /v0/saved-queries:
    post:
      tags:
        - Saved queries
      summary: Create saved query
      description: >-
        Persist definition and first immutable version. Replay same key/request
        returns same IDs; conflict on changed request. Query creation alone
        evaluates nothing.
      operationId: createSavedQuery
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedQueryCreate'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedQuery'
        default:
          description: >-
            Structured error. Existing /v0 authentication, scope, pagination and
            idempotency semantics apply.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SavedQueryCreate:
      type: object
      additionalProperties: false
      properties:
        idempotency_key:
          type: string
          minLength: 1
        name:
          type: string
          minLength: 1
        definition:
          $ref: '#/components/schemas/SavedQueryDefinition'
      required:
        - idempotency_key
        - name
        - definition
    SavedQuery:
      type: object
      additionalProperties: false
      properties:
        saved_query_id:
          type: string
          minLength: 1
        name:
          type: string
          minLength: 1
        deleted:
          type: boolean
          description: Logically deleted; the Saved Query and its Versions stay readable.
        current_version:
          $ref: '#/components/schemas/SavedQueryVersion'
      required:
        - saved_query_id
        - name
        - deleted
        - current_version
    Error:
      type: object
      additionalProperties: false
      properties:
        code:
          type: string
          minLength: 1
        message:
          type: string
          minLength: 1
        retryable:
          type: boolean
        field:
          type: string
          minLength: 1
          description: >-
            JSON Pointer (RFC 6901) to the request member that caused a 422,
            when known (for example /config/url or /credential/secret/token on
            connector commands).
        resync_url:
          type: string
          format: uri-reference
      required:
        - code
        - message
        - retryable
    SavedQueryDefinition:
      type: object
      additionalProperties: false
      properties:
        corpus_ids:
          type: array
          items:
            type: string
            minLength: 1
          minItems: 1
          uniqueItems: true
        expression:
          type: object
          additionalProperties: true
        retrieval_profile:
          type: string
          minLength: 1
          description: >-
            A search profile the deployment answers (listSearchProfiles),
            recorded as sent; balanced, the deprecated name of default, is
            accepted through engine 0.1.x. Another profile is 422
            unsupported_profile. The profile is checked only when a definition
            is written, so a Version keeps its profile and keeps evaluating
            after the profile stops being served.
        temporal_policy:
          type: string
          enum:
            - from_activation
      required:
        - corpus_ids
        - expression
        - retrieval_profile
        - temporal_policy
      description: >-
        Immutable query definition. Expression semantics belong to the evaluator
        plugin; no core keyword or semantic threshold is implied. All Corpora
        belong to the authorized Organization.
    SavedQueryVersion:
      type: object
      additionalProperties: false
      properties:
        saved_query_id:
          type: string
          minLength: 1
        version_id:
          type: string
          minLength: 1
        definition:
          $ref: '#/components/schemas/SavedQueryDefinition'
      required:
        - saved_query_id
        - version_id
        - definition
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      description: >-
        API key, not necessarily a JWT. Server derives Organization, permitted
        actions and Corpus scope; every resource access is authorized.

````