> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prisme.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Bulk reindex DISPATCHER - queue re-processing of every document

> One POST queues the full extraction pipeline (fetch → parse →
chunk → embed) on EVERY known document of the knowledge base -
uploaded files, connector/remote docs AND existing web pages
(including auto-discovered ones) - re-processing them with the
current store settings plus each document's persisted overrides.
Use after a store-level parser or chunking change to roll it out
across the whole KB. No request body: per-document overrides stay
on `POST /documents/{document_id}/reindex`.

**Dispatch-only, by design.** The request does only auth, a
count, one atomic lease acquire and one internal batch kick, then
returns `202`. All per-document work runs ASYNCHRONOUSLY
afterwards (batches of 100, keyset-paginated by id, chained
through the platform events API so each link restarts at call
depth 0). The response reports what was DISPATCHED, never real
parse/embed completion - `status` is `dispatching` (or `complete`
for an empty KB), and the terminal
`storage.kb.reindex.dispatch_completed` event likewise reports
counts of what was queued (`visited`, `dispatched`,
`skipped_missing_file`, `dispatch_failed`). There is intentionally
NO completion or progress tracking; a document that later fails to
parse/embed surfaces through its own `status`, not here.

Documented characteristics of the dispatch-only design:
- **Best-effort live set, not a snapshot.** Documents are walked
  by keyset pagination during the run; rows inserted or deleted
  mid-run may or may not be visited.
- **Burst, not throttled backpressure.** Batches are spaced by a
  small delay only; a large KB enqueues its whole document set
  into the pipeline over a short window (milder than, and
  replacing, the legacy synchronous fan-out).
- **Concurrency guard is dispatcher-only.** An atomic lease
  prevents two overlapping reindex DISPATCHES; it does NOT guard a
  reindex overlapping ordinary ingestion, does not interact with
  the crawl pause state, and does not block on a running crawl.
- **No new-page discovery.** Existing/known web pages are
  re-fetched (depth-0); discovery of NEW pages runs on the crawl
  `periodicity` schedule, not here (there is no manual recrawl -
  removed 2026-07-20 as it never discovered pages).

Requires `editor`+.




## OpenAPI

````yaml /api-reference/storage/swagger.yml post /v1/knowledge_bases/{knowledgeBaseId}/reindex
openapi: 3.0.3
info:
  version: 1.0.0
  title: Knowledges API
  description: >
    Public REST API for the Prisme.ai Knowledges (storage) workspace: knowledge
    bases, documents (uploaded files, web pages, remote files, connector
    documents), recurring web-crawl sources, semantic search, access control,
    per-knowledge-base API keys, and skills.


    Resource identifiers use the physical prefixes emitted by the implementation
    (`vs_` knowledge base, `vsf_` document, `seed_` web source, `kb-` API-key
    slug).


    This spec documents the public REST surface only. Internal helpers (private
    automations prefixed with `_`) and admin/GDPR lifecycle operations are not
    part of the public contract.
  contact:
    name: Prisme.ai
    url: https://prisme.ai
servers:
  - url: https://{host}/v2/workspaces/slug:storage/webhooks
    description: Prisme.ai workspace webhooks
    variables:
      host:
        default: api.studio.prisme.ai
        description: API host (override for self-hosted or sandbox)
security:
  - BearerAuth: []
  - WorkspaceApiKeyAuth: []
tags:
  - name: Knowledge Bases
    description: >-
      Create, list, read, update, and delete knowledge bases (vector-backed
      document stores).
  - name: Documents
    description: >-
      Ingest and manage documents (uploaded files, web pages, remote files,
      connector documents) and their indexing.
  - name: Web Sources
    description: >-
      Recurring web crawl seeds that discover and index pages into a knowledge
      base.
  - name: Search
    description: Semantic search over a knowledge base.
  - name: Access
    description: Per-knowledge-base access bindings (user, group, org, agent principals).
  - name: API Keys
    description: Per-knowledge-base API keys for connector authentication.
  - name: Stats
    description: Aggregate dashboard statistics.
  - name: Skills
    description: Prompt/instruction registry entries.
paths:
  /v1/knowledge_bases/{knowledgeBaseId}/reindex:
    parameters:
      - name: knowledgeBaseId
        in: path
        required: true
        schema:
          type: string
          pattern: ^vs_[A-Za-z0-9-]+$
          maxLength: 128
        description: >-
          Knowledge base id. Legacy physical prefix `vs_` (the `kb_` rename is
          deferred).
    post:
      tags:
        - Knowledge Bases
      summary: Bulk reindex DISPATCHER - queue re-processing of every document
      description: |
        One POST queues the full extraction pipeline (fetch → parse →
        chunk → embed) on EVERY known document of the knowledge base -
        uploaded files, connector/remote docs AND existing web pages
        (including auto-discovered ones) - re-processing them with the
        current store settings plus each document's persisted overrides.
        Use after a store-level parser or chunking change to roll it out
        across the whole KB. No request body: per-document overrides stay
        on `POST /documents/{document_id}/reindex`.

        **Dispatch-only, by design.** The request does only auth, a
        count, one atomic lease acquire and one internal batch kick, then
        returns `202`. All per-document work runs ASYNCHRONOUSLY
        afterwards (batches of 100, keyset-paginated by id, chained
        through the platform events API so each link restarts at call
        depth 0). The response reports what was DISPATCHED, never real
        parse/embed completion - `status` is `dispatching` (or `complete`
        for an empty KB), and the terminal
        `storage.kb.reindex.dispatch_completed` event likewise reports
        counts of what was queued (`visited`, `dispatched`,
        `skipped_missing_file`, `dispatch_failed`). There is intentionally
        NO completion or progress tracking; a document that later fails to
        parse/embed surfaces through its own `status`, not here.

        Documented characteristics of the dispatch-only design:
        - **Best-effort live set, not a snapshot.** Documents are walked
          by keyset pagination during the run; rows inserted or deleted
          mid-run may or may not be visited.
        - **Burst, not throttled backpressure.** Batches are spaced by a
          small delay only; a large KB enqueues its whole document set
          into the pipeline over a short window (milder than, and
          replacing, the legacy synchronous fan-out).
        - **Concurrency guard is dispatcher-only.** An atomic lease
          prevents two overlapping reindex DISPATCHES; it does NOT guard a
          reindex overlapping ordinary ingestion, does not interact with
          the crawl pause state, and does not block on a running crawl.
        - **No new-page discovery.** Existing/known web pages are
          re-fetched (depth-0); discovery of NEW pages runs on the crawl
          `periodicity` schedule, not here (there is no manual recrawl -
          removed 2026-07-20 as it never discovered pages).

        Requires `editor`+.
      operationId: reindexKnowledgeBase
      responses:
        '202':
          description: |
            Reindex dispatched (or a no-op for an empty KB). `status` is
            `dispatching` when documents were queued, `complete` when the
            KB has no documents (no lease is taken).
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  object:
                    type: string
                    enum:
                      - knowledge_base.reindex
                  knowledge_base_id:
                    type: string
                  status:
                    type: string
                    enum:
                      - dispatching
                      - complete
                  documents_queued:
                    type: integer
                    description: Documents queued for re-processing (0 for an empty KB).
              examples:
                dispatching:
                  value:
                    object: knowledge_base.reindex
                    knowledge_base_id: vs_7c9e6679-7425-40de-944b-e07fc1f90ae7
                    status: dispatching
                    documents_queued: 342
                empty:
                  value:
                    object: knowledge_base.reindex
                    knowledge_base_id: vs_7c9e6679-7425-40de-944b-e07fc1f90ae7
                    status: complete
                    documents_queued: 0
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '409':
          description: |
            A reindex dispatch is already in progress for this knowledge
            base (its lease is still live). Staleness is judged on the
            lease expiry (15 min of no progress), never the immutable
            start time, so a dispatcher that died mid-run frees the lock
            automatically.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                already_running:
                  value:
                    error:
                      code: REINDEX_ALREADY_RUNNING
                      message: >-
                        A reindex is already in progress for this knowledge
                        base.
                      details:
                        started_at: '2026-07-20T10:15:00.000Z'
        '429':
          $ref: '#/components/responses/Error429'
        '502':
          description: |
            The reindex could not be started (the first internal batch
            could not be enqueued after retries); the lease is released so
            a retry is immediately possible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                dispatch_failed:
                  value:
                    error:
                      code: REINDEX_DISPATCH_FAILED
                      message: Could not start the reindex. Please try again.
      security:
        - BearerAuth: []
        - WorkspaceApiKeyAuth: []
components:
  responses:
    Error401:
      description: Authentication missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthenticated:
              value:
                error:
                  code: UNAUTHENTICATED
                  message: Authentication required.
    Error403:
      description: Authentication present, authorization denied.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              value:
                error:
                  code: FORBIDDEN
                  message: Caller is not allowed to access this resource.
            hook_rejected:
              summary: An external content hook blocked ingestion (sync)
              value:
                error:
                  code: HOOK_REJECTED
                  message: Content was rejected by a compliance hook.
                  details:
                    rejected_by: hook_pii_filter
                    rejection_reason: detected_unmasked_pii
    Error404:
      description: Resource does not exist or is not visible to the caller.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            not_found:
              value:
                error:
                  code: NOT_FOUND
                  message: knowledge_base.document not found.
                  details:
                    resource: knowledge_base.document
                    id: vsf_unknown
    Error429:
      description: Rate limited.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds the caller should wait before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      description: |
        Single error envelope shared by every non-2xx response. `code`
        is the stable machine-readable identifier; `message` is the
        human-readable text; `details` is optional structured context.
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
            details:
              type: object
              additionalProperties: true
      required:
        - error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        User session JWT or instance API key (`iak_*`). Send as `Authorization:
        Bearer <token>`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key
      description: Workspace- or knowledge-base-scoped API key.

````