> ## 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 a batch of markdown documents

> Uploads a batch of pre-parsed markdown documents from a folder upload. Documents are processed asynchronously via a background job.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/avido/openapi.documented.yml post /v0/documents/upload-markdown-batch
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-markdown-batch:
    post:
      tags:
        - Documents
      summary: Upload a batch of markdown documents
      description: >-
        Uploads a batch of pre-parsed markdown documents from a folder upload.
        Documents are processed asynchronously via a background job.
      operationId: uploadMarkdownBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadMarkdownBatchRequest'
      responses:
        '204':
          description: Batch uploaded and queued for processing successfully
        '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:
    UploadMarkdownBatchRequest:
      type: object
      properties:
        importName:
          type: string
          minLength: 1
          maxLength: 256
          description: User-provided name for this import.
          example: Knowledge Base v2
        batchId:
          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: Client-generated ID grouping batches from one folder upload.
          example: 456e7890-e89b-12d3-a456-426614174001
        batchIndex:
          type: integer
          minimum: 0
          maximum: 9007199254740991
          description: Zero-based index of this batch within the upload.
          example: 0
        totalBatches:
          type: integer
          minimum: 1
          maximum: 9007199254740991
          description: Total number of batches in this upload.
          example: 25
        totalFiles:
          type: integer
          minimum: 1
          maximum: 10000
          description: Total number of files across all batches.
          example: 5000
        documents:
          minItems: 1
          maxItems: 200
          type: array
          items:
            $ref: '#/components/schemas/MarkdownDocumentItem'
          description: Array of pre-parsed markdown documents.
        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 uploaded documents 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 persisted onto the FileProcessing row and
            forwarded to the processor. Used to flag uploads that should hand
            off to the KB-review classification orchestrator (`{ step:
            "KNOWLEDGE_BASE_REVIEW" }`).
          example:
            step: KNOWLEDGE_BASE_REVIEW
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - importName
        - batchId
        - batchIndex
        - totalBatches
        - totalFiles
        - documents
      additionalProperties: false
      title: UploadMarkdownBatchRequest
      description: Request for uploading a batch of pre-parsed markdown 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.
    MarkdownDocumentItem:
      type: object
      properties:
        fileName:
          type: string
          minLength: 1
          maxLength: 512
          description: Original file path relative to the uploaded folder root.
          example: getting-started/login.md
        title:
          type: string
          minLength: 1
          maxLength: 256
          description: >-
            Document title extracted from frontmatter, first heading, or
            filename.
          example: Inloggen Internet Bankieren - ABN AMRO
        content:
          type: string
          minLength: 1
          maxLength: 500000
          description: Full markdown content of the file (body only, frontmatter stripped).
        language:
          description: Language of the document. Defaults to 'english'.
          example: english
          type: string
          maxLength: 64
        tags:
          description: Tags extracted from frontmatter or supplied by user.
          example:
            - auth
            - self-service
          maxItems: 50
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 128
        metadata:
          description: All non-title frontmatter fields plus sourceFileName.
          example:
            url: https://example.com/page
            sourceFileName: login.md
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - fileName
        - title
        - content
      additionalProperties: false
      title: MarkdownDocumentItem
      description: A single pre-parsed markdown document in a batch upload.
  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

````