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

# Update a company workspace

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

Partially update a given workspace. The authenticated user must be a company or instance-level administrator.

**Standard update:**
- **name** (string, optional): Desired workspace name
- **description** (string, optional): Desired workspace description. Send empty string or null to clear.

**Convert to synced workspace:**
Provide a `datasource` object to convert a manual workspace into a read-only synced workspace. This creates a datasource and schedules a first import immediately.

```json
{
  "datasource": {
    "type": "googledrive|sharepoint|servicenow|webscrapper",
    "name": "My datasource",
    "credentials": { ... },
    "filter_criteria": { ... }
  }
}
```

Credentials per type:
- **googledrive**: `service_account_file` (JSON string)
- **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)

**Edit an existing synced workspace's datasource:**
Sending a `datasource` payload on an already-synced workspace edits the datasource in place — but only while no successful sync has happened yet. After the first success the datasource config is locked, and it is also locked while a sync is in flight (waiting/processing). Type cannot change on edit. The current editability is exposed in the response under `sync.editable`.

**Permissions:**
- Company Admins can update workspaces within their company
- Instance-level administrators can update any workspace
- Conversion is one-way (cannot revert to manual)



## OpenAPI

````yaml /api-reference/openapi-v3-company.yaml patch /api/v3/company/workspaces/{id}
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/{id}:
    patch:
      tags:
        - Workspaces
      summary: Update a company workspace
      description: >-
        ⚠️ **ALPHA ENDPOINT** - This endpoint is in alpha and subject to
        breaking changes. Use with caution in production environments.


        Partially update a given workspace. The authenticated user must be a
        company or instance-level administrator.


        **Standard update:**

        - **name** (string, optional): Desired workspace name

        - **description** (string, optional): Desired workspace description.
        Send empty string or null to clear.


        **Convert to synced workspace:**

        Provide a `datasource` object to convert a manual workspace into a
        read-only synced workspace. This creates a datasource and schedules a
        first import immediately.


        ```json

        {
          "datasource": {
            "type": "googledrive|sharepoint|servicenow|webscrapper",
            "name": "My datasource",
            "credentials": { ... },
            "filter_criteria": { ... }
          }
        }

        ```


        Credentials per type:

        - **googledrive**: `service_account_file` (JSON string)

        - **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)


        **Edit an existing synced workspace's datasource:**

        Sending a `datasource` payload on an already-synced workspace edits the
        datasource in place — but only while no successful sync has happened
        yet. After the first success the datasource config is locked, and it is
        also locked while a sync is in flight (waiting/processing). Type cannot
        change on edit. The current editability is exposed in the response under
        `sync.editable`.


        **Permissions:**

        - Company Admins can update workspaces within their company

        - Instance-level administrators can update any workspace

        - Conversion is one-way (cannot revert to manual)
      operationId: api_v3_company_workspaces_partial_update
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          description: The unique identifier of the workspace.
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedCompanyWorkspaceUpdateV3Request'
            examples:
              RestoreASoft-deletedWorkspace:
                value:
                  deleted_at: null
                summary: Restore a soft-deleted workspace
              RestoreUnderANewName(resolvesANameCollision):
                value:
                  deleted_at: null
                  name: Project Apollo (restored)
                summary: Restore under a new name (resolves a name collision)
              RestoreAndUpdateTheDescription:
                value:
                  deleted_at: null
                  description: Reinstated after review
                summary: Restore and update the description
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedCompanyWorkspaceUpdateV3Request'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedCompanyWorkspaceUpdateV3Request'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyWorkspaceV3DetailsResponse'
          description: Workspace updated successfully
        '401':
          description: Unauthenticated - Missing or invalid API key/session cookie
        '403':
          description: >-
            Unauthorized - User does not have permission to update company
            workspaces
        '404':
          description: Not Found - Workspace does not exist or belongs to another company
        '409':
          description: >-
            Conflict - Workspace name already exists in the company, or
            datasource edit rejected because a successful sync has already
            happened (config locked) or a sync is currently in flight.
        '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:
    PatchedCompanyWorkspaceUpdateV3Request:
      type: object
      description: V3 Request serializer for updating a workspace in the user's company.
      properties:
        name:
          type: string
          maxLength: 100
        description:
          type: string
        datasource:
          type: object
          additionalProperties: {}
          description: >-
            Datasource configuration to convert this workspace into a read-only
            synced workspace. Company admin only. Cannot be undone. Fields: type
            (googledrive|sharepoint|servicenow|webscrapper), name, credentials,
            filter_criteria.
    CompanyWorkspaceV3DetailsResponse:
      type: object
      description: V3 Response serializer for company workspace creation and retrieval.
      properties:
        id:
          type: integer
        name:
          type: string
        workspace_type:
          type: string
        document_upload_method:
          type: string
        description:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        files_count:
          type: integer
        user_role:
          readOnly: true
          oneOf:
            - $ref: '#/components/schemas/UserRoleEnum'
            - $ref: '#/components/schemas/BlankEnum'
        used_storage:
          type: number
          format: double
        sync:
          oneOf:
            - $ref: '#/components/schemas/WorkspaceSync'
            - type: 'null'
          readOnly: true
        scoped_api_keys:
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceScopedAPIKey'
          readOnly: true
      required:
        - created_at
        - description
        - document_upload_method
        - files_count
        - id
        - name
        - scoped_api_keys
        - sync
        - updated_at
        - used_storage
        - user_role
        - workspace_type
    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.
    UserRoleEnum:
      enum:
        - owner
        - editor
        - viewer
      type: string
      description: |-
        * `owner` - owner
        * `editor` - editor
        * `viewer` - viewer
        * `` - 
    BlankEnum:
      enum:
        - ''
    WorkspaceSync:
      type: object
      properties:
        datasource_type:
          type: string
        source_name:
          type: string
        last_status:
          type: string
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        failed_files_count:
          type: integer
        next_import_date:
          type:
            - string
            - 'null'
          format: date-time
        editable:
          type: boolean
        name:
          type: string
        instance_url:
          type:
            - string
            - 'null'
        tenant_id:
          type: string
        site_name:
          type: string
        client_id:
          type: string
        filter_criteria: {}
      required:
        - client_id
        - datasource_type
        - editable
        - failed_files_count
        - filter_criteria
        - instance_url
        - last_status
        - name
        - next_import_date
        - site_name
        - source_name
        - tenant_id
        - updated_at
    WorkspaceScopedAPIKey:
      type: object
      description: >-
        An API key that can access a single workspace, seen from the workspace
        side.


        Covers both keys explicitly scoped to the workspace
        (`scope_type="workspace"`,

        each carrying its per-workspace role) and the requesting user's
        globally-scoped

        keys (`scope_type="global"`), which implicitly reach every workspace in
        the

        company with the user's own role here. Reads flat dicts built by

        `WorkspaceScopedAPIKeysMixin`, which lists explicitly-scoped keys first.
      properties:
        id:
          type: string
        name:
          type: string
        prefix:
          type: string
        role:
          type: string
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        scope_type:
          $ref: '#/components/schemas/ScopeTypeEnum'
      required:
        - created_at
        - created_by
        - id
        - name
        - prefix
        - role
        - scope_type
    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
    ScopeTypeEnum:
      enum:
        - workspace
        - global
      type: string
      description: |-
        * `workspace` - workspace
        * `global` - global
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````