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

# Request backfill

> Reprocess a Corpus's past Versions with the active ingestion plugin, to fill vector spaces of the generation the Corpus is routed to, typically a new evaluation space. The scope is the Corpus and, optionally, a window on when Quivr accepted its Versions. Only Versions whose segments all hold a vector in the served space and miss one in a target space are processed; live enrichment fills the target spaces for newer Versions once the backfill has started. A dry run is required. dry_run true answers 200 with the estimate and records it under the idempotency key. The same body with dry_run false then accepts the backfill as a queued Operation (202, Location). Without a dry run recorded under that key and scope, the answer is 409 dry_run_required. An estimated cost above the deployment's backfill.max_cost_without_confirmation needs confirm_cost true, otherwise 409 cost_confirmation_required. The same key with another scope is 409 idempotency_conflict, and an accepted key replays its Operation. A Corpus whose previous backfill has not finished is 409 backfill_in_progress. The backfill runs on its own task queue at the deployment's backfill.rate, pinned to the Pipeline Plan active when it starts. It can be paused, resumed and canceled, and resumes from its checkpoint after a restart. It never creates Record Versions or content events. Versions whose projected segments the plugin would cut differently are skipped and counted (segmentation_differs), and a rebuild re-segments them. Requires plugins:admin, on a key of the Corpus's Organization that grants the Corpus.



## OpenAPI

````yaml /openapi.yaml post /v0/admin/backfills
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/backfills:
    post:
      tags:
        - Admin
      summary: Request backfill
      description: >-
        Reprocess a Corpus's past Versions with the active ingestion plugin, to
        fill vector spaces of the generation the Corpus is routed to, typically
        a new evaluation space. The scope is the Corpus and, optionally, a
        window on when Quivr accepted its Versions. Only Versions whose segments
        all hold a vector in the served space and miss one in a target space are
        processed; live enrichment fills the target spaces for newer Versions
        once the backfill has started. A dry run is required. dry_run true
        answers 200 with the estimate and records it under the idempotency key.
        The same body with dry_run false then accepts the backfill as a queued
        Operation (202, Location). Without a dry run recorded under that key and
        scope, the answer is 409 dry_run_required. An estimated cost above the
        deployment's backfill.max_cost_without_confirmation needs confirm_cost
        true, otherwise 409 cost_confirmation_required. The same key with
        another scope is 409 idempotency_conflict, and an accepted key replays
        its Operation. A Corpus whose previous backfill has not finished is 409
        backfill_in_progress. The backfill runs on its own task queue at the
        deployment's backfill.rate, pinned to the Pipeline Plan active when it
        starts. It can be paused, resumed and canceled, and resumes from its
        checkpoint after a restart. It never creates Record Versions or content
        events. Versions whose projected segments the plugin would cut
        differently are skipped and counted (segmentation_differs), and a
        rebuild re-segments them. Requires plugins:admin, on a key of the
        Corpus's Organization that grants the Corpus.
      operationId: requestBackfill
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BackfillRequest'
      responses:
        '200':
          description: The dry run's estimate, recorded under the key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackfillEstimate'
        '202':
          description: The accepted backfill Operation; read it at the Location.
          headers:
            Location:
              required: true
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Operation'
        default:
          description: >-
            Structured error; 400 malformed, 401 unauthenticated, 403 without
            plugins:admin, 404 unknown Corpus, 409 dry_run_required,
            cost_confirmation_required, idempotency_conflict,
            backfill_in_progress, registration_not_active or rebuild_required
            (the Corpus's generation predates named vector spaces), 422
            invalid_schema or invalid_backfill (a space the plugin does not
            declare or the deployment does not enable, or an empty window), 503
            storage unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    BackfillRequest:
      type: object
      additionalProperties: false
      properties:
        idempotency_key:
          type: string
          minLength: 1
          maxLength: 200
        corpus_id:
          type: string
          minLength: 1
        accepted_after:
          type: string
          format: date-time
          description: >-
            Only Versions Quivr accepted at or after this time; absent, from the
            first.
        accepted_before:
          type: string
          format: date-time
          description: Only Versions Quivr accepted before this time; absent, up to now.
        registration_id:
          type: string
          minLength: 1
          description: >-
            The ingestion plugin registration to run; absent, the active plan's.
            Another one is 409 registration_not_active.
        spaces:
          type: array
          minItems: 1
          maxItems: 8
          uniqueItems: true
          items:
            type: string
            minLength: 1
          description: >-
            The vector spaces to fill, which the plugin declares and the
            deployment serves or evaluates; absent, the deployment's evaluation
            spaces the plugin owns.
        dry_run:
          type: boolean
          description: >-
            true reports the estimate and records it; false starts the backfill
            a dry run with the same key and scope preceded.
        confirm_cost:
          type: boolean
          default: false
          description: >-
            Accept an estimated cost above the deployment's
            backfill.max_cost_without_confirmation.
      required:
        - idempotency_key
        - corpus_id
        - dry_run
    BackfillEstimate:
      type: object
      additionalProperties: false
      properties:
        registration_id:
          type: string
          minLength: 1
        spaces:
          type: array
          items:
            type: string
            minLength: 1
        versions:
          type: integer
          minimum: 0
          description: Versions in scope that miss a vector in a target space.
        segments:
          type: integer
          minimum: 0
          description: Their segments, which the plugin embeds.
        input_tokens:
          type: integer
          minimum: 0
          description: >-
            Estimated tokens the plugin embeds, one per four code points of
            segment text.
        estimated_seconds:
          type: number
          format: double
          minimum: 0
          description: >-
            How long the backfill should take, at the deployment's backfill.rate
            or the recent throughput, whichever is slower.
        duration_basis:
          type: string
          enum:
            - rate
            - recent_backfills
            - recent_plugin_calls
          description: What the duration comes from.
        estimated_cost_usd:
          type: number
          format: double
          minimum: 0
          description: >-
            Estimated cost in US dollars, rounded up to the cent, of the target
            spaces that declare an input_price in the plugin manifest; a space
            without one adds nothing. Absent when none declares one, so the cost
            is unknown.
        confirmation_required:
          type: boolean
          description: >-
            The cost exceeds backfill.max_cost_without_confirmation, so starting
            the backfill needs confirm_cost.
      required:
        - registration_id
        - spaces
        - versions
        - segments
        - input_tokens
        - estimated_seconds
        - duration_basis
        - confirmation_required
    Operation:
      type: object
      additionalProperties: false
      properties:
        operation_id:
          type: string
          minLength: 1
        kind:
          type: string
          minLength: 1
        state:
          type: string
          enum:
            - queued
            - running
            - paused
            - succeeded
            - failed
            - cancel_requested
            - canceled
        progress:
          type: number
          minimum: 0
          maximum: 1
          description: Approximate fraction, omitted when unknown.
        counters:
          type: object
          additionalProperties:
            type: integer
            minimum: 0
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
          maxItems: 20
        previous_operation_id:
          type: string
          minLength: 1
        corpus_id:
          type: string
          minLength: 1
        result:
          $ref: '#/components/schemas/ProjectionRebuildResult'
        backfill:
          $ref: '#/components/schemas/OperationBackfill'
        quarantine_reprocess:
          $ref: '#/components/schemas/OperationQuarantineReprocess'
      required:
        - operation_id
        - kind
        - state
        - counters
        - errors
      description: >-
        Administrative execution only. Retries keep identity. Intentional
        terminal rerun has a new ID and previous_operation_id. Cancellation does
        not promise universal rollback; already-terminal state and racing
        completion may win. projection_rebuild, retrieval_configuration and
        backfill Operations require corpus_id; when succeeded they require
        result naming the activated logical generation, or for a backfill the
        generation it filled. A backfill also carries backfill, and its counters
        versions_in_scope, versions_done, versions_skipped (with
        skipped_<reason>) and segments. A quarantine_reprocess carries corpus_id
        and quarantine_reprocess, and its counters versions_in_scope,
        versions_recovered, versions_quarantined and versions_skipped (with
        skipped_<reason>); it has no result. Only a backfill and a
        quarantine_reprocess can be paused.
      if:
        properties:
          kind:
            enum:
              - projection_rebuild
              - retrieval_configuration
              - backfill
        required:
          - kind
      then:
        required:
          - corpus_id
        if:
          properties:
            state:
              const: succeeded
          required:
            - state
        then:
          required:
            - result
    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
    ProjectionRebuildResult:
      type: object
      additionalProperties: false
      properties:
        projection_generation_id:
          type: string
          minLength: 1
      required:
        - projection_generation_id
      description: >-
        Logical generation activated for the requested Corpus. Opaque ID, never
        a physical search collection name.
    OperationBackfill:
      type: object
      additionalProperties: false
      description: What a backfill fills and how far it got.
      properties:
        registration_id:
          type: string
          minLength: 1
        spaces:
          type: array
          items:
            type: string
            minLength: 1
        accepted_after:
          type: string
          format: date-time
        accepted_before:
          type: string
          format: date-time
        plan_id:
          type: string
          minLength: 1
          description: The Pipeline Plan the backfill is pinned to, once it started.
        checkpoint:
          type: string
          minLength: 1
          description: >-
            The last Version id it finished; it resumes after it, in Version id
            order.
        estimate:
          $ref: '#/components/schemas/BackfillEstimate'
      required:
        - registration_id
        - spaces
        - estimate
    OperationQuarantineReprocess:
      type: object
      additionalProperties: false
      description: >-
        What a quarantine reprocess covers, the plan it runs with and the dry
        run it followed.
      properties:
        plugin:
          type: string
          minLength: 1
        code:
          type: string
          minLength: 1
        quarantined_after:
          type: string
          format: date-time
        quarantined_before:
          type: string
          format: date-time
        plan_id:
          type: string
          minLength: 1
          description: The Pipeline Plan it runs with, the one active when it was accepted.
        estimate:
          $ref: '#/components/schemas/QuarantineReprocessEstimate'
      required:
        - plan_id
        - estimate
    QuarantineReprocessEstimate:
      type: object
      additionalProperties: false
      properties:
        versions:
          type: integer
          minimum: 0
          description: Stuck Versions in scope.
        stages:
          type: object
          description: Of them, how many failed at each step.
          properties:
            normalization:
              type: integer
              minimum: 0
            ingestion:
              type: integer
              minimum: 0
          required:
            - normalization
            - ingestion
          additionalProperties: false
        codes:
          type: object
          description: Of them, how many by reason code.
          additionalProperties:
            type: integer
            minimum: 0
      required:
        - versions
        - stages
        - codes
  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.

````