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

# Generate Schema for Advanced Extraction

> ## 1️⃣ Overview

**Purpose:**  
Generates a schema based on provided file content or file identifier.

The schema generation is driven by an instruction prompt.

---

## 2️⃣ Endpoint

``` bash
POST /noCo/api/v2/workspaces/{workspaceId}/extraction/schema/generate

 ```

---

## 3️⃣ Path Parameters

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

---

## 4️⃣ Authentication

Requires authentication using:

``` id="c3yq8n"
Authorization: Bearer <token>

 ```

---

## 5️⃣ Request Headers

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

---

## 6️⃣ Request Body Schema

``` json
{
  "prompt": "string",
  "content": "string",
  "fileId": "string"
}

 ```

---

## 7️⃣ Field Descriptions

### Schema Generation Fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| prompt | string | ✅ Yes | Instruction for schema generation |
| content | string | ❌ Optional | File content (if not using fileId) |
| fileId | string | ❌ Optional | File ID (if not using content) |

---

## 8️⃣ Example Request

``` bash
curl -X POST https://be.datagol.ai/noCo/api/v2/workspaces/{workspaceId}/extraction/schema/generate \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
  "prompt": "Extract schema from invoice file",
  "content": "file raw text content here"
}'

 ```

---

## 9️⃣ Behavior Summary

Generates a schema using either file content or file ID based on the provided prompt instruction.



## OpenAPI

````yaml /openapi/openapi.yaml post /noCo/api/v2/workspaces/{workspaceId}/extraction/schema/generate
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}/extraction/schema/generate:
    parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
        example: '{{workspaceId}}'
    post:
      tags:
        - AI Extraction
      summary: Generate Schema for Advanced Extraction
      description: >-
        ## 1️⃣ Overview


        **Purpose:**  

        Generates a schema based on provided file content or file identifier.


        The schema generation is driven by an instruction prompt.


        ---


        ## 2️⃣ Endpoint


        ``` bash

        POST /noCo/api/v2/workspaces/{workspaceId}/extraction/schema/generate

         ```

        ---


        ## 3️⃣ Path Parameters


        | Parameter | Type | Required | Description |

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

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


        ---


        ## 4️⃣ Authentication


        Requires authentication using:


        ``` id="c3yq8n"

        Authorization: Bearer <token>

         ```

        ---


        ## 5️⃣ Request Headers


        | Header | Required |

        | --- | --- |

        | Authorization | ✅ Yes |

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


        ---


        ## 6️⃣ Request Body Schema


        ``` json

        {
          "prompt": "string",
          "content": "string",
          "fileId": "string"
        }

         ```

        ---


        ## 7️⃣ Field Descriptions


        ### Schema Generation Fields


        | Field | Type | Required | Description |

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

        | prompt | string | ✅ Yes | Instruction for schema generation |

        | content | string | ❌ Optional | File content (if not using fileId) |

        | fileId | string | ❌ Optional | File ID (if not using content) |


        ---


        ## 8️⃣ Example Request


        ``` bash

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

        -H "Authorization: Bearer <token>" \

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

        -d '{
          "prompt": "Extract schema from invoice file",
          "content": "file raw text content here"
        }'

         ```

        ---


        ## 9️⃣ Behavior Summary


        Generates a schema using either file content or file ID based on the
        provided prompt instruction.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                content:
                  type: string
            example:
              prompt: extract detailed transcript
              content: >-
                [00:00:02] Sarah Miller: Yeah, great to connect.[00:00:04] Mark
                Thompson: Likewise. So just for context — Alex and I started
                working together recently. We’re very early, mostly speaking
                with potential users and understanding their pain
                points.[00:00:18] Sarah Miller: Quick intro from my side — I’ve
                spent the last 10 years in startups. Started in fintech, then
                built a SaaS company focused on workflow tools. Exited last year
                and now exploring the next venture.[00:00:32] Alex Rivera: I’m
                Alex, engineering background. Around 15 years building developer
                tools and infrastructure products. This is my second
                startup.[00:00:44] John Doe: Nice to meet you both. I run a
                small fund investing in early-stage AI and infrastructure
                companies. Also previously built and bootstrapped a company for
                nearly a decade, so I understand the founder journey
                well.[00:01:00] Sarah Miller: Amazing. So our thesis is simple —
                AI isn’t just speeding up software development, it’s changing
                how software should be built entirely. Instead of static apps,
                we’re exploring the idea of “software you can summon” —
                lightweight, adaptive tools that exist only when needed.
                [00:01:20] John Doe: Interesting. Who’s the target
                user?[00:01:23] Alex Rivera: Product managers, designers, and
                technical founders who are building tools themselves but feel
                underserved by existing infrastructure. We want to rethink the
                layer beneath the coding agents.[00:01:38] John Doe: Makes
                sense. The key will be articulating why you, why now, and what
                gives you the right to win.[00:01:46] Sarah Miller: Exactly.
                That’s what we’re refining — and conversations like this really
                help.
      responses:
        '200':
          description: Generate Schema for Advanced Extraction
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        This API uses OAuth 2.0 with the authorization code grant flow.

````