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

# Set or update workspaces

> Sets or replaces all Workspaces in the specified workspace group with the provided list. This is a replacement operation, not incremental update: all existing Workspaces are replaced. Returns a summary with the total Workspaces in the group after the update.



## OpenAPI

````yaml /en/api-reference/openapi.en-v1.json put /v1/organizations/{organization_id}/workspace-groups/{workspace_group_id}/workspaces
openapi: 3.0.3
info:
  title: Public Portal API
  version: 1.0.0
  description: Public REST API for portal
servers:
  - url: https://api.staging.flxwvdexternal.com
    description: Staging API server.
security:
  - bearerAuth: []
tags: []
paths:
  /v1/organizations/{organization_id}/workspace-groups/{workspace_group_id}/workspaces:
    put:
      tags:
        - Workspace groups
      summary: Set or update workspaces
      description: >-
        Sets or replaces all Workspaces in the specified workspace group with
        the provided list. This is a replacement operation, not incremental
        update: all existing Workspaces are replaced. Returns a summary with the
        total Workspaces in the group after the update.
      operationId: updateWorkspaceGroupsWorkspace
      parameters:
        - name: organization id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: The unique identifier of the organization
          example: 507f1f77bcf86cd799439011
        - name: workspace_group_id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: The unique identifier of the workspace group
          example: 507f1f77bcf86cd799439020
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspacesUpdateRequestV1'
            examples:
              set-workspaces-in-group:
                summary: Set multiple Workspaces in a workspace group
                value:
                  workspace_ids:
                    - 507f1f77bcf86cd799439030
                    - 507f1f77bcf86cd799439031
              remove-all-workspaces:
                summary: >-
                  Remove all Workspaces from workspace group by providing an
                  empty array
                value:
                  workspace_ids: []
              set-single-workspace:
                summary: Set a single Workspace in a workspace group
                value:
                  workspace_ids:
                    - 507f1f77bcf86cd799439030
      responses:
        '200':
          description: >-
            Workspaces successfully updated in the workspace group. Returns a
            summary of the result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateWorkspaceGroupWorkspacesResponseV1'
        '400':
          $ref: '#/components/responses/BadRequest'
          description: >-
            Bad Request. Common Causes: - Invalid request body structure -
            Invalid Workspace ID format
        '401':
          $ref: '#/components/responses/Unauthorized'
          description: 'Unauthorized: authentication required'
        '404':
          $ref: '#/components/responses/NotFound'
          description: Workspace group not found or not belonging to the organization
        '422':
          description: >-
            Unprocessable entity. Common causes: - Workspace IDs do not exist -
            Workspaces do not belong to the organization - Invalid Workspace IDs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    WorkspacesUpdateRequestV1:
      type: object
      properties:
        workspace_ids:
          type: array
          items:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: Array of Workspace IDs
      required:
        - workspace_ids
    UpdateWorkspaceGroupWorkspacesResponseV1:
      type: object
      properties:
        message:
          type: string
          description: Confirmation message for update
        total_in_group:
          type: integer
          description: Total Workspaces in the group after applying the update
      required:
        - message
        - total_in_group
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````