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

# Search Data Elements



## OpenAPI

````yaml /api-v2.json post /datasources/{datasource_id}/data-elements/search
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/search:
    post:
      tags:
        - Data Elements
      summary: Search Data Elements
      operationId: searchDataElements
      parameters:
        - name: datasource_id
          in: path
          required: true
          schema:
            type: string
            title: Datasource Id
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Cursor for pagination
            title: Cursor
          description: Cursor for pagination
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000
            minimum: 1
            description: Maximum items to return
            default: 100
            title: Limit
          description: Maximum items to return
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataElementSearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataElementListResponse'
        '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 DataElementSearchRequest


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


            datasource_id = "ds_9f8a7b6c5d4e"


            search_request = DataElementSearchRequest(
                regex_filter=r"^invoice_.*",
                media_type_filters=["application/pdf", "text/csv"],
            )


            response = client.datasources.data_elements.search(datasource_id,
            search_request)


            for element in response.items:
                print(f"{element.id}: {element.name} ({element.media_type})")

            print(f"has_next={response.has_next},
            next_cursor={response.next_cursor}")
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from "meibel";


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


            const results = await client.datasources.dataElements.search(
              "ds_8f3a1c2b9e",
              {
                regex_filter: "^invoice_.*\\.pdf$",
                media_type_filters: ["application/pdf"],
              }
            );


            for (const element of results.items) {
              console.log(`${element.name} (${element.media_type})`);
            }
        - 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\tresp, err := client.Datasources.DataElements.Search(\n\t\tcontext.Background(),\n\t\t\"ds_9f8a1c2b3d4e\",\n\t\tv2.DataElementSearchRequest{\n\t\t\tRegexFilter:       v2.String(\"^invoice_.*\"),\n\t\t\tMediaTypeFilters:  []string{\"application/pdf\", \"image/png\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, item := range resp.Items {\n\t\tfmt.Printf(\"%s: %s\\n\", item.ID, item.Name)\n\t}\n}"
components:
  schemas:
    DataElementSearchRequest:
      properties:
        regex_filter:
          anyOf:
            - type: string
            - type: 'null'
          title: Regex Filter
          description: Regex pattern to filter by name
        media_type_filters:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Media Type Filters
          description: Filter by MIME types
      type: object
      title: DataElementSearchRequest
      description: Body for searching data elements on a datasource.
    DataElementListResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DataElementResponse'
          type: array
          title: Items
          description: Page of data elements
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: >-
            Pass to the next request as `cursor` to fetch the next page. Null
            when there are no more pages
        has_next:
          type: boolean
          title: Has Next
          description: True if more pages are available
          default: false
      type: object
      required:
        - items
      title: DataElementListResponse
      description: Paginated list of data elements.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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.
    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

````