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

# Ingest batch

> Initial bound: 100 entries (413 batch_too_large), envelope 10 MiB (413 request_too_large). Validate envelope structure/size first, then each entry independently against IngestCommand, including wrong types or missing fields. Each raw entry is also held to the 1 MiB single-request bound (entry error entry_too_large), so the same entry bytes are never refused for size alone. HTTP 200 carries Receipt or Error per entry, with the same error codes as single submission. Same ingestion family/key as single submission. Reuse entry keys after unknown transport outcomes.



## OpenAPI

````yaml /openapi.yaml post /v0/records/batch
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/records/batch:
    post:
      tags:
        - Records
      summary: Ingest batch
      description: >-
        Initial bound: 100 entries (413 batch_too_large), envelope 10 MiB (413
        request_too_large). Validate envelope structure/size first, then each
        entry independently against IngestCommand, including wrong types or
        missing fields. Each raw entry is also held to the 1 MiB single-request
        bound (entry error entry_too_large), so the same entry bytes are never
        refused for size alone. HTTP 200 carries Receipt or Error per entry,
        with the same error codes as single submission. Same ingestion
        family/key as single submission. Reuse entry keys after unknown
        transport outcomes.
      operationId: ingestBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchResult'
        default:
          description: >-
            Structured error. 400 malformed; 401 unauthenticated; 403 forbidden
            action; 404 absent or inaccessible; 409 conflict; 413 oversized; 422
            invalid input; 429 throttled; 503 temporary failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    BatchRequest:
      type: object
      additionalProperties: false
      properties:
        items:
          type: array
          items: {}
          minItems: 1
          maxItems: 100
      required:
        - items
      description: >-
        Envelope validation checks items array and batch/body limits only. Each
        raw entry is independently validated as IngestCommand; even a missing
        required field or wrong JSON type returns an entry error. SDK
        convenience builders may type valid entries as IngestCommand, but server
        envelope validation must not reject the entire batch for an invalid
        entry.
    BatchResult:
      type: object
      additionalProperties: false
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/BatchItem'
          maxItems: 100
      required:
        - items
    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
    BatchItem:
      type: object
      additionalProperties: false
      properties:
        index:
          type: integer
          minimum: 0
        receipt:
          $ref: '#/components/schemas/Receipt'
        error:
          $ref: '#/components/schemas/Error'
      required:
        - index
      if:
        required:
          - receipt
      then:
        not:
          required:
            - error
      else:
        required:
          - error
    Receipt:
      type: object
      additionalProperties: false
      properties:
        receipt_id:
          type: string
          minLength: 1
        state:
          type: string
          enum:
            - pending
            - resolved
        outcome:
          type: string
          enum:
            - created
            - duplicate
            - withdrawal_applied
            - conflict
        record_id:
          type: string
          minLength: 1
        version_id:
          type: string
          minLength: 1
        availability:
          $ref: '#/components/schemas/Availability'
        diagnostics:
          type: array
          items:
            $ref: '#/components/schemas/Error'
          maxItems: 20
        source:
          $ref: '#/components/schemas/SourceIdentity'
        processing:
          $ref: '#/components/schemas/ProcessingSummary'
      required:
        - receipt_id
        - state
        - diagnostics
        - source
        - processing
      description: >-
        Durable acceptance outcome, not workflow state. Availability is a
        separate authorized live read view; omitted before a linked version
        exists. Infrastructure retry never resolves a Receipt as failed.
      if:
        properties:
          state:
            const: pending
      then:
        not:
          required:
            - outcome
      else:
        required:
          - outcome
    Availability:
      type: object
      additionalProperties: false
      properties:
        state:
          type: string
          enum:
            - materialized
            - building_baseline
            - retrieval_ready
            - quarantined
        is_current:
          type: boolean
        searchable:
          type: boolean
      required:
        - state
        - is_current
        - searchable
    SourceIdentity:
      type: object
      additionalProperties: false
      properties:
        corpus_id:
          type: string
          minLength: 1
        namespace:
          type: string
          minLength: 1
        record_key:
          type: string
          minLength: 1
      required:
        - corpus_id
        - namespace
        - record_key
    ProcessingSummary:
      type: object
      additionalProperties: false
      required:
        - state
      properties:
        state:
          type: string
          enum:
            - queued
            - running
            - retrying
            - blocked
            - idle
        phase:
          type: string
          enum:
            - materialization
            - baseline
            - enrichment
        message:
          type: string
      description: >-
        Live read view, not a Receipt lifecycle or public workflow identifier.
        blocked means an outstanding contribution needs intervention;
        diagnostics describe why. idle means no work currently pending, not a
        promise of final enrichment. Phase is omitted when idle; required and
        optional progress do not override Version Availability.
  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.

````