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

# Rebuild corpus projection

> Durably commit a projection_rebuild Operation and dispatch intent before returning. Rebuild the requested Corpus from canonical text and durable artifacts, then activate its validated logical generation. Same Organization + Corpus + rebuild route + idempotency key and canonical request returns the same Operation, including after terminal completion; changed request conflicts. HTTP does not wait for reconstruction. Retries/restarts keep identity and target generation. Preserve other Corpora when physical storage is shared. Normal ingestion/withdrawal guards still apply. Live evaluation schema migrations remain a separate mechanism. Activation follows acceptance order, so a rebuild accepted before one that already activated for the same Corpus and retrieval configuration fails with operation_superseded instead of replacing it.



## OpenAPI

````yaml /openapi.yaml post /v0/corpora/{corpus_id}/rebuilds
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/corpora/{corpus_id}/rebuilds:
    post:
      tags:
        - Corpora
      summary: Rebuild corpus projection
      description: >-
        Durably commit a projection_rebuild Operation and dispatch intent before
        returning. Rebuild the requested Corpus from canonical text and durable
        artifacts, then activate its validated logical generation. Same
        Organization + Corpus + rebuild route + idempotency key and canonical
        request returns the same Operation, including after terminal completion;
        changed request conflicts. HTTP does not wait for reconstruction.
        Retries/restarts keep identity and target generation. Preserve other
        Corpora when physical storage is shared. Normal ingestion/withdrawal
        guards still apply. Live evaluation schema migrations remain a separate
        mechanism. Activation follows acceptance order, so a rebuild accepted
        before one that already activated for the same Corpus and retrieval
        configuration fails with operation_superseded instead of replacing it.
      operationId: rebuildCorpusProjection
      parameters:
        - name: corpus_id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionRequest'
      responses:
        '202':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Operation'
          headers:
            Location:
              description: Authorized Operation read URL.
              schema:
                type: string
                format: uri-reference
        default:
          description: >-
            Structured error; 400 malformed, 401 unauthenticated, 403
            unauthorized scope/action, 404 absent/inaccessible, 409 idempotency
            conflict, 422 unsupported profile/input, 503 dependency unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ActionRequest:
      type: object
      additionalProperties: false
      properties:
        idempotency_key:
          type: string
          minLength: 1
      required:
        - idempotency_key
    Operation:
      type: object
      additionalProperties: false
      properties:
        operation_id:
          type: string
          minLength: 1
        kind:
          type: string
          minLength: 1
        state:
          type: string
          enum:
            - queued
            - running
            - 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'
      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 and retrieval_configuration
        Operations require corpus_id; when succeeded they require result naming
        the activated logical generation. This result shape covers those two
        command kinds only.
      if:
        properties:
          kind:
            enum:
              - projection_rebuild
              - retrieval_configuration
        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.
  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.

````