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

# reprocess knowledge document

> Reprocess a document with the current chunk settings and the
organization's current embedding model. Use it after changing a
group's chunk settings with `PUT /v1/knowledge/groups/{id}`, or to
retry a `FAILED` document.

The document's current content stays searchable until the new version
is `READY`. Poll `GET /v1/knowledge/documents/{id}` for the outcome.

A document with its own `chunkSize` or `chunkOverlap` keeps them by
default. Send `settings: "recommended"` to use Anam's recommended
chunk settings and clear the document's own, or a `chunkSize` and
`chunkOverlap` to save that pair as the document's own.

A document can be reprocessed 24 hours after it last started
processing, or 1 hour after a failure; `reprocessAvailableAt` on the
document says when. Each reprocess counts the file's size (the larger
of its recorded size and its size in storage) against the
organization's monthly knowledge allowance, which uploads share,
whether it succeeds or fails.




## OpenAPI

````yaml https://api.anam.ai/swagger.json post /v1/knowledge/documents/{id}/reprocess
openapi: 3.1.0
info:
  title: Anam AI API
  version: '1.0'
servers:
  - url: https://api.anam.ai
    description: Anam API
security:
  - BearerAuth: []
tags:
  - name: Sessions
  - name: Avatar Videos
  - name: Meetings
  - name: Watermark Checks
  - name: Personas
  - name: Avatars
  - name: Voices
  - name: Pronunciation Dictionaries
  - name: LLMs
  - name: Knowledge
  - name: Tools
  - name: Share Links
  - name: Engine
paths:
  /v1/knowledge/documents/{id}/reprocess:
    post:
      tags:
        - Knowledge
      summary: reprocess knowledge document
      description: |
        Reprocess a document with the current chunk settings and the
        organization's current embedding model. Use it after changing a
        group's chunk settings with `PUT /v1/knowledge/groups/{id}`, or to
        retry a `FAILED` document.

        The document's current content stays searchable until the new version
        is `READY`. Poll `GET /v1/knowledge/documents/{id}` for the outcome.

        A document with its own `chunkSize` or `chunkOverlap` keeps them by
        default. Send `settings: "recommended"` to use Anam's recommended
        chunk settings and clear the document's own, or a `chunkSize` and
        `chunkOverlap` to save that pair as the document's own.

        A document can be reprocessed 24 hours after it last started
        processing, or 1 hour after a failure; `reprocessAvailableAt` on the
        document says when. Each reprocess counts the file's size (the larger
        of its recorded size and its size in storage) against the
        organization's monthly knowledge allowance, which uploads share,
        whether it succeeds or fails.
      operationId: reprocessKnowledgeDocument
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: Knowledge document ID
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeReprocessRequest'
            examples:
              recommended:
                summary: Use Anam's recommended chunk settings
                value:
                  settings: recommended
              chunkSettings:
                summary: Use a given chunk pair
                value:
                  chunkSize: 500
                  chunkOverlap: 50
      responses:
        '202':
          description: >-
            The document is queued for processing and its status is now
            `PROCESSING`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  documentId:
                    type: string
                  knowledgeFolderId:
                    type: string
                  filename:
                    type: string
                  status:
                    type: string
                    enum:
                      - PROCESSING
        '400':
          description: >-
            Invalid body. Send no body, `{ "settings": "current" }`, `{
            "settings": "recommended" }`, or a valid `chunkSize` and
            `chunkOverlap` together.
        '401':
          description: Unauthorized - Invalid or missing API key
        '403':
          description: Forbidden - API key lacks the `knowledge` write permission
        '404':
          description: Document not found, or it belongs to another organization
        '409':
          description: >-
            The document is still uploading or processing. Reprocess it once it
            is `READY` or `FAILED`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeReprocessRefusal'
        '422':
          description: >-
            The file in storage is larger than the 50 MB upload limit (`reason`
            is `too_large`). Upload it again within the limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeReprocessRefusal'
        '429':
          description: >-
            Too Many Requests - a limit applies; retry after `availableAt`.
            `reason` is `cooldown` (processed too recently), `monthly_limit`
            (the file doesn't fit in what is left of this month's knowledge
            allowance) or `contended` (uploads or reprocesses in progress hold
            the rest of the allowance for now).
          headers:
            Retry-After:
              description: Seconds until the document can be reprocessed.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeReprocessRefusal'
        '500':
          description: Server error
        '503':
          description: >-
            Reprocessing is unavailable, or the API key could not be checked.
            Retry after `Retry-After` seconds.
          headers:
            Retry-After:
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceUnavailableError'
components:
  schemas:
    KnowledgeReprocessRequest:
      type: object
      description: >-
        Optional. An empty body is `current`. Give either `settings`, or
        `chunkSize` and `chunkOverlap` together, not both.
      properties:
        settings:
          type: string
          enum:
            - current
            - recommended
          default: current
          description: >-
            `current` uses each document's own `chunkSize` and `chunkOverlap` if
            it has them, else its group's. `recommended` uses Anam's recommended
            chunk settings (350 and 0) whatever the document or group sets, and
            clears the document's own, so it follows its group again on later
            reprocesses. On a group it also sets the group's chunk settings to
            the recommended ones. Every reprocess embeds with the organization's
            current embedding model.
        chunkSize:
          type: integer
          minimum: 100
          maximum: 2000
          description: >-
            With `chunkOverlap`, the chunk pair to use instead of `settings`, in
            tokens, as on upload. On a document it becomes the document's own
            chunk settings. On a group it becomes the group's, and its documents
            drop their own and follow it. JSON documents are kept whole (split
            only when large) whatever the pair.
        chunkOverlap:
          type: integer
          minimum: 0
          maximum: 1000
          description: >-
            Tokens shared by neighbouring chunks, at most half of `chunkSize`.
            Given with `chunkSize`.
      additionalProperties: false
    KnowledgeReprocessRefusal:
      type: object
      required:
        - error
        - reason
        - availableAt
      properties:
        error:
          type: string
          description: Why nothing was reprocessed, in words to show a user.
        reason:
          type: string
          enum:
            - in_progress
            - cooldown
            - monthly_limit
            - contended
            - too_large
        availableAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When to try again; null for `in_progress`.
    ServiceUnavailableError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          example: Service temporarily unavailable
        message:
          type: string
          example: We could not check your API key. Please retry shortly.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.