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

# Upload document file

> Uploads a file (PDF, DOCX, TXT, etc.) and creates a new knowledge base document from its contents.



## OpenAPI

````yaml /openapi.json post /public/v1/knowledge-base/documents/file
openapi: 3.0.3
info:
  title: Callin Public API
  version: 1.0.0
  description: >-
    The Callin public API lets you programmatically build and manage AI voice
    agents, control their knowledge bases, and retrieve call logs and
    transcripts. All endpoints are versioned under /public/v1.
servers:
  - url: https://api.callin.io/api
    description: API Endpoint
security: []
tags:
  - name: Health
    description: Service availability check. No authentication required.
  - name: Identity
    description: Verify which account is associated with the current API key.
  - name: Agents
    description: Create, retrieve, and update AI voice agents.
  - name: Conversations
    description: List and inspect call logs, transcripts, and conversation details.
  - name: Knowledge Base
    description: Manage documents and groups that agents use during calls.
paths:
  /public/v1/knowledge-base/documents/file:
    post:
      tags:
        - Knowledge Base
      summary: Upload document file
      description: >-
        Uploads a file (PDF, DOCX, TXT, etc.) and creates a new knowledge base
        document from its contents.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateDocumentFromFileRequest'
      responses:
        '200':
          description: Document created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessDocumentCreateFromFileResponse'
        '400':
          description: Invalid request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
components:
  schemas:
    CreateDocumentFromFileRequest:
      type: object
      description: >-
        Upload one or more files into a knowledge group (`multipart/form-data`).
        The group is created or matched by `groupName`.
      required:
        - groupName
        - files
      properties:
        groupName:
          type: string
          description: Name of the knowledge group to create or add these documents to.
        files:
          type: array
          minItems: 1
          description: >-
            Files to upload. Each file must be **PDF** (`.pdf`), **Word**
            (`.docx`), or **TSX** (`.tsx`). **Maximum 5 MB** per file.
          items:
            type: string
            format: binary
            description: 'One file: PDF, DOCX, or TSX; max 5 MB.'
    SuccessDocumentCreateFromFileResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          description: The details of the document created
          type: object
          properties:
            groupId:
              type: string
              description: The ID of the group created
            name:
              type: string
              description: The name of the group
            documents:
              type: array
              description: >-
                Created file documents. Each item uses nested `details`
                (`fileUrl`, `fileType`, `fileSize`); no `url` at the document
                root.
              items:
                $ref: '#/components/schemas/DocumentDetailsFile'
            metadata:
              type: object
              description: Knowledge-base storage usage in MB (no audit fields).
              properties:
                allowedMb:
                  type: number
                  description: The allowed size of the document in MB
                usedMb:
                  type: number
                  description: The used size of the document in MB
                usedMbAfter:
                  type: number
                  description: >-
                    The used size of the document in MB after the document was
                    created
                remainingMbAfter:
                  type: number
                  description: >-
                    The remaining size of the document in MB after the document
                    was created
      description: >-
        After uploading files: new or updated group, created documents, and
        storage usage (MB).
    ErrorResponse:
      type: object
      description: >-
        Returned for most client and validation errors. Read `error.message` and
        optional `error.fields` for details.
      properties:
        success:
          type: boolean
          example: false
          description: Always `false` for this shape.
        error:
          type: object
          description: Structured error payload from the API.
          properties:
            code:
              type: string
              description: Stable machine-oriented error code when provided.
            message:
              type: string
              description: Human-readable explanation suitable to show or log.
            status:
              type: integer
              description: HTTP status code echoed for convenience.
            fields:
              type: array
              description: >-
                Optional per-field validation issues (shape is
                endpoint-specific).
              items:
                type: object
    DocumentDetailsFile:
      type: object
      description: >-
        Uploaded file document. `details` holds storage URL, MIME type, and
        size; display name is `name`.
      additionalProperties: false
      properties:
        documentId:
          type: string
          description: The ID of the document.
        type:
          type: string
          enum:
            - file
          description: 'Discriminator: uploaded file document.'
        name:
          type: string
          description: Display name (often the original file name).
        details:
          $ref: '#/components/schemas/DocumentFileDetails'
        metadata:
          type: object
          description: Optional server metadata.
          properties:
            createdAt:
              type: string
              format: date-time
              description: When the document was created.
            createdBy:
              $ref: '#/components/schemas/MetaCreatedBy'
    DocumentFileDetails:
      type: object
      description: Type-specific payload when `type` is `file` (no source URL).
      additionalProperties: false
      properties:
        fileUrl:
          type: string
          description: Public URL of the stored file.
        fileType:
          type: string
          description: MIME type of the file (e.g. `application/pdf`, `text/plain`).
        fileSize:
          type: number
          description: File size in bytes.
    MetaCreatedBy:
      type: object
      properties:
        userId:
          type: string
          description: The ID of the user who created the item
        userEmail:
          type: string
          description: The email of the user who created the item
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: Send your Callin API key in the `x-api-key` header.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Same API key as a Bearer token: `Authorization: Bearer <your-api-key>`.'

````