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

# Create Link Column with Auto Join Condition

> ## 1️⃣ Overview

**Purpose:**
Creates a new LINK type column with an automatic join condition between the parent and child tables. Unlike a manual link, this allows defining column-level join conditions that filter how records are linked.

This endpoint supports:
- Defining join conditions between columns of two tables
- Using operators like `EQUALS` for condition matching
- Passing a raw SQL-style `whereClause` and `formula` for backend filtering

---

## 2️⃣ Endpoint

```
POST /noCo/api/v2/workspaces/{workspaceId}/tables/{tableId}/column
```

---

## 3️⃣ Path Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| workspaceId | UUID | ✅ Yes | Workspace identifier |
| tableId | UUID | ✅ Yes | Source (parent) table identifier |

---

## 4️⃣ Authentication

Requires **Bearer JWT Token**

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

---

## 5️⃣ Request Headers

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

---

## 6️⃣ Request Body Schema

```json
{
  "uiDataType": "LINK",
  "colOptions": {
    "associateTableId": "uuid",
    "associateWorkspaceId": "uuid",
    "whereClause": "string"
  },
  "uiMetadata": {
    "title": "string",
    "autoJoinConfig": {
      "joinConditions": [
        {
          "id": "string",
          "currentTableColumn": "string",
          "linkedTableColumn": "string",
          "operator": "EQUALS"
        }
      ],
      "isSwapped": false
    }
  },
   "formula": "string",
  "name": "string"
}
```

---

## 7️⃣ Field Descriptions

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| uiDataType | string | ✅ Yes | Must be `LINK` |
| colOptions.associateTableId | UUID | ✅ Yes | The child or linked table ID |
| colOptions.associateWorkspaceId | UUID | ✅ Yes | The workspace ID of the child (associated) table |
| colOptions.whereClause | string | ✅ Yes | Raw SQL-style condition used for backend join filtering |
| uiMetadata.title | string | ✅ Yes | Display name shown in the UI |
| uiMetadata.autoJoinConfig | object | ✅ Yes | Configuration object defining the auto join conditions |
| uiMetadata.autoJoinConfig.joinConditions | array | ✅ Yes | List of join condition objects |
| uiMetadata.autoJoinConfig.joinConditions[].id | string | ✅ Yes | Unique identifier for the condition (client-generated) |
| uiMetadata.autoJoinConfig.joinConditions[].currentTableColumn | string | ✅ Yes | Column name from the current (source) table to join on |
| uiMetadata.autoJoinConfig.joinConditions[].linkedTableColumn | string | ✅ Yes | Column name from the linked (destination) table to join on |
| uiMetadata.autoJoinConfig.joinConditions[].operator | string | ✅ Yes | Join operator — currently supports `EQUALS` |
| uiMetadata.autoJoinConfig.isSwapped | boolean | ❌ No | Whether the join direction is swapped. Defaults to `false`  |
| formula | string | ✅ Yes | Raw SQL-style formula matching the whereClause, used for backend processing |
| name | string | ✅ Yes | Internal column name — must be unique within the table |



## OpenAPI

````yaml /openapi/openapi.yaml post /noCo/api/v2/workspaces/{workspace_id}/tables/{table_id}/column
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/{workspace_id}/tables/{table_id}/column:
    post:
      tags:
        - Links & Joins
      summary: Create Link Column with Auto Join Condition
      description: >-
        ## 1️⃣ Overview


        **Purpose:**

        Creates a new LINK type column with an automatic join condition between
        the parent and child tables. Unlike a manual link, this allows defining
        column-level join conditions that filter how records are linked.


        This endpoint supports:

        - Defining join conditions between columns of two tables

        - Using operators like `EQUALS` for condition matching

        - Passing a raw SQL-style `whereClause` and `formula` for backend
        filtering


        ---


        ## 2️⃣ Endpoint


        ```

        POST /noCo/api/v2/workspaces/{workspaceId}/tables/{tableId}/column

        ```


        ---


        ## 3️⃣ Path Parameters


        | Parameter | Type | Required | Description |

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

        | workspaceId | UUID | ✅ Yes | Workspace identifier |

        | tableId | UUID | ✅ Yes | Source (parent) table identifier |


        ---


        ## 4️⃣ Authentication


        Requires **Bearer JWT Token**


        ```

        Authorization: Bearer <token>

        ```


        ---


        ## 5️⃣ Request Headers


        | Header | Required |

        | --- | --- |

        | Authorization | ✅ Yes |

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


        ---


        ## 6️⃣ Request Body Schema


        ```json

        {
          "uiDataType": "LINK",
          "colOptions": {
            "associateTableId": "uuid",
            "associateWorkspaceId": "uuid",
            "whereClause": "string"
          },
          "uiMetadata": {
            "title": "string",
            "autoJoinConfig": {
              "joinConditions": [
                {
                  "id": "string",
                  "currentTableColumn": "string",
                  "linkedTableColumn": "string",
                  "operator": "EQUALS"
                }
              ],
              "isSwapped": false
            }
          },
           "formula": "string",
          "name": "string"
        }

        ```


        ---


        ## 7️⃣ Field Descriptions


        | Field | Type | Required | Description |

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

        | uiDataType | string | ✅ Yes | Must be `LINK` |

        | colOptions.associateTableId | UUID | ✅ Yes | The child or linked table
        ID |

        | colOptions.associateWorkspaceId | UUID | ✅ Yes | The workspace ID of
        the child (associated) table |

        | colOptions.whereClause | string | ✅ Yes | Raw SQL-style condition used
        for backend join filtering |

        | uiMetadata.title | string | ✅ Yes | Display name shown in the UI |

        | uiMetadata.autoJoinConfig | object | ✅ Yes | Configuration object
        defining the auto join conditions |

        | uiMetadata.autoJoinConfig.joinConditions | array | ✅ Yes | List of
        join condition objects |

        | uiMetadata.autoJoinConfig.joinConditions[].id | string | ✅ Yes |
        Unique identifier for the condition (client-generated) |

        | uiMetadata.autoJoinConfig.joinConditions[].currentTableColumn | string
        | ✅ Yes | Column name from the current (source) table to join on |

        | uiMetadata.autoJoinConfig.joinConditions[].linkedTableColumn | string
        | ✅ Yes | Column name from the linked (destination) table to join on |

        | uiMetadata.autoJoinConfig.joinConditions[].operator | string | ✅ Yes |
        Join operator — currently supports `EQUALS` |

        | uiMetadata.autoJoinConfig.isSwapped | boolean | ❌ No | Whether the
        join direction is swapped. Defaults to `false`  |

        | formula | string | ✅ Yes | Raw SQL-style formula matching the
        whereClause, used for backend processing |

        | name | string | ✅ Yes | Internal column name — must be unique within
        the table |
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Workspace identifier
        - name: tableId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Source (parent) table identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - uiDataType
                - colOptions
                - uiMetadata
                - formula
                - name
              properties:
                uiDataType:
                  type: string
                  enum:
                    - LINK
                colOptions:
                  type: object
                  required:
                    - associateTableId
                    - associateWorkspaceId
                    - whereClause
                  properties:
                    associateTableId:
                      type: string
                      format: uuid
                      description: The child or linked table ID
                    associateWorkspaceId:
                      type: string
                      format: uuid
                      description: The workspace ID of the child (associated) table
                    whereClause:
                      type: string
                      description: Raw SQL-style condition used for backend join filtering
                uiMetadata:
                  type: object
                  required:
                    - title
                    - autoJoinConfig
                  properties:
                    title:
                      type: string
                      description: Display name shown in the UI
                    autoJoinConfig:
                      type: object
                      properties:
                        joinConditions:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                description: >-
                                  Unique identifier for the condition
                                  (client-generated)
                              currentTableColumn:
                                type: string
                                description: >-
                                  Column name from the current (source) table to
                                  join on
                              linkedTableColumn:
                                type: string
                                description: >-
                                  Column name from the linked (destination)
                                  table to join on
                              operator:
                                type: string
                                enum:
                                  - EQUALS
                                description: Join operator
                        isSwapped:
                          type: boolean
                          description: >-
                            Whether the join direction is swapped. Defaults to
                            false
                formula:
                  type: string
                  description: >-
                    Raw SQL-style formula matching the whereClause, used for
                    backend processing
                name:
                  type: string
                  description: Internal column name — must be unique within the table
            example:
              uiDataType: LINK
              colOptions:
                associateTableId: 6d85b345-b626-4b87-b664-66237d7333e8
                associateWorkspaceId: b3e1a902-1234-4abc-9def-7f8a90bc1234
                whereClause: table_1e67d485."course_taken" = table_c8be6d9c."status"
              uiMetadata:
                title: product link column
                autoJoinConfig:
                  joinConditions:
                    - id: condition-1774312716137
                      currentTableColumn: course_taken
                      linkedTableColumn: status
                      operator: EQUALS
                  isSwapped: false
              formula: table_1e67d485."course_taken" = table_c8be6d9c."status"
              name: product_link_column
      responses:
        '200':
          description: Link column with auto join condition created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: Unique identifier of the created link column
                  name:
                    type: string
                    description: Internal column name, unique within the table
                  uiDataType:
                    type: string
                    description: Always returns `LINK` for link columns
                  formula:
                    type: string
                    description: Raw SQL-style formula used for the join condition
                  backendDataType:
                    type: string
                    description: Underlying database data type assigned to the column
                  workspaceId:
                    type: string
                    format: uuid
                    description: Workspace this column belongs to
                  colOptions:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Unique identifier of the colOptions record
                      relationType:
                        type: string
                        description: >-
                          Relation type resolved by the server — HAS_MANY,
                          ONE_TO_ONE, or MANY_TO_MANY
                      columnId:
                        type: string
                        format: uuid
                        description: ID of the link column in the source (parent) table
                      associatedColumnId:
                        type: string
                        format: uuid
                        description: >-
                          ID of the auto-created reciprocal column in the child
                          table
                      tableId:
                        type: string
                        format: uuid
                        description: Source table ID where the link column was created
                      associateTableId:
                        type: string
                        format: uuid
                        description: Destination (child) table ID
                      associateWorkspaceId:
                        type: string
                        format: uuid
                        description: Workspace ID of the destination (child) table
                      childColumnId:
                        type: string
                        format: uuid
                        description: >-
                          ID of the primary key column in the child
                          (destination) table, used to establish the foreign key
                          relationship
                      parentColumnId:
                        type: string
                        format: uuid
                        description: >-
                          ID of the primary key column in the parent (source)
                          table, used to establish the foreign key relationship
                      whereClause:
                        type: string
                        description: >-
                          Raw SQL-style condition used for backend join
                          filtering
                      isItSource:
                        type: boolean
                        description: >-
                          True if this column is the source side of the
                          relationship
                  uiMetadata:
                    type: object
                    properties:
                      title:
                        type: string
                        description: Display name shown in the UI
                      autoJoinConfig:
                        type: object
                        properties:
                          joinConditions:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                currentTableColumn:
                                  type: string
                                linkedTableColumn:
                                  type: string
                                operator:
                                  type: string
                          isSwapped:
                            type: boolean
                  tableId:
                    type: string
                    format: uuid
                    description: Table ID where this column resides
              example:
                id: efdbce09-6581-4811-aa67-14344e7444b7
                name: product link column
                uiDataType: LINK
                formula: table_1e67d485."course_taken" = table_c8be6d9c."status"
                backendDataType: VARCHAR(255)
                workspaceId: 16231f3f-8208-4c51-a460-87d17244344f
                colOptions:
                  id: e19ab19c-3a38-4d28-9eff-767019524186
                  relationType: MANY_TO_MANY
                  columnId: efdbce09-6581-4811-aa67-14344e7444b7
                  associatedColumnId: 9422e52d-9886-431e-946f-8ed5a8838dac
                  tableId: 9c8a448d-7884-4158-bfca-202bc95b0515
                  associateTableId: 6d85b345-b626-4b87-b664-66237d7333e8
                  associateWorkspaceId: b3e1a902-1234-4abc-9def-7f8a90bc1234
                  childColumnId: 75272cd2-63c4-4d4c-b2eb-20a864834a2a
                  parentColumnId: f830fd3f-8624-4ae5-959f-36f1756d828a
                  whereClause: table_1e67d485."course_taken" = table_c8be6d9c."status"
                  isItSource: true
                uiMetadata:
                  title: product_link_column
                  autoJoinConfig:
                    joinConditions:
                      - id: condition-1774312716137
                        currentTableColumn: course_taken
                        linkedTableColumn: status
                        operator: EQUALS
                    isSwapped: false
                tableId: 9c8a448d-7884-4158-bfca-202bc95b0515
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        This API uses OAuth 2.0 with the authorization code grant flow.

````