> ## 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.

# 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 persisting anything.

Validates that the provided credentials can connect to the external source. Returns 200 if the connection succeeds, 400 otherwise. No datasource or import is created. Use this before `PATCH /api/v3/workspaces/{id}` with a `datasource` payload to surface connection errors before committing the conversion.

**Access:** any authenticated user.

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/api-console.yaml post /api/v3/workspaces/datasource/test
openapi: 3.1.0
info:
  title: LightOn API
  version: 3.12.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/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 persisting anything.


        Validates that the provided credentials can connect to the external
        source. Returns 200 if the connection succeeds, 400 otherwise. No
        datasource or import is created. Use this before `PATCH
        /api/v3/workspaces/{id}` with a `datasource` payload to surface
        connection errors before committing the conversion.


        **Access:** any authenticated user.


        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_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, connection failure, or missing
            required fields
        '401':
          description: Unauthenticated - Missing or invalid API key
        '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
      security:
        - bearerAuth: []
components:
  schemas:
    StandardWorkspaceDatasourceV3Request:
      description: Pydantic request model for datasource conversion and credential testing.
      properties:
        type:
          allOf:
            - $ref: >-
                #/components/schemas/StandardWorkspaceDatasourceV3RequestTypeEnum
          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
    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
    StandardWorkspaceDatasourceV3RequestTypeEnum:
      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.

````