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

# Update Data Element



## OpenAPI

````yaml /api-v2.json put /datasources/{datasource_id}/data-elements/{data_element_id}
openapi: 3.1.0
info:
  title: Meibel AI API
  summary: Meibel Gateway Service
  description: >-
    Our API allows you to interact with our services. Read the
    [docs](https://docs.meibel.ai) to learn how to use it.
  version: 0.6.4
servers:
  - url: https://api.meibel.ai/v2
    description: Meibel API (v2)
  - url: https://api.dev.meibel.ai/v2
    description: Meibel Dev API (v2)
  - url: http://localhost:8000/v2
    description: Local Development
security: []
tags:
  - name: Datasources
    description: v2 datasource management
  - name: Data Elements
    description: v2 data element CRUD and search
  - name: File Upload
    description: Upload files to a datasource and track upload progress
  - name: Ingest
    description: Trigger and monitor datasource ingestion
  - name: Datasource Downloads
    description: Export all datasource content as a zip archive
  - name: Table Descriptions
    description: v2 table and column descriptions
  - name: Metadata Model Catalog
    description: v2 metadata model catalog
  - name: Confidence Scoring
    description: v2 confidence scoring jobs and summaries
  - name: Documents
    description: Parse and transform documents into structured data
  - name: Agents
    description: Agent definition management
  - name: Sessions
    description: Agent session (execution) management and chat
  - name: Execution Policies
    description: Data access and tool usage constraints scoped to agent sessions
  - name: Artifact Schemas
    description: Agent artifact schema management
paths:
  /datasources/{datasource_id}/data-elements/{data_element_id}:
    put:
      tags:
        - Data Elements
      summary: Update Data Element
      operationId: updateDataElement
      parameters:
        - name: data_element_id
          in: path
          required: true
          schema:
            type: string
            title: Data Element Id
        - name: datasource_id
          in: path
          required: true
          schema:
            type: string
            title: Datasource Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDataElementRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataElementResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            import os
            from meibel import MeibelClient
            from meibel.models import UpdateDataElementRequest

            client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])

            updated_element = client.datasources.data_elements.update(
                datasource_id="ds_9f3c2a1b7e",
                data_element_id="elem_4a8b1c2d3e",
                body=UpdateDataElementRequest(
                    name="Q4 Sales Report (Final)",
                    description="Final version of the Q4 sales report, reviewed by finance",
                    metadata={"reviewed": True, "reviewer": "jane.doe@example.com"},
                ),
            )

            print(f"{updated_element.id}: {updated_element.name}")
            print(f"Updated at: {updated_element.updated_at}")
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from "meibel";


            const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY
            });


            const dataElement = await client.datasources.dataElements.update(
              "ds_9f8a7b6c5d4e",
              "elem_3c2b1a0f9e8d",
              {
                name: "Q4 Sales Report",
                description: "Quarterly sales figures for North America region",
                metadata: {
                  region: "north-america",
                  quarter: "Q4-2024",
                },
              }
            );


            console.log(`${dataElement.name}: ${dataElement.description}`);
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tv2 \"github.com/meibel-ai/meibel-go/v2\"\n)\n\nfunc main() {\n\tclient := v2.NewClient(v2.WithAPIKey(os.Getenv(\"MEIBEL_API_KEY\")))\n\n\telement, err := client.Datasources.DataElements.Update(\n\t\tcontext.Background(),\n\t\t\"ds_9f3c8b2a1e4d\",\n\t\t\"elem_7a2b1c9d4e3f\",\n\t\tv2.UpdateDataElementRequest{\n\t\t\tName:        v2.String(\"Q3 Sales Report\"),\n\t\t\tDescription: v2.String(\"Quarterly sales figures grouped by region\"),\n\t\t\tMetadata: map[string]any{\n\t\t\t\t\"region\": \"north-america\",\n\t\t\t\t\"fiscal_year\": 2024,\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"Updated data element %s: %s\\n\", element.ID, element.Name)\n}"
components:
  schemas:
    UpdateDataElementRequest:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Updated name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Updated description
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Metadata key-value pairs — replaces all existing metadata
      type: object
      title: UpdateDataElementRequest
      description: Body for updating a data element. Omit a field to leave it unchanged.
    DataElementResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique data element ID
        datasource_id:
          type: string
          title: Datasource Id
          description: ID of the datasource this element belongs to
        name:
          type: string
          title: Name
          description: Data element name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Human-authored description
        media_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Type
          description: MIME type of the underlying content
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Arbitrary metadata key-value pairs
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: ISO 8601 creation timestamp
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
          description: ISO 8601 last-update timestamp
      type: object
      required:
        - id
        - datasource_id
        - name
      title: DataElementResponse
      description: A single data element on a datasource.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````