---
title: "Creates and executes a batch from an uploaded file of requests.
Response includes details of the enqueued job including job status.
The ID of the result file is added to the response once complete."
method: POST
path: "/batches"
tags: ["Batch:"]
---

# Creates and executes a batch from an uploaded file of requests.
Response includes details of the enqueued job including job status.
The ID of the result file is added to the response once complete.

`POST /batches`

## Query parameters

- `api-version` string, required

## Request body

- BatchCreateRequest — Defines the request to create a batch.
  - `input_file_id` string — The ID if the input file for the batch.
  - `input_blob` string — The url of an Azure Storage blob to use as input for the batch.
  - `output_folder` BatchOutputReference — The Azure Storage folder to store output.
    - `url` string — The url of the Azure Storage folder where the batch output would be saved.
    - `delimiter` string — Optional. The delimiter used in the folder path, by default /.
  - `endpoint` string, required — The API endpoint used by the batch.
  - `completion_window` string, required — The time frame within which the batch should be processed.
  - `metadata` object — A set of key-value pairs that can be attached to the batch. This can be useful for storing additional infomration about the batch in a structured format.
  - `output_expires_after` FileExpiresAfter — Defines a expiration for the file.
    - `anchor` 'created_at' — Defines the anchor relative to what time the absolute expiration should be generated from.
    - `seconds` integer — The relative expiration time in seconds. Range: [1209600 - 2592000].

## Response `201`

The batch has been successfully created.

- Batch — Defines the values of a batch.
  - `id` string, required — The identity of this item.
  - `object` 'list' | 'fine_tuning.job' | 'file' | 'fine_tuning.job.event' | 'fine_tuning.job.checkpoint' | 'model' | 'upload' | 'upload.part' | 'batch' | 'wandb' — Defines the type of an object.
  - `endpoint` string — The API endpoint used by the batch.
  - `errors` BatchErrors — For batches that have failed, this will contain more information on the cause of the failures.
    - `object` string — The type of the errors object. This is always 'list'.
    - `data` BatchErrorData — Error information for a failure in batch.
      - `code` string — An error code identifying the error type.
      - `message` string — A human-readable message providing more details about the error.
      - `param` string — The name of the parameter that caused the error, if applicable (can be null).
      - `line` string — The line number of the input file where the error occurred, if applicable (can be null).
  - `input_file_id` string, required — The ID of the input file for the batch.
  - `input_blob` string — The blob url containing the input file for the batch.
  - `completion_window` string — The time frame within which the batch should be processed.
  - `status` 'validating' | 'failed' | 'in_progress' | 'finalizing' | 'completed' | 'expired' | 'cancelling' | 'cancelled' — The status of a batch.
  - `output_file_id` string — The ID of the file containing outputs of successfully executed requests.
  - `output_blob` string — The blob url containing outputs of successfully executed requests.
  - `error_file_id` string — The ID of the file containing outputs of requests with errors.
  - `error_blob` string — The blob url containing outputs of requests with errors.
  - `created_at` integer — A timestamp when this batch was created (in unix epochs).
  - `in_progress_at` integer — A timestamp when this batch started progressing (in unix epochs).
  - `expires_at` integer — A timestamp when this batch will expire (in unix epochs).
  - `finalizing_at` integer — A timestamp when this batch started finalizing (in unix epochs).
  - `completed_at` integer — A timestamp when this batch was completed (in unix epochs).
  - `failed_at` integer — A timestamp when this batch failed (in unix epochs).
  - `expired_at` integer — A timestamp when this batch expired (in unix epochs).
  - `cancelling_at` integer — A timestamp when this batch started cancelling (in unix epochs).
  - `cancelled_at` integer — A timestamp when this batch was cancelled (in unix epochs).
  - `request_counts` BatchRequestCounts — The request counts for different statuses within the batch.
    - `total` integer — The total number of requests in the batch.
    - `completed` integer — The number of requests in the batch that have been completed successfully.
    - `failed` integer — The number of requests in the batch that have failed.
  - `metadata` object — A set of key-value pairs that can be attached to the batch. This can be useful for storing additional infomration about the batch in a structured format.

## Other responses

- `default` — An error occurred.

---

[API](https://skmtc.net/azure/apis/cognitiveservices-azureopenai-authoring.md) · [All operations](https://skmtc.net/azure/apis/cognitiveservices-azureopenai-authoring/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/cognitiveservices-azureopenai-authoring/versions/b177dc430e39/schema)
