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

# Insert Data with Embedding

> Embed the data using inference endpoints and then insert the data into the table.
The embedding is generated from the embedding source and stored in the embedding target column.



## OpenAPI

````yaml POST /v2/data/embedding
openapi: 3.1.0
info:
  title: Seahorse API Gateway
  description: >-
    Seahorse API Gateway is an API gateway that integrates vector database, AI
    inference, and storage services. It provides features such as vector search,
    embedding generation, text generation, and object storage.
  license:
    name: ''
  version: 2.0.0-rc1
servers:
  - url: https://{resource_uuid}.api.seahorse.dnotitia.ai
    description: >-
      리소스(스토리지/테이블/인퍼런스 endpoint)별 UUID 서브도메인. UUID 는 콘솔 → 리소스 상세 페이지 "API URL"
      항목에서 확인
    variables:
      resource_uuid:
        default: your-resource-uuid-here
        description: '대시 제거된 32자리 UUID (예: b0348a15cf0e48079e290fe03901247b)'
security: []
tags:
  - name: TABLE_V2
    description: Table operations v2
  - name: STORAGE
    description: Storage Object operations
paths:
  /v2/data/embedding:
    post:
      tags:
        - TABLE_V2
      summary: Insert Data with Embedding
      description: >-
        Embed the data using inference endpoints and then insert the data into
        the table.

        The embedding is generated from the embedding source and stored in the
        embedding target column.
      operationId: insert_data_with_embedding_handler_v2
      requestBody:
        description: >-
          If you provide the data to insert into the table in the 'data' field,
          and set the embedding source and target (using embedding_source and
          embedding_config), the gateway will automatically generate embeddings
          for your data and insert the data with the embeddings into the table.


          Input limits:

          - Max rows in data: 50

          - Max bytes for embedding_source text per row: 32KB


          Primary Key Generation Rules:

          - Format: {Document Id: String}{Record Separator: \RS, ASCII 30}{Chunk
          Id: Int}

          - Document Id: A hash value for duplicate data detection. Recommended
          length is around 128 characters.

          - Record Separator: ASCII 30 character (\u001E)

          - Chunk Id: 4-byte unsigned integer (maximum: 2^32-1). Sequential
          numbers are recommended.

          - Do NOT assign the same primary key value (pk) to different chunks.
          Each pk must be unique per chunk.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataInsertWithEmbeddingRequest'
            example:
              data:
                - id: random1\u001E1
                  metadata: A
                  text: hello
                - id: random1\u001E2
                  metadata: B
                  text: world
              embedding_config:
                - embedding_target: dense_vector
                  embedding_type: dense
                - embedding_target: sparse_vector
                  embedding_type: sparse
              embedding_source: text
        required: true
      responses:
        '200':
          description: Success to insert data with embedding
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CoralResponse_DataInsertResult'
              example:
                code: 200
                data:
                  elapsed_time: 1
                  inserted_record_batches: 1
                  inserted_row_count: 1
                exception: null
                success: true
        '400':
          description: Invalid input provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CoralResponse_ErrorBody'
              example:
                code: 400
                data: null
                exception:
                  error_code: 400001
                  error_message: 'Bad Request: '
                success: false
        '500':
          description: Error occurred while inserting data with embedding.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CoralResponse_ErrorBody'
              example:
                code: 500
                data: null
                exception:
                  error_code: 500001
                  error_message: 'Arrow error: '
                success: false
      security:
        - bearerAuth:
            - WRITE
        - apiKeyAuth:
            - WRITE
components:
  schemas:
    DataInsertWithEmbeddingRequest:
      type: object
      required:
        - data
        - embedding_source
      properties:
        data:
          type: array
          items: {}
          description: List of Data that will be inserted into the table.
        embedding_config:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/EmbeddingConfig'
          description: Embedding type to use. "dense" or "sparse".
        embedding_source:
          type: string
          description: >-
            Name of the column to get text for embedding. ex) text, metadata,
            etc.
        embedding_target:
          type:
            - string
            - 'null'
          description: >-
            Name of the column to store the embedding vector.

            The embedding vector generated from the embedding source will be
            added to the column specified by the embedding target.

            The embedding target column must be a vector column. ex) feature,
            embedding, etc.
    CoralResponse_DataInsertResult:
      type: object
      required:
        - success
        - code
      properties:
        code:
          type: integer
          format: int32
          description: HTTP status code.
          minimum: 0
        data:
          type: object
          required:
            - inserted_record_batches
            - inserted_row_count
          properties:
            elapsed_time:
              type:
                - number
                - 'null'
              format: float
              description: >-
                Elapsed time in seconds for reading the file and inserting the
                data into the table.

                This measures the time taken by the underlying data insertion
                process,

                but does not include the full duration of the API request.
            inserted_record_batches:
              type: integer
              description: Number of total record batches inserted.
              minimum: 0
            inserted_row_count:
              type: integer
              description: Number of total rows inserted.
              minimum: 0
        exception:
          type: object
          required:
            - inserted_record_batches
            - inserted_row_count
          properties:
            elapsed_time:
              type:
                - number
                - 'null'
              format: float
              description: >-
                Elapsed time in seconds for reading the file and inserting the
                data into the table.

                This measures the time taken by the underlying data insertion
                process,

                but does not include the full duration of the API request.
            inserted_record_batches:
              type: integer
              description: Number of total record batches inserted.
              minimum: 0
            inserted_row_count:
              type: integer
              description: Number of total rows inserted.
              minimum: 0
        success:
          type: boolean
          description: Whether the request was successful.
    CoralResponse_ErrorBody:
      type: object
      required:
        - success
        - code
      properties:
        code:
          type: integer
          format: int32
          description: HTTP status code.
          minimum: 0
        data:
          type: object
          required:
            - error_code
            - error_message
          properties:
            error_code:
              type: integer
              format: int32
              minimum: 0
            error_message:
              type: string
        exception:
          type: object
          required:
            - error_code
            - error_message
          properties:
            error_code:
              type: integer
              format: int32
              minimum: 0
            error_message:
              type: string
        success:
          type: boolean
          description: Whether the request was successful.
    EmbeddingConfig:
      type: object
      required:
        - embedding_type
        - embedding_target
      properties:
        embedding_target:
          type: string
          description: >-
            Name of the column to store the embedding vector.

            The embedding vector generated from the embedding source will be
            added to the column specified by the embedding target.

            The embedding target column must be a vector column. ex) feature,
            embedding, etc.
        embedding_type:
          $ref: '#/components/schemas/EmbeddingType'
          description: Embedding type to use. "dense" or "sparse".
    EmbeddingType:
      type: string
      enum:
        - Dense
        - Sparse
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer token authentication. Include the token in the Authorization
        header as 'Bearer <token>'
    apiKeyAuth:
      type: apiKey
      in: header
      name: api-key
      description: API key authentication. Include the key in the api-key header

````