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

# Create a sync source

> Grants access to the site, verifies the folder and creates a source that syncs it into a space folder on a schedule. Admin only; needs a setup session from the admin sign-in.



## OpenAPI

````yaml /api-reference/endpoint/m365/openapi.json post /m365/sources
openapi: 3.0.3
info:
  title: quiva.ai Microsoft 365 API
  description: >-
    Outlook mail connection, mail filing into space folders, and mail
    automations. All routes act on the caller's own mailbox unless marked admin.
    The `/m365/rules` routes were withdrawn. Files and SharePoint sync routes
    are not part of this spec.
  version: 1.0.0
  contact:
    name: quiva.ai Support
    url: https://app.quiva.ai
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Mail
    description: The caller's Outlook mailbox connection
  - name: Mail filing
    description: Filing mail from a mailbox into space folders
  - name: Mail automations
    description: Actions that run on each filed message
  - name: Files connection
    description: Connecting a Microsoft 365 tenant for SharePoint files
  - name: SharePoint browse
    description: Browsing sites, libraries and folders with a setup session
  - name: SharePoint sync sources
    description: Syncing a SharePoint library folder into a space
paths:
  /m365/sources:
    post:
      tags:
        - SharePoint sync sources
      summary: Create a sync source
      description: >-
        Grants access to the site, verifies the folder and creates a source that
        syncs it into a space folder on a schedule. Admin only; needs a setup
        session from the admin sign-in.
      operationId: createSyncSource
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                setup_session:
                  type: string
                  description: Setup session id
                site:
                  type: object
                  properties:
                    id:
                      type: string
                      description: ''
                    name:
                      type: string
                      description: ''
                    web_url:
                      type: string
                      description: ''
                  required:
                    - id
                drive:
                  type: object
                  properties:
                    id:
                      type: string
                      description: ''
                    name:
                      type: string
                      description: ''
                  required:
                    - id
                root:
                  type: object
                  properties:
                    item_id:
                      type: string
                      description: ''
                    path:
                      type: string
                      description: ''
                target:
                  type: object
                  properties:
                    space_id:
                      type: string
                      description: Space receiving the files
                    folder_path:
                      type: string
                      description: Folder inside the space
                  required:
                    - space_id
                storage_mode:
                  type: string
                  description: >-
                    mirror copies files into the space; shadow keeps them in
                    SharePoint
                  enum:
                    - mirror
                    - shadow
                rules:
                  $ref: '#/components/schemas/SyncRules'
                interval_minutes:
                  type: integer
              required:
                - setup_session
                - site
                - drive
                - target
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSource'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Caller is not an account admin
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SyncRules:
      type: object
      properties:
        extensions:
          type: array
          items:
            type: string
        max_bytes:
          type: integer
        skip_labelled:
          type: boolean
    SyncSource:
      type: object
      properties:
        id:
          type: string
          description: Source id
        tenant_id:
          type: string
          description: Microsoft tenant id
        site:
          type: object
          properties:
            id:
              type: string
              description: ''
            name:
              type: string
              description: ''
            web_url:
              type: string
              description: ''
        drive:
          type: object
          properties:
            id:
              type: string
              description: ''
            name:
              type: string
              description: ''
        root:
          type: object
          properties:
            item_id:
              type: string
              description: Folder item id; empty is the whole library
            path:
              type: string
              description: Folder path
        target:
          type: object
          properties:
            space_id:
              type: string
              description: Space receiving the files
            folder_path:
              type: string
              description: Folder inside the space
        storage_mode:
          type: string
          description: mirror copies files into the space; shadow keeps them in SharePoint
          enum:
            - mirror
            - shadow
        rules:
          $ref: '#/components/schemas/SyncRules'
        interval_minutes:
          type: integer
        state:
          type: string
          description: active or paused
        attention:
          $ref: '#/components/schemas/Attention'
        stats:
          type: object
          properties:
            files:
              type: integer
            skipped:
              type: integer
            bytes:
              type: integer
            last_run_at:
              type: string
            last_change_at:
              type: string
        created_by:
          type: string
          description: Creator user id
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
    Attention:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        since:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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