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

# Test datasource credentials

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

Test datasource credentials without creating anything.

Validates that the provided credentials can connect to the external source. Succeeds when the connection can be established; returns an error otherwise. No datasource or import is created.

**Access:** Company admin only.

Credentials per type:
- **googledrive**: `service_account_file` (JSON string of the service account key file)
- **sharepoint**: `client_id`, `client_secret`, `tenant_id`, `site_id` (optional), `site_name` (optional)
- **servicenow**: `instance_url`, `username`, `password`
- **webscrapper**: no credentials required

Filter criteria per type:
- **googledrive**: `folder_id` (required), `recursive` (optional)
- **sharepoint**: `folder_path` (required), `recursive` (optional)
- **servicenow**: `doc_type` (required, e.g. `knowledge`)
- **webscrapper**: `start_url` (required)



## OpenAPI

````yaml /api-reference/openapi-v3-company.yaml post /api/v3/company/workspaces/datasource/test
openapi: 3.1.0
info:
  title: LightOn API
  version: 3.15.0 (v3-company)
  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://paradigm.lighton.ai
security: []
tags:
  - name: Models
    description: Operations about AI models
  - name: Workspaces
    description: Operations about workspaces
  - name: Users
    description: Operations about users
  - name: User Groups
    description: Operations about user groups
  - name: Companies
    description: Operations about companies
paths:
  /api/v3/company/workspaces/datasource/test:
    post:
      tags:
        - Workspaces
      summary: Test datasource credentials
      description: >-
        ⚠️ **ALPHA ENDPOINT** - This endpoint is in alpha and subject to
        breaking changes. Use with caution in production environments.


        Test datasource credentials without creating anything.


        Validates that the provided credentials can connect to the external
        source. Succeeds when the connection can be established; returns an
        error otherwise. No datasource or import is created.


        **Access:** Company admin only.


        Credentials per type:

        - **googledrive**: `service_account_file` (JSON string of the service
        account key file)

        - **sharepoint**: `client_id`, `client_secret`, `tenant_id`, `site_id`
        (optional), `site_name` (optional)

        - **servicenow**: `instance_url`, `username`, `password`

        - **webscrapper**: no credentials required


        Filter criteria per type:

        - **googledrive**: `folder_id` (required), `recursive` (optional)

        - **sharepoint**: `folder_path` (required), `recursive` (optional)

        - **servicenow**: `doc_type` (required, e.g. `knowledge`)

        - **webscrapper**: `start_url` (required)
      operationId: api_v3_company_workspaces_datasource_test_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StandardWorkspaceDatasourceV3Request'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/StandardWorkspaceDatasourceV3Request'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/StandardWorkspaceDatasourceV3Request'
        required: true
      responses:
        '200':
          description: Connection successful
        '400':
          description: >-
            Bad Request - Invalid credentials or connection failure to the
            external datasource
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ErrorResponse'
              examples:
                Unauthorized:
                  value:
                    id: null
                    code: 401
                    error: unauthorized
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
                    doc_url: https://developers.lighton.ai/errors#unauthorized
          description: Authentication credentials were not provided or are invalid
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ErrorResponse'
              examples:
                Forbidden:
                  value:
                    id: null
                    code: 403
                    error: insufficient_permissions
                    detail: You do not have permission to perform this action.
                    doc_url: >-
                      https://developers.lighton.ai/errors#insufficient_permissions
          description: Insufficient permissions
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ValidationErrorResponse'
              examples:
                ValidationError:
                  value:
                    id: null
                    code: 422
                    error: validation_error
                    detail: One or more fields failed validation.
                    doc_url: https://developers.lighton.ai/errors#validation_error
                    fields:
                      <field_name>:
                        - error: required
                          detail: This field is required.
                  summary: Validation Error
          description: Request body is valid JSON but one or more fields failed validation
        '503':
          description: >-
            API is under maintenance. Check `GET /api/v3/system/status` for
            active periods and retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceMaintenance503'
      security:
        - bearerAuth: []
components:
  schemas:
    StandardWorkspaceDatasourceV3Request:
      description: Pydantic request model for datasource conversion and credential testing.
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/TypeEnum'
          title: Type
        name:
          title: Name
          type: string
        credentials:
          additionalProperties: true
          default: {}
          title: Credentials
          type: object
        filter_criteria:
          additionalProperties: true
          default: {}
          title: Filter Criteria
          type: object
      required:
        - type
        - name
      title: StandardWorkspaceDatasourceV3Request
      type: object
    APIV3ErrorResponse:
      type: object
      properties:
        id:
          type:
            - string
            - 'null'
          description: >-
            Job/resource id when one already exists (useful for async error
            diagnosis); null otherwise.
        code:
          type: integer
          description: HTTP status code
        error:
          type: string
          description: Error code used by the UI as a translation key
        detail:
          type: string
          description: Human-readable error message for developers
        doc_url:
          type: string
          description: Link to the error-code documentation page
      required:
        - code
        - detail
        - doc_url
        - error
        - id
    APIV3ValidationErrorResponse:
      type: object
      properties:
        id:
          type:
            - string
            - 'null'
          description: >-
            Job/resource id when one already exists (useful for async error
            diagnosis); null otherwise.
        code:
          type: integer
          description: HTTP status code
        error:
          type: string
          description: Error code used by the UI as a translation key
        detail:
          type: string
          description: Human-readable error message for developers
        doc_url:
          type: string
          description: Link to the error-code documentation page
        fields:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/APIV3FieldError'
          description: Field-level validation errors keyed by field name
      required:
        - code
        - detail
        - doc_url
        - error
        - id
    ServiceMaintenance503:
      type: object
      description: >-
        Returned by the maintenance middleware when the requested endpoint is
        blocked.
      required:
        - detail
        - error
        - mode
      properties:
        detail:
          type: string
          example: System is under maintenance.
        error:
          type: string
          example: service_maintenance
        mode:
          type: string
          enum:
            - full_shutdown
            - warning_banner
          description: >-
            `full_shutdown` blocks all traffic; `warning_banner` also blocks and
            shows a dismissible toast.
        reason:
          type: string
          description: Operator-supplied maintenance reason, if any.
        started_at:
          type: string
          format: date-time
        endpoint_category_names:
          type: array
          items:
            type: string
          description: >-
            Non-empty only for category-scoped periods. Empty means all
            endpoints are affected.
    TypeEnum:
      enum:
        - googledrive
        - sharepoint
        - servicenow
        - webscrapper
      type: string
    APIV3FieldError:
      type: object
      properties:
        error:
          type: string
          description: Error code / translation key
        detail:
          type: string
          description: Human-readable description of the field error
      required:
        - detail
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````