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

# Migrate subscription evaluators

> Move the key's Organization's Subscriptions from one version of an alert-rule plugin to the version the active Pipeline Plan serves, after that plugin's upgrade or rollback. It looks at the Subscriptions that are not deleted, enabled or disabled, whose current Version pins plugin_id at from_version, in Subscription id order, at most limit of them, after after. Each one's Saved Query expression and evaluator configuration must validate against the served version's schemas first; one that does not is listed in refused with the first issue and keeps its version. A moved Subscription gets a new current Version that keeps its Saved Query Version, configuration and destination and pins the served version. Like an edit, it judges only changes committed after it, nothing is re-evaluated, Matches keep the Version that produced them, and subscription.updated is announced in each of its Corpora. dry_run true validates and lists what would move without moving anything. A call moves each Subscription at most once; calling again with next_after continues, and repeating a call converges. Subscriptions whose Corpora the key does not all grant are left out. 422 unsupported_evaluator when no version of plugin_id serves new Subscriptions, invalid_migration when from_version is that version. Requires plugins:admin.



## OpenAPI

````yaml /openapi.yaml post /v0/admin/subscriptions/evaluator-migrations
openapi: 3.1.0
info:
  title: Quivr HTTP API
  version: 0.0.0-draft
  description: >-
    Every endpoint of the Quivr v0 HTTP API. Send an API key as a bearer token;
    the key decides the Organization, the actions and the Corpora a request may
    reach.
servers: []
security:
  - ApiKey: []
paths:
  /v0/admin/subscriptions/evaluator-migrations:
    post:
      tags:
        - Admin
      summary: Migrate subscription evaluators
      description: >-
        Move the key's Organization's Subscriptions from one version of an
        alert-rule plugin to the version the active Pipeline Plan serves, after
        that plugin's upgrade or rollback. It looks at the Subscriptions that
        are not deleted, enabled or disabled, whose current Version pins
        plugin_id at from_version, in Subscription id order, at most limit of
        them, after after. Each one's Saved Query expression and evaluator
        configuration must validate against the served version's schemas first;
        one that does not is listed in refused with the first issue and keeps
        its version. A moved Subscription gets a new current Version that keeps
        its Saved Query Version, configuration and destination and pins the
        served version. Like an edit, it judges only changes committed after it,
        nothing is re-evaluated, Matches keep the Version that produced them,
        and subscription.updated is announced in each of its Corpora. dry_run
        true validates and lists what would move without moving anything. A call
        moves each Subscription at most once; calling again with next_after
        continues, and repeating a call converges. Subscriptions whose Corpora
        the key does not all grant are left out. 422 unsupported_evaluator when
        no version of plugin_id serves new Subscriptions, invalid_migration when
        from_version is that version. Requires plugins:admin.
      operationId: migrateSubscriptionEvaluators
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionEvaluatorMigrationRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionEvaluatorMigration'
        default:
          description: >-
            Structured error; 400 malformed, 401 unauthenticated, 403 without
            plugins:admin, 422 invalid_schema, unsupported_evaluator or
            invalid_migration, 503 storage unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SubscriptionEvaluatorMigrationRequest:
      type: object
      additionalProperties: false
      properties:
        plugin_id:
          type: string
          minLength: 1
          maxLength: 256
          description: The alert-rule plugin, such as alerts.
        from_version:
          type: string
          minLength: 1
          maxLength: 256
          description: The version the Subscriptions to move pin now.
        dry_run:
          type: boolean
          description: true validates and lists what would move, without moving anything.
        limit:
          type: integer
          minimum: 1
          maximum: 500
          default: 100
          description: The most Subscriptions this call looks at.
        after:
          type: string
          minLength: 1
          description: >-
            Continue after this Subscription id, the next_after of the previous
            call.
      required:
        - plugin_id
        - from_version
        - dry_run
    SubscriptionEvaluatorMigration:
      type: object
      additionalProperties: false
      properties:
        plugin_id:
          type: string
        from_version:
          type: string
        to_version:
          type: string
          description: The version the active plan serves, which moved Subscriptions pin.
        dry_run:
          type: boolean
        moved:
          type: array
          description: The Subscriptions moved, or that would move in a dry run.
          items:
            $ref: '#/components/schemas/SubscriptionEvaluatorMove'
        refused:
          type: array
          description: >-
            The Subscriptions left on from_version. code is invalid_expression
            or invalid_subscription_configuration when the served version's
            schemas refuse them (field and message name the first issue), or
            subscription_changed when the Subscription got another Version
            during the call.
          items:
            $ref: '#/components/schemas/SubscriptionEvaluatorRefusal'
        next_after:
          type: string
          description: >-
            Present when more Subscriptions may pin from_version; pass it as
            after.
      required:
        - plugin_id
        - from_version
        - to_version
        - dry_run
        - moved
        - refused
    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
    SubscriptionEvaluatorMove:
      type: object
      additionalProperties: false
      properties:
        subscription_id:
          type: string
        from_version_id:
          type: string
          description: The Subscription Version that pinned from_version.
        version_id:
          type: string
          description: The new current Subscription Version; absent in a dry run.
      required:
        - subscription_id
        - from_version_id
    SubscriptionEvaluatorRefusal:
      type: object
      additionalProperties: false
      properties:
        subscription_id:
          type: string
        version_id:
          type: string
          description: Its current Subscription Version, which keeps from_version.
        code:
          type: string
        field:
          type: string
        message:
          type: string
      required:
        - subscription_id
        - version_id
        - code
  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.

````