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

> Edit a Saved Query by committing a new immutable Version that becomes its current Version, with saved_query.updated in every Corpus of the previous and new scope. Subscriptions keep the Version they pin; a new Subscription Version moves one. The key must grant every Corpus of the current and new definitions. Replay of the same key and request returns the same Version; a changed request is 409 idempotency_conflict. A deleted Saved Query is 409 saved_query_deleted.



## OpenAPI

````yaml /openapi.yaml post /v0/saved-queries/{saved_query_id}/versions
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/{saved_query_id}/versions:
    post:
      tags:
        - Saved queries
      summary: Create saved query version
      description: >-
        Edit a Saved Query by committing a new immutable Version that becomes
        its current Version, with saved_query.updated in every Corpus of the
        previous and new scope. Subscriptions keep the Version they pin; a new
        Subscription Version moves one. The key must grant every Corpus of the
        current and new definitions. Replay of the same key and request returns
        the same Version; a changed request is 409 idempotency_conflict. A
        deleted Saved Query is 409 saved_query_deleted.
      operationId: createSavedQueryVersion
      parameters:
        - name: saved_query_id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedQueryVersionCreate'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedQueryVersion'
        default:
          description: >-
            Structured error. Existing /v0 authentication, scope, pagination and
            idempotency semantics apply.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SavedQueryVersionCreate:
      type: object
      additionalProperties: false
      properties:
        idempotency_key:
          type: string
          minLength: 1
        definition:
          $ref: '#/components/schemas/SavedQueryDefinition'
      required:
        - idempotency_key
        - definition
      description: >-
        New immutable definition of an existing Saved Query. The name is
        unchanged (rename changes it).
    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
    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.
  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.

````