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

# Add User to Workspace

> ## 1️⃣ Overview

**Purpose:**
Allows adding multiple users to a specific workspace in a single request.

Each user is assigned a role within the workspace.

Upon being added, the invited user receives an email containing a registration link with a unique `hash` and `type` as query parameters:

```
http://<app-domain>/register?hash=e0754cfc-f7d1-4cc3-8690-e34a2f17291d&type=WORK_SPACE
```

- `hash` — A unique UUID tied to the workspace invitation. Must be passed in the sign-up API to complete registration.
- `type` — Indicates the invitation context. `WORK_SPACE` means the user is being invited to a workspace.

---

## 2️⃣ Endpoint

``` bash
POST /noCo/api/v2/workspaces/{workspaceId}/bulkUsers
```

---

## 3️⃣ Path Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| workspaceId | UUID | ✅ Yes | Identifier of the workspace |

---

## 4️⃣ Authentication

Requires authentication using:

``` bash
Authorization: Bearer <token>
```

---

## 5️⃣ Request Headers

| Header | Required |
| --- | --- |
| Authorization | ✅ Yes |
| Content-Type: application/json | ✅ Yes |

---

## 6️⃣ Request Body Schema

``` json
{
  "workSpaceUsers": [
    {
      "email": "string",
      "role": "string"
    }
  ],
  "message": "string"
}
```

---

## 7️⃣ Field Descriptions

### Workspace Users

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| workSpaceUsers | array | ✅ Yes | List of users to be added to the workspace |
| workSpaceUsers.email | string | ✅ Yes | Email ID of the user |
| workSpaceUsers.role | string | ✅ Yes | Role assigned in the workspace (CREATOR, EDITOR, VIEWER) |
| message | string | ❌ No | Optional message sent along with the invite |

---

## 8️⃣ Invitation Flow

Once this API is called successfully, the invited user receives an email with a registration link:

```
http://<app-domain>/register?hash=e0754cfc-f7d1-4cc3-8690-e34a2f17291d&type=WORK_SPACE
```

The user must use this link to complete their registration by calling:

```
POST /idp/api/v1/user/sign-up
```

With the `hash` extracted from the link:

``` json
{
  "email": "user@example.com",
  "password": "Demo12#$",
  "firstname": "John",
  "lastname": "Doe",
  "hash": "e0754cfc-f7d1-4cc3-8690-e34a2f17291d"
}
```

> ⚠️ The `hash` is single-use and time-limited. If expired, the workspace admin must re-invite the user.

---

## 9️⃣ Example Request

``` bash
curl -X POST https://be.datagol.ai/noCo/api/v2/workspaces/{workspaceId}/bulkUsers \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
  "workSpaceUsers": [
    {
      "email": "user1@datagol.com",
      "role": "EDITOR"
    },
    {
      "email": "user2@datagol.com",
      "role": "VIEWER"
    }
  ],
  "message": "Workspace access invitation"
}'
```

---

## 🔟 Behavior Summary

```
Enables bulk addition of users to a workspace and assigns roles to each user.
• Role Assignment — Each user is assigned CREATOR, EDITOR, or VIEWER role.
• Invitation Email — Each invited user receives an email with a registration link containing a unique hash and type=WORK_SPACE.
• Hash-Based Registration — The invited user must use the hash from the email link to complete sign-up via POST /idp/api/v1/user/sign-up.
• OTP Not Required — Workspace-invited users are activated via hash validation and do not go through the OTP verification step.
```



## OpenAPI

````yaml /openapi/openapi.yaml post /noCo/api/v2/workspaces/{workspaceId}/bulkUsers
openapi: 3.0.0
info:
  title: DataGOL APIs
  version: 1.0.0
  description: ''
servers:
  - url: https://be.datagol.ai
  - url: https://be.datagol.ai
  - url: https://kg.datagol.ai
  - url: https://ai.datagol.ai
security: []
tags:
  - name: Links & Joins
    description: >
      ## 🔗 Links & Joins


      LINK and LOOKUP are special workbook column types that enable relational
      data modeling across tables.


      | Column Type | Purpose |

      |---|---|

      | `LINK` | Defines a relationship between two tables |

      | `LOOKUP` | Projects columns from an associated table via a link |


      Both are configured through `ColumnDTO.colOptions`. A table can have
      multiple link columns, and each link can have multiple lookup columns.


      ---


      ## 📐 UI Data Types


      - **LINK** — Special column used to represent inter-table relations

      - **LOOKUP** — Special column used to project associated table fields via
      a link


      ---


      ## 🔗 LINK Semantics


      A LINK column stores metadata for:

      - `tableId` — Current table

      - `associatedTableId` — Associated (linked) table

      - `relationType` — Type of relationship

      - `linkColumnId` — Link column identifier


      **Supported relation patterns:**


      | Pattern | Description |

      |---|---|

      | `ONE_TO_ONE` | Each record in the source maps to one record in the
      destination |

      | `ONE_TO_MANY` | One source record maps to many destination records |

      | `MANY_TO_MANY` | Many source records map to many destination records |


      ---


      ## 🔍 LOOKUP Semantics


      - A LOOKUP column is tightly coupled with a specific LINK column

      - References a link using `linkColumnId`

      - Represents a selected column from the associated table

      - Multiple lookup columns can be defined for the same link


      ---


      ## 🗂️ Metadata in `ColumnDTO.colOptions`


      Use `colOptions` to persist link/lookup metadata.


      | Field | Description |

      |---|---|

      | `columnId` | Current column ID |

      | `tableId` | Current table ID |

      | `associatedTableId` | Associated table ID |

      | `linkColumnId` | Link column ID — used by LOOKUP; references the LINK
      column's `columnId` |

      | `relationType` | Relation semantics for LINK |


      ---


      ## 🔄 Manual Linking Record Flow


      To create manual record-level links:


      1. Fetch associated table schema/data

      2. User selects associated record(s) to link

      3. Send linking payload with:
          - `sourceRecordId` — PK of the current table row
          - `destinationRecordId` — PK of the associated table row
          - `linkColumnId` — LINK column identifier
      4. Backend resolves link metadata from `linkColumnId` (relation type,
      associated table, direction/constraints)

      5. Backend applies relation rules and stores the link relation


      ---


      ## 📋 Record Linking Contract


      | Field | Description |

      |---|---|

      | `sourceRecordId` | PK of the current table row |

      | `destinationRecordId` | PK of the associated table row |

      | `linkColumnId` | LINK column identifier |

      | `tableId` | Current table ID |


      > Backend derives all remaining relation metadata from the link
      configuration.


      ---


      ## ⚠️ Important Notes


      > - LINK and LOOKUP are **column-level constructs** first; record linking
      is a data-level operation built on top

      > - LOOKUP behavior depends on LINK existence and metadata integrity

      > - With multiple links to the same associated table, each LOOKUP must
      bind to the correct `linkColumnId`

      > - Always treat the associated row ID as the associated table PK for
      linking UI selection
paths:
  /noCo/api/v2/workspaces/{workspaceId}/bulkUsers:
    parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
        example: '{{workspaceId}}'
    post:
      tags:
        - Workspaces
      summary: Add User to Workspace
      description: >-
        ## 1️⃣ Overview


        **Purpose:**

        Allows adding multiple users to a specific workspace in a single
        request.


        Each user is assigned a role within the workspace.


        Upon being added, the invited user receives an email containing a
        registration link with a unique `hash` and `type` as query parameters:


        ```

        http://<app-domain>/register?hash=e0754cfc-f7d1-4cc3-8690-e34a2f17291d&type=WORK_SPACE

        ```


        - `hash` — A unique UUID tied to the workspace invitation. Must be
        passed in the sign-up API to complete registration.

        - `type` — Indicates the invitation context. `WORK_SPACE` means the user
        is being invited to a workspace.


        ---


        ## 2️⃣ Endpoint


        ``` bash

        POST /noCo/api/v2/workspaces/{workspaceId}/bulkUsers

        ```


        ---


        ## 3️⃣ Path Parameters


        | Parameter | Type | Required | Description |

        | --- | --- | --- | --- |

        | workspaceId | UUID | ✅ Yes | Identifier of the workspace |


        ---


        ## 4️⃣ Authentication


        Requires authentication using:


        ``` bash

        Authorization: Bearer <token>

        ```


        ---


        ## 5️⃣ Request Headers


        | Header | Required |

        | --- | --- |

        | Authorization | ✅ Yes |

        | Content-Type: application/json | ✅ Yes |


        ---


        ## 6️⃣ Request Body Schema


        ``` json

        {
          "workSpaceUsers": [
            {
              "email": "string",
              "role": "string"
            }
          ],
          "message": "string"
        }

        ```


        ---


        ## 7️⃣ Field Descriptions


        ### Workspace Users


        | Parameter | Type | Required | Description |

        | --- | --- | --- | --- |

        | workSpaceUsers | array | ✅ Yes | List of users to be added to the
        workspace |

        | workSpaceUsers.email | string | ✅ Yes | Email ID of the user |

        | workSpaceUsers.role | string | ✅ Yes | Role assigned in the workspace
        (CREATOR, EDITOR, VIEWER) |

        | message | string | ❌ No | Optional message sent along with the invite
        |


        ---


        ## 8️⃣ Invitation Flow


        Once this API is called successfully, the invited user receives an email
        with a registration link:


        ```

        http://<app-domain>/register?hash=e0754cfc-f7d1-4cc3-8690-e34a2f17291d&type=WORK_SPACE

        ```


        The user must use this link to complete their registration by calling:


        ```

        POST /idp/api/v1/user/sign-up

        ```


        With the `hash` extracted from the link:


        ``` json

        {
          "email": "user@example.com",
          "password": "Demo12#$",
          "firstname": "John",
          "lastname": "Doe",
          "hash": "e0754cfc-f7d1-4cc3-8690-e34a2f17291d"
        }

        ```


        > ⚠️ The `hash` is single-use and time-limited. If expired, the
        workspace admin must re-invite the user.


        ---


        ## 9️⃣ Example Request


        ``` bash

        curl -X POST
        https://be.datagol.ai/noCo/api/v2/workspaces/{workspaceId}/bulkUsers \

        -H "Authorization: Bearer <token>" \

        -H "Content-Type: application/json" \

        -d '{
          "workSpaceUsers": [
            {
              "email": "user1@datagol.com",
              "role": "EDITOR"
            },
            {
              "email": "user2@datagol.com",
              "role": "VIEWER"
            }
          ],
          "message": "Workspace access invitation"
        }'

        ```


        ---


        ## 🔟 Behavior Summary


        ```

        Enables bulk addition of users to a workspace and assigns roles to each
        user.

        • Role Assignment — Each user is assigned CREATOR, EDITOR, or VIEWER
        role.

        • Invitation Email — Each invited user receives an email with a
        registration link containing a unique hash and type=WORK_SPACE.

        • Hash-Based Registration — The invited user must use the hash from the
        email link to complete sign-up via POST /idp/api/v1/user/sign-up.

        • OTP Not Required — Workspace-invited users are activated via hash
        validation and do not go through the OTP verification step.

        ```
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                workSpaceUsers:
                  type: array
                  items:
                    type: object
                    properties:
                      email:
                        type: string
                        format: email
                      role:
                        type: string
                        enum:
                          - CREATOR
                          - EDITOR
                          - VIEWER
                message:
                  type: string
            example:
              workSpaceUsers:
                - email: user1@datagol.com
                  role: EDITOR
                - email: user2@datagol.com
                  role: VIEWER
      responses:
        '200':
          description: Add User to Workspace
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        This API uses OAuth 2.0 with the authorization code grant flow.

````