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

# Create Batch Definition



## OpenAPI

````yaml /api-v2.json post /batch-definitions
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: Artifact Schemas
    description: Agent artifact schema management
paths:
  /batch-definitions:
    post:
      tags:
        - Batch Definitions
      summary: Create Batch Definition
      operationId: createBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBatchDefinitionRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBatchDefinitionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            from meibel import MeibelClient

            client = MeibelClient(api_key="your-api-key")

            # Create request body
            body = CreateBatchDefinitionRequest(name="Example")

            result = client.batches.create(body=body)
            print(result)
        - lang: TypeScript
          label: TypeScript
          source: |-
            import { MeibelClient } from 'meibel';

            const client = new MeibelClient({ apiKey: 'your-api-key' });

            // Create request body
            const body = { name: 'Example' };

            const result = await client.batches.create(body);
            console.log(result);
        - lang: Go
          label: Go
          source: |-
            import v2 "github.com/meibel-ai/meibel-go/v2"

            client := v2.NewClient(v2.WithAPIKey("your-api-key"))
            ctx := context.Background()

            // Create request body
            body := v2.CreateBatchDefinitionRequest{
                Name: "Example",
            }

            result, err := client.Batches.Create(ctx, body)
            if err != nil {
                log.Fatal(err)
            }
            fmt.Println(result)
components:
  schemas:
    CreateBatchDefinitionRequest:
      properties:
        name:
          type: string
          title: Name
          description: Kebab-case label (non-unique within tenant)
        agent_id:
          type: string
          title: Agent Id
          description: AgentDefinition ID; resolved + pinned at creation time
        input_datasource_id:
          type: string
          title: Input Datasource Id
          description: Datasource holding the input Data Elements
        filters:
          anyOf:
            - $ref: '#/components/schemas/BatchDefinitionFilters'
            - type: 'null'
        output_datasource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Datasource Id
          description: Pinned output sink. NULL = workflow auto-creates per execution.
        user_message:
          anyOf:
            - type: string
            - type: 'null'
          title: User Message
        concurrency:
          anyOf:
            - type: integer
              maximum: 999
              minimum: 1
            - type: 'null'
          title: Concurrency
          default: 10
        retry_limit:
          anyOf:
            - type: integer
              maximum: 999
              minimum: 0
            - type: 'null'
          title: Retry Limit
          default: 2
        recurrence_cron:
          anyOf:
            - type: string
            - type: 'null'
          title: Recurrence Cron
          description: >-
            Cron expression validated by croniter; not yet scheduled in
            DEL-1376.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      type: object
      required:
        - name
        - agent_id
        - input_datasource_id
      title: CreateBatchDefinitionRequest
      description: Create a new BatchDefinition lineage.
    CreateBatchDefinitionResponse:
      properties:
        id:
          type: string
          title: Id
        catalog_urn:
          type: string
          title: Catalog Urn
        name:
          type: string
          title: Name
        version:
          type: string
          title: Version
      type: object
      required:
        - id
        - catalog_urn
        - name
        - version
      title: CreateBatchDefinitionResponse
      description: Compact post-create payload mirroring CreateAgentDefinitionResponse.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BatchDefinitionFilters:
      properties:
        regex:
          anyOf:
            - type: string
            - type: 'null'
          title: Regex
          description: Filter Data Elements by name pattern (regex)
        media_types:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Media Types
          description: Filter Data Elements by content type
        element_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Element Ids
          description: Recipe-pinned subset of Data Element IDs.
      type: object
      title: BatchDefinitionFilters
      description: >-
        Recipe-level filters. element_ids belongs here; per-execution overrides
        use BatchInputOverrides on the execution row.
    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

````