> ## 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 MongoDB connection

> Create a new MongoDB database connection.



## OpenAPI

````yaml https://api.camelai.com/api/schema/ post /api/v1/sources/add/mongodb/
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/add/mongodb/:
    post:
      tags:
        - sources
      summary: Add MongoDB connection
      description: Create a new MongoDB database connection.
      operationId: sources_add_mongodb_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MongoDBConnectionRequest'
            examples:
              MongoDB:
                value:
                  type: mongodb
                  account_name: My MongoDB Database
                  connection_string: >-
                    mongodb+srv://username:password@cluster0.mongodb.net/mydatabase
                summary: MongoDB database connection
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: The ID of the created connection
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  errors:
                    type: object
                    description: Field-specific validation errors
          description: ''
      security:
        - ApiKeyAuth: []
components:
  schemas:
    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
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: API key authentication using Bearer scheme

````