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

# Create Data Source

> Creates a new data source and associates it with a knowledge engine



## OpenAPI

````yaml POST /api/v1/data-sources
openapi: 3.0.1
info:
  title: Knowledge Engine API
  description: Public API endpoints for managing knowledge engines
  version: 1.0.0
servers:
  - url: https://api.getdecisional.ai
security: []
paths:
  /api/v1/data-sources:
    post:
      summary: Create a new data source
      description: Creates a new data source and associates it with a knowledge engine
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - data
              properties:
                file:
                  type: string
                  format: binary
                  description: The file to upload
                data:
                  type: string
                  description: |-
                    JSON string containing data source metadata. 

                     **Example**: 
                    ```
                    {
                      "name": "Annual Report 2023",
                      "type": "file",
                      "knowledge_engine_id": "kng_abc123xyz789"
                    }
                    ```
                  example: >-
                    {"name":"Annual Report
                    2023","type":"file","notes":{"category":"financial"},"knowledge_engine_id":"kng_abc123xyz789"}
            example:
              file: <binary file content>
              data: >-
                {"name":"Annual Report
                2023","type":"file","notes":{"category":"financial"},"knowledge_engine_id":"kng_abc123xyz789"}
      responses:
        '201':
          description: Data source created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataSourceResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Duplicate file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DuplicateFileError'
components:
  schemas:
    DataSourceResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the data source
          example: ds_abc123xyz789
        name:
          type: string
          description: Name of the data source
          example: Annual Report 2023
        type:
          type: string
          enum:
            - file
            - ticket
          description: Type of the data source
          example: file
        status:
          type: string
          enum:
            - processing
            - processed
          description: Current status of the data source
          example: processed
        notes:
          type: object
          description: Custom attributes and fields
          example:
            category: financial
        knowledge_engine_id:
          type: string
          description: ID of the knowledge engine this data source belongs to
          example: kng_abc123xyz789
        created_at:
          type: integer
          format: int64
          description: Unix timestamp when this entity was created
          example: 1679644800
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: >-
            Invalid knowledge engine name: exceeds maximum length of 50
            characters
    DuplicateFileError:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Duplicate file

````