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

# presigned upload knowledge group

> Start a direct upload of a document to a knowledge folder, for files too large for the multipart `POST /v1/knowledge/groups/{id}/documents` (whose request body is limited to about 4.5MB). Flow: (1) call this endpoint with the file's name, type and size to get an `uploadUrl` and a `documentId`; (2) `PUT` the file's bytes to `uploadUrl` with the same `Content-Type`; (3) call `POST /v1/knowledge/documents/{id}/confirm-upload` with the `documentId` to measure the file and start processing. The document stays `UPLOADED` until then. Supports PDF, DOC, DOCX, CSV, MD, TXT, LOG and JSON files up to 50MB, chosen by the `filename` extension; any other type is refused. The declared `fileSize` is checked against the 50MB limit and the organization's monthly knowledge upload quota here, and counts towards the quota until confirmation records the measured size. Requires an API key with knowledge write access.



## OpenAPI

````yaml https://api.anam.ai/swagger.json post /v1/knowledge/groups/{id}/documents/presigned-upload
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/groups/{id}/documents/presigned-upload:
    post:
      tags:
        - Knowledge
      summary: presigned upload knowledge group
      description: >-
        Start a direct upload of a document to a knowledge folder, for files too
        large for the multipart `POST /v1/knowledge/groups/{id}/documents`
        (whose request body is limited to about 4.5MB). Flow: (1) call this
        endpoint with the file's name, type and size to get an `uploadUrl` and a
        `documentId`; (2) `PUT` the file's bytes to `uploadUrl` with the same
        `Content-Type`; (3) call `POST
        /v1/knowledge/documents/{id}/confirm-upload` with the `documentId` to
        measure the file and start processing. The document stays `UPLOADED`
        until then. Supports PDF, DOC, DOCX, CSV, MD, TXT, LOG and JSON files up
        to 50MB, chosen by the `filename` extension; any other type is refused.
        The declared `fileSize` is checked against the 50MB limit and the
        organization's monthly knowledge upload quota here, and counts towards
        the quota until confirmation records the measured size. Requires an API
        key with knowledge write access.
      operationId: createKnowledgeGroupDocumentPresignedUpload
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: Knowledge folder ID, from `GET /v1/knowledge/groups`
        - in: header
          name: X-Upload-Token
          required: false
          schema:
            type: string
          description: >-
            Lab's short-lived upload token, which Lab's own uploader sends
            instead of an API key. API clients authenticate with `Authorization:
            Bearer <API key>` and leave this out.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - filename
                - contentType
              properties:
                filename:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: The document's file name, with its extension.
                contentType:
                  type: string
                  maxLength: 255
                  description: >-
                    The file's MIME type, such as `application/pdf`. The `PUT`
                    to `uploadUrl` must send the same `Content-Type`.
                fileSize:
                  type: integer
                  minimum: 0
                  description: >-
                    The file's size in bytes, at most 52428800 (50MB).
                    Confirmation measures the uploaded file and enforces both
                    limits again on its real size.
                chunkSize:
                  type: integer
                  minimum: 100
                  maximum: 2000
                  description: >-
                    Maximum tokens per chunk for this document, as for the
                    multipart upload. Defaults to the group's chunkSize, or 350.
                chunkOverlap:
                  type: integer
                  minimum: 0
                  maximum: 1000
                  description: >-
                    Token overlap between chunks for this document, as for the
                    multipart upload. At most half of chunkSize.
      responses:
        '200':
          description: The document was created as `UPLOADED`, waiting for its file.
          content:
            application/json:
              schema:
                type: object
                required:
                  - uploadUrl
                  - documentId
                properties:
                  uploadUrl:
                    type: string
                    format: uri
                    description: >-
                      Presigned URL to `PUT` the file's bytes to, valid for 1
                      hour.
                  documentId:
                    type: string
                    description: The new document's ID, for the confirm-upload call.
        '400':
          description: >-
            The body is invalid (see the validation `details`), `contentType` is
            missing, the file type isn't supported, the declared `fileSize` is
            over 50MB, or it would pass the organization's monthly knowledge
            upload quota.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized - Invalid or missing API key or upload token
        '403':
          description: Forbidden - API key lacks the required permission
        '404':
          description: Knowledge folder not found
        '409':
          description: >-
            Other uploads in progress hold the rest of the organization's
            monthly knowledge upload allowance, although the declared size fits
            beside this month's documents. Nothing was saved; retry after
            `Retry-After` seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
        '500':
          description: Server error
        '503':
          description: >-
            A temporary server problem: the API key couldn't be checked, or the
            monthly upload quota couldn't be. Retry after `Retry-After` seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
                  message:
                    type: string
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

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