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

# Create Batch

> Uploads a JSONL file and launches a new batch with the provided data. Returns the batch id.



## OpenAPI

````yaml openapi-v0.json post /v0/batches
openapi: 3.0.0
info:
  title: API Documentation
  description: API description
  version: '0'
  contact: {}
servers:
  - url: https://api.promptloop.com/
    description: Production API v0
security: []
tags: []
paths:
  /v0/batches:
    post:
      tags:
        - Batches
      summary: Create Batch
      description: >-
        Uploads a JSONL file and launches a new batch with the provided data.
        Returns the batch id.
      operationId: BatchesController_batchLaunch
      parameters: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/BatchLaunchEndpointDataDto'
      responses:
        '201':
          description: Batch successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LaunchBatchResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      security:
        - x-api-key: []
components:
  schemas:
    BatchLaunchEndpointDataDto:
      type: object
      properties:
        batch_input_data:
          type: string
          format: binary
          description: >-
            the path to a JSONL file containing objects with the format: {
            "data_uuid": string, "inputs": array }
          example:
            - data_uuid: string
              inputs:
                - string
        task_id:
          type: string
        task_version:
          type: number
          description: >-
            Optional - Version number of the task to be executed. Will default
            to latest live version.
          example: 1
        batch_name:
          type: string
          description: Optional - Name for the batch job
          example: Research 001
        webhook_url:
          type: string
          description: >-
            Optional - Webhook URL to receive results and success status on
            completion. Data will be sent as a POST request with the data under
            body.data as an array of objects.
          example: https://api.example.com/webhook/batch-results
      required:
        - batch_input_data
        - task_id
    LaunchBatchResponseDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
          example: success
        data:
          type: array
          items:
            $ref: '#/components/schemas/BatchLaunchDto'
        message:
          type: string
        error:
          $ref: '#/components/schemas/ErrorDetailsDto'
      required:
        - status
        - data
        - message
    ErrorResponseDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
          example: error
        data:
          type: object
        message:
          type: string
        error:
          $ref: '#/components/schemas/ErrorDetailsDto'
      required:
        - status
        - data
        - message
    BatchLaunchDto:
      type: object
      properties:
        batch_id:
          type: string
        jobs_submitted:
          type: number
        jobs_added:
          type: number
        jobs_failed_error_indexes:
          type: array
          items:
            $ref: '#/components/schemas/BatchLaunchJobErrorDto'
        estimated_time_to_start:
          format: date-time
          type: string
        estimated_time_to_complete:
          format: date-time
          type: string
      required:
        - batch_id
        - jobs_submitted
        - jobs_added
    ErrorDetailsDto:
      type: object
      properties:
        code:
          type: number
        details:
          type: string
      required:
        - code
        - details
    BatchLaunchJobErrorDto:
      type: object
      properties:
        error_index:
          type: number
        error_message:
          type: string
      required:
        - error_index
        - error_message
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````