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

# Upload documents via CSV, PDF, or XLSX file

> Uploads a CSV, PDF, or XLSX file containing documents. CSV files will be validated and processed. PDF files will be processed via OCR. XLSX files are split per sheet and each sheet is converted into one or more documents via an LLM. Unless processFile is set to false, processing happens asynchronously. Returns the created FileProcessing id so callers can poll progress and join on DocumentV2.fileProcessingId once the row is COMPLETED.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/avido/openapi.documented.yml post /v0/documents/upload
openapi: 3.1.1
info:
  title: Avido API
  description: >-
    Avido's API for LLM usage events, tool calls, trace management, webhook
    validation, and more. See each endpoint's request/response schema for
    details.
  version: 0.1.0
  contact:
    name: Avido Support
    email: support@avidoai.com
    url: https://avidoai.com/support
servers:
  - url: https://api.avidoai.com
    description: Production API
security:
  - ApiKey: []
    ApplicationId: []
paths:
  /v0/documents/upload:
    post:
      tags:
        - Documents
      summary: Upload documents via CSV, PDF, or XLSX file
      description: >-
        Uploads a CSV, PDF, or XLSX file containing documents. CSV files will be
        validated and processed. PDF files will be processed via OCR. XLSX files
        are split per sheet and each sheet is converted into one or more
        documents via an LLM. Unless processFile is set to false, processing
        happens asynchronously. Returns the created FileProcessing id so callers
        can poll progress and join on DocumentV2.fileProcessingId once the row
        is COMPLETED.
      operationId: uploadDocuments
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadDocumentsRequest'
      responses:
        '201':
          description: File uploaded and queued for processing successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadDocumentsResponse'
        '400':
          description: bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    UploadDocumentsRequest:
      type: object
      properties:
        file:
          description: CSV, PDF, or XLSX file containing documents
        fileName:
          type: string
          minLength: 1
          maxLength: 256
          description: Name for this import
          example: Knowledge Base Q1 2024
        documentType:
          default: KNOWLEDGE
          description: Type of the documents being uploaded. Defaults to KNOWLEDGE.
          example: KNOWLEDGE
          type: string
          enum:
            - KNOWLEDGE
            - POLICY
        quickstartId:
          description: ID of the quickstart this upload belongs to.
          example: 456e7890-e89b-12d3-a456-426614174001
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        topicId:
          description: ID of the topic to associate the uploaded document with.
          example: 789e0123-e89b-12d3-a456-426614174002
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        metadata:
          description: >-
            Optional extra metadata merged into document version metadata. Send
            as a JSON string in FormData.
          example: '{"step":"KNOWLEDGE_BASE_REVIEW"}'
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
        processFile:
          description: >-
            Whether to process the file asynchronously via background job.
            Defaults to true.
          example: true
          default: true
          type: boolean
      required:
        - file
        - fileName
      additionalProperties: false
      title: UploadDocumentsRequest
      description: Request for uploading documents via CSV, PDF, or XLSX file
    UploadDocumentsResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            fileProcessingId:
              type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              description: >-
                ID of the FileProcessing row created for this upload. Use it to
                poll `/v0/file-processings/:id` for progress, and
                `/v0/documents?fileProcessingId[]=…` once the row is COMPLETED
                to enumerate the documents produced.
              example: 654e7890-e89b-12d3-a456-426614174000
          required:
            - fileProcessingId
          additionalProperties: false
      required:
        - data
      additionalProperties: false
      title: UploadDocumentsResponse
      description: Response for uploading documents
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message explaining the error.
          example: Resource not found
      required:
        - message
      additionalProperties: false
      title: ErrorResponse
      description: Standard error format for failed API operations.
    ValidationErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message indicating what went wrong.
          example: Invalid request data
        issues:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              message:
                type: string
              path:
                type: array
                items:
                  type: string
            required:
              - code
              - message
              - path
            additionalProperties: false
          description: Array of detailed validation error objects.
          example:
            - code: invalid_string
              message: Invalid UUID
              path:
                - id
      required:
        - message
        - issues
      additionalProperties: false
      title: ValidationErrorResponse
      description: Details about validation errors in incoming requests.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your unique Avido API key
    ApplicationId:
      type: apiKey
      in: header
      name: x-application-id
      description: Your unique Avido Application ID

````