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

# Add connection

> Create a new connection of any supported type. The type field determines which connection type to create.



## OpenAPI

````yaml https://api.camelai.com/api/schema/ post /api/v1/sources/
openapi: 3.0.3
info:
  title: camelAI API
  version: 1.0.0 (v1)
  description: API for camelAI - AI-powered data analytics platform
servers:
  - url: https://api.camelai.com
    description: camelAI API server
security: []
paths:
  /api/v1/sources/:
    post:
      tags:
        - sources
      summary: Add connection
      description: >-
        Create a new connection of any supported type. The type field determines
        which connection type to create.
      operationId: sources_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddConnectionRequestRequest'
            examples:
              PostgreSQLExample:
                value:
                  type: POSTGRES
                  hostname: localhost
                  port: 5432
                  username: postgres
                  password: password
                  database_name: mydb
                  selected_schemas:
                    - public
                    - analytics
                summary: PostgreSQL Example
              SnowflakeExample:
                value:
                  type: SNOWFLAKE
                  account: myaccount.us-east-1
                  user: myuser
                  password: mypassword
                  warehouse: COMPUTE_WH
                summary: Snowflake Example
              DatabricksExample:
                value:
                  type: DATABRICKS
                  server_hostname: adb-1234567890123456.7.azuredatabricks.net
                  http_path: /sql/1.0/warehouses/xxxxxxxxxxxxxxxx
                  access_token: dapiXXXXXXXXXXXXXXXXXXXXXXXX
                  catalog: main
                  selected_schemas:
                    - main.sales
                summary: Databricks Example
              BigQueryExample:
                value:
                  type: BIGQUERY
                  service_account_key:
                    type: service_account
                    project_id: my-project
                    private_key: |-
                      -----BEGIN PRIVATE KEY-----
                      ...
                      -----END PRIVATE KEY-----
                    client_email: service@my-project.iam.gserviceaccount.com
                summary: BigQuery Example
              MCPExample:
                value:
                  type: MCP
                  account_name: Docs MCP
                  base_url: https://mcp.example.com
                  access_token: optional-token
                summary: MCP Example
              FileUpload(URLs-S3Presigned&GCS):
                value:
                  type: FILE
                  account_name: Sales Data 2024
                  file_urls:
                    - url: >-
                        https://my-bucket.s3.amazonaws.com/sales_q1.csv?X-Amz-Signature=...
                      filename: sales_q1.csv
                    - url: https://storage.googleapis.com/data/sales_q2.parquet
                      filename: sales_q2.parquet
                summary: File Upload (URLs - S3 presigned & GCS)
                description: >-
                  Create a FILE source directly from cloud URLs. Allowed: CSV,
                  TSV, XLS, XLSX, SQLite, Parquet. Max 10GB/file.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddConnectionResponse'
              examples:
                PostgreSQLExample:
                  value:
                    type: POSTGRES
                    hostname: localhost
                    port: 5432
                    username: postgres
                    password: password
                    database_name: mydb
                    selected_schemas:
                      - public
                      - analytics
                  summary: PostgreSQL Example
                SnowflakeExample:
                  value:
                    type: SNOWFLAKE
                    account: myaccount.us-east-1
                    user: myuser
                    password: mypassword
                    warehouse: COMPUTE_WH
                  summary: Snowflake Example
                DatabricksExample:
                  value:
                    type: DATABRICKS
                    server_hostname: adb-1234567890123456.7.azuredatabricks.net
                    http_path: /sql/1.0/warehouses/xxxxxxxxxxxxxxxx
                    access_token: dapiXXXXXXXXXXXXXXXXXXXXXXXX
                    catalog: main
                    selected_schemas:
                      - main.sales
                  summary: Databricks Example
                BigQueryExample:
                  value:
                    type: BIGQUERY
                    service_account_key:
                      type: service_account
                      project_id: my-project
                      private_key: |-
                        -----BEGIN PRIVATE KEY-----
                        ...
                        -----END PRIVATE KEY-----
                      client_email: service@my-project.iam.gserviceaccount.com
                  summary: BigQuery Example
                MCPExample:
                  value:
                    type: MCP
                    account_name: Docs MCP
                    base_url: https://mcp.example.com
                    access_token: optional-token
                  summary: MCP Example
                FileUpload(URLs-S3Presigned&GCS):
                  value:
                    type: FILE
                    account_name: Sales Data 2024
                    file_urls:
                      - url: >-
                          https://my-bucket.s3.amazonaws.com/sales_q1.csv?X-Amz-Signature=...
                        filename: sales_q1.csv
                      - url: https://storage.googleapis.com/data/sales_q2.parquet
                        filename: sales_q2.parquet
                  summary: File Upload (URLs - S3 presigned & GCS)
                  description: >-
                    Create a FILE source directly from cloud URLs. Allowed: CSV,
                    TSV, XLS, XLSX, SQLite, Parquet. Max 10GB/file.
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionErrorResponse'
          description: ''
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AddConnectionRequestRequest:
      oneOf:
        - $ref: '#/components/schemas/PostgresConnectionRequest'
        - $ref: '#/components/schemas/MySQLConnectionRequest'
        - $ref: '#/components/schemas/SnowflakeConnectionRequest'
        - $ref: '#/components/schemas/BigQueryConnectionRequest'
        - $ref: '#/components/schemas/MotherDuckConnectionRequest'
        - $ref: '#/components/schemas/ClickHouseConnectionRequest'
        - $ref: '#/components/schemas/MongoDBConnectionRequest'
        - $ref: '#/components/schemas/SingleStoreConnectionRequest'
        - $ref: '#/components/schemas/MSSQLConnectionRequest'
        - $ref: '#/components/schemas/MCPConnectionRequest'
        - $ref: '#/components/schemas/FileUploadConnectionRequestRequest'
      discriminator:
        propertyName: type
        mapping:
          postgres:
            $ref: '#/components/schemas/PostgresConnectionRequest'
          mysql:
            $ref: '#/components/schemas/MySQLConnectionRequest'
          snowflake:
            $ref: '#/components/schemas/SnowflakeConnectionRequest'
          bigquery:
            $ref: '#/components/schemas/BigQueryConnectionRequest'
          motherduck:
            $ref: '#/components/schemas/MotherDuckConnectionRequest'
          clickhouse:
            $ref: '#/components/schemas/ClickHouseConnectionRequest'
          mongodb:
            $ref: '#/components/schemas/MongoDBConnectionRequest'
          singlestore:
            $ref: '#/components/schemas/SingleStoreConnectionRequest'
          mssql:
            $ref: '#/components/schemas/MSSQLConnectionRequest'
          mcp:
            $ref: '#/components/schemas/MCPConnectionRequest'
          file:
            $ref: '#/components/schemas/FileUploadConnectionRequestRequest'
    AddConnectionResponse:
      type: object
      description: Response serializer for add connection endpoint.
      properties:
        id:
          type: integer
          description: The ID of the created connection
        public_key_sql:
          type: string
          description: >-
            SQL command to add public key to Snowflake (only for Snowflake
            key-pair auth)
      required:
        - id
    ConnectionErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        errors:
          type: object
          additionalProperties: {}
          description: Field-specific validation errors
      required:
        - error
    PostgresConnectionRequest:
      type: object
      description: Serializer for PostgreSQL connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `POSTGRES`
        account_name:
          type: string
          minLength: 1
          default: PostgreSQL
          description: Display name for the connection
        hostname:
          type: string
          minLength: 1
          description: PostgreSQL server hostname
          maxLength: 255
        port:
          type: integer
          default: 5432
          description: Port number
        username:
          type: string
          minLength: 1
          description: Database username
          maxLength: 255
        password:
          type: string
          writeOnly: true
          minLength: 1
          description: Database password
        database_name:
          type: string
          minLength: 1
          description: Database name
          maxLength: 255
        connection_string:
          type: string
          minLength: 1
          description: 'Alternative: full connection string instead of individual parameters'
        selected_schemas:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 255
          description: >-
            List of schema names to include in queries and overviews. If empty,
            all schemas except system schemas will be included.
      required:
        - type
      title: PostgreSQL
    MySQLConnectionRequest:
      type: object
      description: Serializer for MySQL connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `MYSQL`
        account_name:
          type: string
          minLength: 1
          default: MySQL
          description: Display name for the connection
        hostname:
          type: string
          minLength: 1
          description: MySQL server hostname or IP address
          maxLength: 255
        port:
          type: integer
          default: 3306
          description: Port number
        username:
          type: string
          minLength: 1
          description: Database username
          maxLength: 255
        password:
          type: string
          writeOnly: true
          minLength: 1
          description: Database password
        database_name:
          type: string
          minLength: 1
          description: Database name
          maxLength: 255
      required:
        - database_name
        - hostname
        - password
        - type
        - username
      title: MySQL
    SnowflakeConnectionRequest:
      type: object
      description: Serializer for Snowflake connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `SNOWFLAKE`
        account_name:
          type: string
          minLength: 1
          default: Snowflake
          description: Display name for the connection
        account:
          type: string
          minLength: 1
          description: Snowflake account identifier (e.g., xy12345.us-east-1)
          maxLength: 255
        user:
          type: string
          minLength: 1
          description: Snowflake username
          maxLength: 255
        password:
          type: string
          writeOnly: true
          description: >-
            Password for authentication (optional - use either password or
            public_key)
        public_key:
          type: string
          description: >-
            Public key for key-pair authentication (optional - use either
            password or public_key)
        warehouse:
          type: string
          description: Snowflake warehouse to use (optional)
      required:
        - account
        - type
        - user
      title: Snowflake
    BigQueryConnectionRequest:
      type: object
      description: Serializer for Google BigQuery connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `BIGQUERY`
        account_name:
          type: string
          minLength: 1
          default: BigQuery
          description: Display name for the connection
        selected_datasets:
          type: array
          items:
            type: string
            maxLength: 255
          description: >-
            List of dataset IDs to include. If omitted, all datasets in the
            project are used.
        service_account_key:
          description: Google Cloud service account key JSON
      required:
        - service_account_key
        - type
      title: BigQuery
    MotherDuckConnectionRequest:
      type: object
      description: Serializer for MotherDuck connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `MOTHERDUCK`
        account_name:
          type: string
          minLength: 1
          default: MotherDuck
          description: Display name for the connection
        database_name:
          type: string
          minLength: 1
          description: Database name
          maxLength: 255
        token:
          type: string
          writeOnly: true
          minLength: 1
          description: MotherDuck authentication token
      required:
        - database_name
        - token
        - type
      title: MotherDuck
    ClickHouseConnectionRequest:
      type: object
      description: Serializer for ClickHouse connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `CLICKHOUSE`
        account_name:
          type: string
          minLength: 1
          default: ClickHouse
          description: Display name for the connection
        host:
          type: string
          minLength: 1
          description: ClickHouse server hostname
          maxLength: 255
        port:
          type: integer
          default: 8443
          description: Port number
        username:
          type: string
          minLength: 1
          description: Database username
          maxLength: 255
        password:
          type: string
          writeOnly: true
          minLength: 1
          description: Database password
        database:
          type: string
          description: Database name (optional)
          maxLength: 255
      required:
        - host
        - password
        - type
        - username
      title: ClickHouse
    MongoDBConnectionRequest:
      type: object
      description: Serializer for MongoDB connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `MONGODB`
        account_name:
          type: string
          minLength: 1
          default: MongoDB
          description: Display name for the connection
        connection_string:
          type: string
          minLength: 1
          description: >-
            MongoDB connection string (e.g., mongodb://user:pass@host/db or
            mongodb+srv://user:pass@cluster.mongodb.net/db)
      required:
        - connection_string
        - type
      title: MongoDB
    SingleStoreConnectionRequest:
      type: object
      description: Serializer for SingleStore connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `SINGLESTORE`
        account_name:
          type: string
          minLength: 1
          default: SingleStore
          description: Display name for the connection
        hostname:
          type: string
          minLength: 1
          description: SingleStore server hostname
          maxLength: 255
        port:
          type: integer
          default: 3333
          description: Port number
        username:
          type: string
          minLength: 1
          description: Database username
          maxLength: 255
        password:
          type: string
          writeOnly: true
          minLength: 1
          description: Database password
        database_name:
          type: string
          minLength: 1
          description: Database name
          maxLength: 255
      required:
        - database_name
        - hostname
        - password
        - type
        - username
      title: SingleStore
    MSSQLConnectionRequest:
      type: object
      description: Serializer for Microsoft SQL Server connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          description: Connection type identifier. Must be `MSSQL`
        account_name:
          type: string
          minLength: 1
          default: SQL Server
          description: Display name for the connection
        hostname:
          type: string
          minLength: 1
          description: SQL Server hostname
          maxLength: 255
        port:
          type: integer
          default: 1433
          description: Port number
        username:
          type: string
          minLength: 1
          description: Database username
          maxLength: 255
        password:
          type: string
          writeOnly: true
          minLength: 1
          description: Database password
        database_name:
          type: string
          minLength: 1
          description: Database name
          maxLength: 255
        connection_string:
          type: string
          minLength: 1
          description: 'Alternative: ODBC connection string instead of individual parameters'
      required:
        - type
      title: SQL Server
    MCPConnectionRequest:
      type: object
      description: Serializer for MCP connection configuration.
      properties:
        type:
          type: string
          minLength: 1
          default: MCP
          description: Connection type identifier. Must be `MCP`
        account_name:
          type: string
          default: MCP Server
          description: Display name for the connection
        base_url:
          type: string
          format: uri
          minLength: 1
          description: Endpoint for the MCP server (Streamable HTTP or SSE).
        access_token:
          type: string
          writeOnly: true
          description: Optional access token sent as a Bearer authorization header.
        selected_tools:
          type: array
          items:
            type: string
          description: >-
            Optional list of MCP tool names to enable after creation. If
            omitted, all tools discovered on the server will be enabled.
      required:
        - base_url
    FileUploadConnectionRequestRequest:
      type: object
      description: >-
        Public serializer for file-based data source uploads (excludes internal
        fields).
      properties:
        type:
          enum:
            - FILE
          type: string
          x-spec-enum-id: 63888415d2de9060
          description: |-
            Connection type identifier. Must be `FILE`

            * `FILE` - File Upload
        account_name:
          type: string
          minLength: 1
          default: File Upload
          description: Display name for the connection
        file_urls:
          type: array
          items:
            $ref: '#/components/schemas/FileUrlItemRequest'
          description: >-
            List of file URLs to import directly. Each item must include 'url'
            and 'filename'.
      required:
        - file_urls
        - type
      title: File Upload
    FileUrlItemRequest:
      type: object
      properties:
        url:
          type: string
          minLength: 1
          description: HTTP/HTTPS URL to download
        filename:
          type: string
          minLength: 1
          description: Filename to use (with extension)
      required:
        - filename
        - url
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: API key authentication using Bearer scheme

````