{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-openai/json-schema/microsoft-azure-openai-batch-schema.json",
  "title": "Batch",
  "description": "Defines the values of a batch.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-openai-batch-api-openapi.yml#/components/schemas/Batch",
  "required": [
    "id",
    "input_file_id"
  ],
  "type": "object",
  "properties": {
    "id": {
      "description": "The identity of this item.",
      "type": "string"
    },
    "object": {
      "$ref": "#/$defs/TypeDiscriminator"
    },
    "endpoint": {
      "description": "The API endpoint used by the batch.",
      "type": "string",
      "readOnly": true
    },
    "errors": {
      "$ref": "#/$defs/BatchErrors"
    },
    "input_file_id": {
      "description": "The ID of the input file for the batch.",
      "minLength": 1,
      "type": "string"
    },
    "completion_window": {
      "description": "The time frame within which the batch should be processed.",
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/BatchStatus"
    },
    "output_file_id": {
      "description": "The ID of the file containing outputs of successfully executed requests.",
      "type": "string"
    },
    "error_file_id": {
      "description": "The ID of the file containing outputs of requests with errors.",
      "type": "string"
    },
    "created_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch was created (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "in_progress_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch started progressing (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "expires_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch will expire (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "finalizing_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch started finalizing (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "completed_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch was completed (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "failed_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch failed (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "expired_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch expired (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "cancelling_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch started cancelling (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "cancelled_at": {
      "format": "unixtime",
      "description": "A timestamp when this batch was cancelled (in unix epochs).",
      "type": "integer",
      "readOnly": true
    },
    "request_counts": {
      "$ref": "#/$defs/BatchRequestCounts"
    },
    "metadata": {
      "description": "A set of key-value pairs that can be attached to the batch. This can be useful for storing additional information about the batch in a structured format.",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "BatchErrorData": {
      "title": "BatchErrorData",
      "description": "Error information for a failure in batch.",
      "type": "object",
      "properties": {
        "code": {
          "description": "An error code identifying the error type.",
          "type": "string"
        },
        "message": {
          "description": "A human-readable message providing more details about the error.",
          "type": "string"
        },
        "param": {
          "description": "The name of the parameter that caused the error, if applicable (can be null).",
          "type": "string"
        },
        "line": {
          "description": "The line number of the input file where the error occurred, if applicable (can be null).",
          "type": "string"
        }
      }
    },
    "BatchErrors": {
      "title": "BatchErrors",
      "description": "For batches that have failed, this will contain more information on the cause of the failures.",
      "type": "object",
      "properties": {
        "object": {
          "description": "The type of the errors object. This is always 'list'.",
          "type": "string"
        },
        "data": {
          "$ref": "#/$defs/BatchErrorData"
        }
      }
    },
    "BatchRequestCounts": {
      "title": "BatchRequestCounts",
      "description": "The request counts for different statuses within the batch.",
      "type": "object",
      "properties": {
        "total": {
          "description": "The total number of requests in the batch.",
          "type": "integer"
        },
        "completed": {
          "description": "The number of requests in the batch that have been completed successfully.",
          "type": "integer"
        },
        "failed": {
          "description": "The number of requests in the batch that have failed.",
          "type": "integer"
        }
      }
    },
    "BatchStatus": {
      "title": "BatchStatus",
      "description": "The status of a batch.",
      "enum": [
        "validating",
        "failed",
        "in_progress",
        "finalizing",
        "completed",
        "expired",
        "cancelling",
        "cancelled"
      ],
      "type": "string",
      "readOnly": true,
      "x-ms-enum": {
        "name": "BatchStatus",
        "modelAsString": true,
        "values": [
          {
            "value": "validating",
            "description": "The input file is being validated before the batch can begin."
          },
          {
            "value": "failed",
            "description": "The input file has failed the validation process."
          },
          {
            "value": "in_progress",
            "description": "The input file was successfully validated and the batch is currently being executed."
          },
          {
            "value": "finalizing",
            "description": "The batch has completed and the results are being prepared."
          },
          {
            "value": "completed",
            "description": "The batch has been completed and the results are ready."
          },
          {
            "value": "expired",
            "description": "The batch was not able to complete within the 24-hour time window."
          },
          {
            "value": "cancelling",
            "description": "Cancellation of the batch has been initiated."
          },
          {
            "value": "cancelled",
            "description": "The batch was cancelled."
          }
        ]
      }
    },
    "TypeDiscriminator": {
      "title": "TypeDiscriminator",
      "description": "Defines the type of an object.",
      "enum": [
        "list",
        "fine_tuning.job",
        "file",
        "fine_tuning.job.event",
        "fine_tuning.job.checkpoint",
        "model",
        "batch",
        "upload",
        "upload.part"
      ],
      "type": "string",
      "readOnly": true,
      "x-ms-enum": {
        "name": "TypeDiscriminator",
        "modelAsString": true,
        "values": [
          {
            "value": "list",
            "description": "This object represents a list of other objects."
          },
          {
            "value": "fine_tuning.job",
            "description": "This object represents a fine tune job."
          },
          {
            "value": "file",
            "description": "This object represents a file."
          },
          {
            "value": "fine_tuning.job.event",
            "description": "This object represents an event of a fine tuning job."
          },
          {
            "value": "fine_tuning.job.checkpoint",
            "description": "This object represents a checkpoint of a fine tuning job."
          },
          {
            "value": "model",
            "description": "This object represents a model (can be a base model or fine tune job result)."
          },
          {
            "value": "batch",
            "description": "This object represents a batch."
          },
          {
            "value": "upload",
            "description": "This object represents a file upload."
          },
          {
            "value": "upload.part",
            "description": "This object represents part of a file upload."
          }
        ]
      }
    }
  }
}