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

# Create a file data source

> Add file content (PDF, DOCX, or Image) as a data source to train your agent. The content should be pre-extracted from the file.



## OpenAPI

````yaml post /api/v2/data-sources/file
openapi: 3.0.1
info:
  title: LiveChatAI API v2
  description: >-
    LiveChatAI API v2 - Build powerful AI-powered customer support experiences.
    This API follows REST principles with predictable, resource-oriented URLs,
    JSON responses, and standard HTTP methods.
  version: 2.0.0
servers:
  - url: https://app.livechatai.com
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/v2/data-sources/file:
    post:
      tags:
        - Data Sources
      summary: Create a file data source
      description: >-
        Add file content (PDF, DOCX, or Image) as a data source to train your
        agent. The content should be pre-extracted from the file.
      requestBody:
        required: true
        description: Details for the file data source.
        content:
          application/json:
            schema:
              type: object
              required:
                - title
                - content
                - agentId
                - fileType
              properties:
                title:
                  type: string
                  example: Product Manual
                  description: Title of the file data source
                content:
                  type: string
                  example: >-
                    This section explains the product features and usage
                    instructions...
                  description: Content extracted from the file
                agentId:
                  type: string
                  example: clx1234567890abcdef
                  description: Unique identifier of the agent
                fileType:
                  type: string
                  enum:
                    - pdf
                    - docx
                    - image
                  example: pdf
                  description: Type of file being uploaded
      responses:
        '200':
          description: File data source created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Added successfully
                      item:
                        type: object
                        properties:
                          id:
                            type: string
                            example: ds_1234567890
                          source:
                            type: string
                            example: PDF
                          isGeneratedByAI:
                            type: boolean
                            example: false
        '401':
          description: Unauthorized access
        '406':
          description: Character limit exceeded.
        '500':
          description: An internal server error occurred.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````