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

# Browse datasource folders

> ⚠️ **ALPHA ENDPOINT** - This endpoint is in alpha and subject to breaking changes. Use with caution in production environments.

Browse the remote folder hierarchy of a datasource without persisting anything.

Connects to the external provider using the credentials in the payload and returns the immediate subfolders of ``parent_id`` (or the top-level entries when ``parent_id`` is ``null``). Use this to power a visual folder picker before submitting a datasource configuration via `PATCH /api/v3/workspaces/{id}` with a `datasource` payload.

**Access:** any authenticated user.

Supported providers and credentials:
- **googledrive**: `service_account_file` (JSON string of the service account key file). When ``parent_id`` is omitted, returns the folders explicitly shared with the service account.
- **sharepoint**: `client_id`, `client_secret`, `tenant_id`, `instance_url`, `site_name`. When both ``drive_id`` and ``parent_id`` are ``null``, returns the site's document libraries as ``kind="library"`` entries (each entry's ``id`` is the drive id). Pass that ``id`` back as ``drive_id`` (with ``parent_id=null``) to list the library root; pass it as ``drive_id`` together with a folder's ``id`` as ``parent_id`` to descend into a folder.



## OpenAPI

````yaml /api-reference/api-console.yaml post /api/v3/workspaces/datasource/browse
openapi: 3.1.0
info:
  title: LightOn API
  version: 3.13.0 (v1)
  description: >-
    LightOn gives you an API to search, parse, and ingest documents at scale.
    Build knowledge-retrieval pipelines without managing vector databases or OCR
    models.
servers:
  - url: https://api.lighton.ai
security: []
tags:
  - name: Ask
    description: >-
      Retrieval-augmented generation: search your indexed corpus and generate an
      LLM answer grounded in the retrieved passages. Supports streaming (SSE)
      and synchronous modes.
  - name: Search
    description: >-
      Hybrid vector + text retrieval over your indexed corpus. Returns ranked
      passages with provenance (file, page range, workspace). Optional reranking
      and vision mode.
  - name: Files
    description: Upload, list, fetch, and delete documents indexed in your workspaces.
  - name: Facets
    description: >-
      Organise documents with hierarchical content types and custom attributes
      per file. Start from starter templates or build your own classification
      schema from scratch.
  - name: Tags
    description: >-
      Manage flat, company-wide labels used to scope search and group content
      across workspaces.
  - name: Workspaces
    description: >-
      Create and manage workspaces — the access-controlled containers your
      documents live in.
  - name: Parse
    description: >-
      Convert documents into structured Markdown — PDFs, images, Office files,
      and HTML. Synchronous endpoint capped at 20 MB / 15 pages.
  - name: Extract
    description: >-
      Pull typed fields out of documents using a JSON Schema you provide. Sync
      mode for small documents (≤20 MB / 15 pages); async mode for larger jobs
      (≤100 MB / 1000 pages) with polling on a job ID.
  - name: API Keys
    description: >-
      Provision and revoke API keys used to authenticate against the Console
      API.
  - name: Budget
    description: >-
      Manage your organization's monthly spend budget and alert thresholds. Set
      a hard cap that blocks API requests when reached, and configure email
      notifications at custom spend percentages.
paths:
  /api/v3/workspaces/datasource/browse:
    post:
      tags:
        - Workspaces
      summary: Browse datasource folders
      description: >-
        ⚠️ **ALPHA ENDPOINT** - This endpoint is in alpha and subject to
        breaking changes. Use with caution in production environments.


        Browse the remote folder hierarchy of a datasource without persisting
        anything.


        Connects to the external provider using the credentials in the payload
        and returns the immediate subfolders of ``parent_id`` (or the top-level
        entries when ``parent_id`` is ``null``). Use this to power a visual
        folder picker before submitting a datasource configuration via `PATCH
        /api/v3/workspaces/{id}` with a `datasource` payload.


        **Access:** any authenticated user.


        Supported providers and credentials:

        - **googledrive**: `service_account_file` (JSON string of the service
        account key file). When ``parent_id`` is omitted, returns the folders
        explicitly shared with the service account.

        - **sharepoint**: `client_id`, `client_secret`, `tenant_id`,
        `instance_url`, `site_name`. When both ``drive_id`` and ``parent_id``
        are ``null``, returns the site's document libraries as
        ``kind="library"`` entries (each entry's ``id`` is the drive id). Pass
        that ``id`` back as ``drive_id`` (with ``parent_id=null``) to list the
        library root; pass it as ``drive_id`` together with a folder's ``id`` as
        ``parent_id`` to descend into a folder.
      operationId: api_v3_workspaces_datasource_browse_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceDatasourceBrowseV3Request'
            examples:
              SharePoint—ListDocumentLibraries(root):
                value:
                  type: sharepoint
                  credentials:
                    tenant_id: tenant-uuid
                    client_id: client-uuid
                    client_secret: secret
                    instance_url: https://contoso.sharepoint.com
                    site_name: Engineering
                  drive_id: null
                  parent_id: null
                summary: SharePoint — list document libraries (root)
              SharePoint—ListFoldersInsideALibrary:
                value:
                  type: sharepoint
                  credentials:
                    tenant_id: tenant-uuid
                    client_id: client-uuid
                    client_secret: secret
                    instance_url: https://contoso.sharepoint.com
                    site_name: Engineering
                  drive_id: b!abc
                  parent_id: null
                summary: SharePoint — list folders inside a library
              GoogleDrive—ChildrenOfAFolder:
                value:
                  type: googledrive
                  credentials:
                    service_account_file: '{"type":"service_account", "...": "..."}'
                  parent_id: 0AAbCdEfGhIjKlMn
                summary: Google Drive — children of a folder
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/WorkspaceDatasourceBrowseV3Request'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/WorkspaceDatasourceBrowseV3Request'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceDatasourceBrowseV3Response'
              examples:
                Response—SharePointDocumentLibraries:
                  value:
                    folders:
                      - id: b!abc
                        name: Documents
                        has_children: true
                        path: Documents
                        drive_id: null
                        kind: library
                      - id: b!def
                        name: SyncedWithParadigm
                        has_children: true
                        path: SyncedWithParadigm
                        drive_id: null
                        kind: library
                  summary: Response — SharePoint document libraries
                Response—SharePointFoldersInsideALibrary:
                  value:
                    folders:
                      - id: 01ABC
                        name: Engineering
                        has_children: true
                        path: /Engineering
                        drive_id: b!abc
                        kind: folder
                      - id: 01DEF
                        name: Templates
                        has_children: false
                        path: /Templates
                        drive_id: b!abc
                        kind: folder
                  summary: Response — SharePoint folders inside a library
          description: Folder listing
        '400':
          description: >-
            Bad Request - Invalid credentials, connection failure, or
            unsupported provider
        '401':
          description: Unauthenticated - Missing or invalid API key
      security:
        - bearerAuth: []
components:
  schemas:
    WorkspaceDatasourceBrowseV3Request:
      description: >-
        Pydantic request model for browsing the remote folder hierarchy of a
        datasource.


        Only browsable providers (Google Drive, SharePoint) are accepted.
        Credentials are

        validated against the same models as the credential test endpoint.
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/WorkspaceDatasourceBrowseV3RequestTypeEnum'
          title: Type
        credentials:
          additionalProperties: true
          default: {}
          title: Credentials
          type: object
        drive_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Drive Id
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Parent Id
      required:
        - type
      title: WorkspaceDatasourceBrowseV3Request
      type: object
    WorkspaceDatasourceBrowseV3Response:
      type: object
      description: V3 Response serializer for the datasource folder browse endpoint.
      properties:
        folders:
          type: array
          items:
            $ref: '#/components/schemas/BrowseFolderItem'
      required:
        - folders
    WorkspaceDatasourceBrowseV3RequestTypeEnum:
      enum:
        - googledrive
        - sharepoint
      type: string
    BrowseFolderItem:
      type: object
      description: A single folder entry returned by the datasource browse endpoint.
      properties:
        id:
          type: string
          description: >-
            Provider folder identifier (SharePoint item id or Google Drive file
            id).
        name:
          type: string
          description: Folder display name.
        has_children:
          type: boolean
          description: >-
            Best-effort hint for the tree UI: True when the folder is known or
            assumed to contain subfolders.
        path:
          type:
            - string
            - 'null'
          description: >-
            Full path from the drive root (SharePoint only). Null for Google
            Drive.
        drive_id:
          type:
            - string
            - 'null'
          description: >-
            SharePoint drive containing the folder. Set for items returned
            inside a document library; null for library entries themselves and
            for Google Drive.
        kind:
          allOf:
            - $ref: '#/components/schemas/KindEnum'
          default: folder
          description: >-
            Item kind. SharePoint root returns 'library' entries (document
            libraries); everything else is 'folder'.


            * `library` - library

            * `folder` - folder
      required:
        - has_children
        - id
        - name
    KindEnum:
      enum:
        - library
        - folder
      type: string
      description: |-
        * `library` - library
        * `folder` - folder
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````