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

> Atomically create enabled Subscription/Version and activation boundary in commit-ordered journal. Evaluate future eligible transitions, not existing history. Replay same key/request returns same identity and does not reactivate a disabled Subscription. The evaluator must be installed (422 unsupported_evaluator); the pinned Saved Query Version expression and the evaluator configuration must satisfy the evaluator's declared schemas (422 invalid_expression with field /saved_query_version_id, or invalid_subscription_configuration with field /evaluator/configuration/...; message names the first schema issue).



## OpenAPI

````yaml /openapi.yaml post /v0/subscriptions
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/subscriptions:
    post:
      tags:
        - Subscriptions
      summary: Create subscription
      description: >-
        Atomically create enabled Subscription/Version and activation boundary
        in commit-ordered journal. Evaluate future eligible transitions, not
        existing history. Replay same key/request returns same identity and does
        not reactivate a disabled Subscription. The evaluator must be installed
        (422 unsupported_evaluator); the pinned Saved Query Version expression
        and the evaluator configuration must satisfy the evaluator's declared
        schemas (422 invalid_expression with field /saved_query_version_id, or
        invalid_subscription_configuration with field
        /evaluator/configuration/...; message names the first schema issue).
      operationId: createSubscription
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionCreate'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        default:
          description: >-
            Structured error. Existing /v0 authentication, scope, pagination and
            idempotency semantics apply.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SubscriptionCreate:
      type: object
      additionalProperties: false
      properties:
        idempotency_key:
          type: string
          minLength: 1
        name:
          type: string
          minLength: 1
        saved_query_id:
          type: string
          minLength: 1
        saved_query_version_id:
          type: string
          minLength: 1
        evaluator:
          $ref: '#/components/schemas/EvaluatorConfig'
        destination_id:
          type: string
          minLength: 1
        owner:
          $ref: '#/components/schemas/SubscriptionOwner'
      required:
        - idempotency_key
        - name
        - saved_query_id
        - saved_query_version_id
        - evaluator
        - destination_id
      description: >-
        Create enabled from-now Subscription. An optional owner makes it the
        Subscription of one end user of the client application; without one it
        is global to the Organization. The owner is fixed for the Subscription's
        life and part of the idempotent request. One deployment-configured
        destination per version; destination belongs to this Organization. URL
        and signing key are provisioned outside this API and not returned. No
        inline secret or dynamic destination registry in the tracer.
    Subscription:
      type: object
      additionalProperties: false
      properties:
        subscription_id:
          type: string
          minLength: 1
        name:
          type: string
          minLength: 1
        enabled:
          type: boolean
        deleted:
          type: boolean
          description: >-
            Logically deleted for good; a deleted Subscription is also disabled
            and stays readable with its Versions, Matches and Deliveries.
        current_version:
          $ref: '#/components/schemas/SubscriptionVersion'
        owner:
          $ref: '#/components/schemas/SubscriptionOwner'
      required:
        - subscription_id
        - name
        - enabled
        - deleted
        - current_version
      description: Absent owner means a global, organization-wide Subscription.
    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
    EvaluatorConfig:
      type: object
      additionalProperties: false
      properties:
        plugin_id:
          type: string
          minLength: 1
        version:
          type: string
          minLength: 1
        configuration:
          type: object
          additionalProperties: true
      required:
        - plugin_id
        - version
        - configuration
      description: >-
        Pins an installed evaluator by plugin id and version, and its
        configuration. Evaluators are the subscription Contributions of the
        plugins pinned at startup (Plugin Protocol v0); test deployments may
        also install the deterministic fixture quivr.fixture@1. The
        configuration must satisfy the evaluator's declared configuration
        schema.
    SubscriptionOwner:
      type: string
      minLength: 1
      maxLength: 128
      description: >-
        Subscription Owner, an opaque end-user reference defined by the client
        application (for example user-123). Quivr stores, filters and echoes it
        without interpreting it. At most 128 characters without control
        characters; none is reserved for the listing filter (422 invalid_owner).
    SubscriptionVersion:
      type: object
      additionalProperties: false
      properties:
        subscription_id:
          type: string
          minLength: 1
        version_id:
          type: string
          minLength: 1
        saved_query_id:
          type: string
          minLength: 1
        saved_query_version_id:
          type: string
          minLength: 1
        evaluator:
          $ref: '#/components/schemas/EvaluatorConfig'
        destination_id:
          type: string
          minLength: 1
        owner:
          $ref: '#/components/schemas/SubscriptionOwner'
      required:
        - subscription_id
        - version_id
        - saved_query_id
        - saved_query_version_id
        - evaluator
        - destination_id
      description: >-
        Immutable Subscription configuration. Every Version keeps the
        Subscription's owner, absent for a global Subscription.
  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.

````