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

# Create a source

> Index the files of a drive as a source. With an API key, store must be draganddrop and config.drive_id is the id of a drive you created. The first sync starts at once: the response has status pending or syncing. Poll GET /dc/sources until the status is synced before you search it. googledrive and sharepoint need the console's OAuth flow and return 400 Store not available for API keys. A missing or unknown drive returns 400 Invalid config.drive_id. The source is private to the key's user.



## OpenAPI

````yaml /openapi.json post /dc/sources
openapi: 3.1.0
info:
  title: Cominty API
  description: >-
    The HTTP API behind the Cominty Python SDK: chat and threads, memory, MCP
    integrations, agents, skills, document sources, and documents. Send your API
    key in the x-cominty-token header.
  version: main.5359267
servers:
  - url: https://ds.cominty.com
security:
  - comintyToken: []
paths:
  /dc/sources:
    post:
      tags:
        - document_stores
        - sources
      summary: Create a source
      description: >-
        Index the files of a drive as a source. With an API key, store must be
        draganddrop and config.drive_id is the id of a drive you created. The
        first sync starts at once: the response has status pending or syncing.
        Poll GET /dc/sources until the status is synced before you search it.
        googledrive and sharepoint need the console's OAuth flow and return 400
        Store not available for API keys. A missing or unknown drive returns 400
        Invalid config.drive_id. The source is private to the key's user.
      operationId: add_source_dc_sources_post
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SourceIn'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SourceOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SourceIn:
      anyOf:
        - $ref: '#/components/schemas/SourceWithConnectionIn'
        - $ref: '#/components/schemas/ConnectionLessSourceIn'
      title: SourceIn
    SourceOut:
      properties:
        created_at:
          type: string
          format: date-time
          title: Created At
        id:
          type: integer
          title: Id
          description: Numeric id. Use it in source_ids on a capability or a scope.
        pid:
          type: string
          title: Pid
          description: Public id. Use it in every path.
        name:
          type: string
          title: Name
        scope:
          type: string
          title: Scope
        created_by:
          type: string
          title: Created By
        store:
          type: string
          title: Store
          description: >-
            draganddrop, googledrive or sharepoint. A key creates only
            draganddrop.
        status:
          type: string
          title: Status
          description: >-
            pending, syncing, synced, error, out_of_sync, cancelling, pausing,
            paused, archived, disconnected, inoperative_connection,
            expired_connection, invalid_configuration or daily_quota_reached.
        size:
          type: integer
          title: Size
        embedded_size:
          type: integer
          title: Embedded Size
        config:
          additionalProperties: true
          type: object
          title: Config
        documents_synced:
          type: integer
          title: Documents Synced
        documents_failed:
          type: integer
          title: Documents Failed
        oversized_documents:
          type: integer
          title: Oversized Documents
        documents_embedded:
          type: integer
          title: Documents Embedded
        last_synced_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Synced At
        archived_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Archived At
        connection:
          anyOf:
            - $ref: >-
                #/components/schemas/cominty__api__routers__document_stores__sources__ConnectionOut
            - type: 'null'
      additionalProperties: false
      type: object
      required:
        - created_at
        - id
        - pid
        - name
        - scope
        - created_by
        - store
        - status
        - size
        - embedded_size
        - config
        - documents_synced
        - documents_failed
        - oversized_documents
        - documents_embedded
        - last_synced_at
        - archived_at
        - connection
      title: SourceOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SourceWithConnectionIn:
      properties:
        connection_id:
          type: string
          title: Connection Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        store:
          type: string
          enum:
            - googledrive
            - sharepoint
          title: Store
          description: >-
            Not available with an API key: it returns 400 Store not available
            for API keys.
        config:
          additionalProperties: true
          type: object
          title: Config
        scope:
          $ref: '#/components/schemas/Scope'
      additionalProperties: false
      type: object
      required:
        - connection_id
        - store
        - config
        - scope
      title: SourceWithConnectionIn
    ConnectionLessSourceIn:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Name of the source. Omit it for a generated name.
        store:
          type: string
          const: draganddrop
          title: Store
          description: Must be draganddrop with an API key.
        config:
          additionalProperties: true
          type: object
          title: Config
          description: 'Send drive_id: the id of a drive you created with POST /drives.'
        scope:
          $ref: '#/components/schemas/Scope'
          description: private (the key's user only) or organization.
      additionalProperties: false
      type: object
      required:
        - store
        - config
        - scope
      title: ConnectionLessSourceIn
    cominty__api__routers__document_stores__sources__ConnectionOut:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        status:
          type: string
          title: Status
        created_by:
          type: string
          title: Created By
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        checked_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Checked At
        inoperative:
          type: boolean
          title: Inoperative
      additionalProperties: false
      type: object
      required:
        - id
        - name
        - status
        - created_by
        - expires_at
        - checked_at
        - inoperative
      title: ConnectionOut
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    Scope:
      type: string
      enum:
        - organization
        - private
      title: Scope
  securitySchemes:
    comintyToken:
      type: apiKey
      in: header
      name: x-cominty-token
      description: >-
        A Cominty Platform API secret. A key created now starts with sk-cmt-.
        Send it as is, or as Bearer sk-cmt-..., with at most one Bearer prefix.
        A key created before the prefix existed has no sk-cmt- and still works.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.