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



## OpenAPI

````yaml /api-v2.json post /batch-executions
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-executions:
    post:
      tags:
        - Batch Executions
      summary: Create Batch Execution
      operationId: createExecution
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBatchExecutionRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchExecutionResponse'
        '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 = CreateBatchExecutionRequest(name="Example")

            result = client.batches.executions.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.executions.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.CreateBatchExecutionRequest{
                Name: "Example",
            }

            result, err := client.Batches.Executions.Create(ctx, body)
            if err != nil {
                log.Fatal(err)
            }
            fmt.Println(result)
components:
  schemas:
    CreateBatchExecutionRequest:
      properties:
        batch_spec_json:
          $ref: '#/components/schemas/LegacyBatchSpecJson'
      type: object
      required:
        - batch_spec_json
      title: CreateBatchExecutionRequest
      description: >-
        Legacy request body for POST /batch-execution/ (pre-DEL-1376 compat
        shim).
    BatchExecutionResponse:
      properties:
        id:
          type: string
          title: Id
          description: Execution ID — also the Temporal workflow ID for direct queries
        batch_definition_id:
          type: string
          title: Batch Definition Id
          description: FK to the BatchDefinition this execution ran against
        customer_id:
          type: string
          title: Customer Id
        project_id:
          type: string
          title: Project Id
        agent_urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Urn
        batch_spec_json:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Batch Spec Json
          description: Optional override for the tool's parameters schema
        agent_spec_json:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Agent Spec Json
        input_datasource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Input Datasource Id
        output_datasource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Datasource Id
        input_overrides:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Input Overrides
          description: Optional override for the tool's parameters schema
        total_items:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Items
        succeeded:
          anyOf:
            - type: integer
            - type: 'null'
          title: Succeeded
        failed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Failed
        start_time:
          type: string
          format: date-time
          title: Start Time
        end_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End Time
        status:
          type: string
          title: Status
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Overall error message
        items:
          anyOf:
            - items:
                $ref: '#/components/schemas/BatchItemResult'
              type: array
            - type: 'null'
          title: Items
          description: Per-item results (populated on completion by status callback)
      type: object
      required:
        - id
        - batch_definition_id
        - customer_id
        - project_id
        - start_time
        - status
      title: BatchExecutionResponse
      description: >-
        Response shape for a single batch execution. The legacy
        `batch_spec_json` / `agent_spec_json` / `agent_urn` /
        `input_datasource_id` fields are kept for client compatibility (DEL-1376
        §5.5) — they are reconstructed from the linked BatchDefinition by the
        router, not stored on the execution row.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LegacyBatchSpecJson:
      properties:
        name:
          type: string
          title: Name
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
        agent:
          type: string
          title: Agent
          description: AgentDefinition ID
        user_message:
          anyOf:
            - type: string
            - type: 'null'
          title: User Message
        input:
          $ref: '#/components/schemas/LegacyBatchInputConfig'
        output:
          anyOf:
            - $ref: '#/components/schemas/LegacyBatchOutputConfig'
            - type: 'null'
        execution:
          anyOf:
            - $ref: '#/components/schemas/LegacyBatchExecutionParams'
            - type: 'null'
        additional_properties:
          additionalProperties: true
          type: object
          title: Additional Properties
          default: {}
      type: object
      required:
        - name
        - agent
        - input
      title: LegacyBatchSpecJson
      description: LegacyBatchSpecJson
    BatchItemResult:
      properties:
        input_data_element_id:
          type: string
          title: Input Data Element Id
        filename:
          type: string
          title: Filename
        status:
          type: string
          title: Status
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        output_artifacts:
          anyOf:
            - items:
                anyOf:
                  - additionalProperties: true
                    type: object
                  - type: 'null'
              type: array
            - type: 'null'
          title: Output Artifacts
        attempts:
          anyOf:
            - type: integer
            - type: 'null'
          title: Attempts
          default: 1
      type: object
      required:
        - input_data_element_id
        - filename
        - status
      title: BatchItemResult
      description: Per-item result from the Temporal workflow.
    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
    LegacyBatchInputConfig:
      properties:
        datasource_id:
          type: string
          title: Datasource Id
        filters:
          anyOf:
            - $ref: '#/components/schemas/LegacyBatchInputFilters'
            - type: 'null'
      type: object
      required:
        - datasource_id
      title: LegacyBatchInputConfig
      description: LegacyBatchInputConfig
    LegacyBatchOutputConfig:
      properties:
        datasource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Datasource Id
      type: object
      title: LegacyBatchOutputConfig
      description: LegacyBatchOutputConfig
    LegacyBatchExecutionParams:
      properties:
        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
      type: object
      title: LegacyBatchExecutionParams
      description: LegacyBatchExecutionParams
    LegacyBatchInputFilters:
      properties:
        regex:
          anyOf:
            - type: string
            - type: 'null'
          title: Regex
        media_types:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Media Types
        element_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Element Ids
        additional_properties:
          additionalProperties: true
          type: object
          title: Additional Properties
          default: {}
      type: object
      title: LegacyBatchInputFilters
      description: LegacyBatchInputFilters
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````