List batch

GET /batches

List your organization's batches.

Query parameters

  • after string

    A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • limit integer

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

    Default value is 20.

Responses

  • 200 application/json

    Batch listed successfully.

    Hide response attributes Show response attributes object
    • data array[object] Required
      Hide data attributes Show data attributes object
      • id string Required
      • object string Required

        The object type, which is always batch.

        Value is batch.

      • endpoint string Required

        The OpenAI API endpoint used by the batch.

      • errors object
        Hide errors attributes Show errors attributes object
        • object string

          The object type, which is always list.

        • data array[object]
          Hide data attributes Show data attributes object
          • code string

            An error code identifying the error type.

          • message string

            A human-readable message providing more details about the error.

          • param string | null

            The name of the parameter that caused the error, if applicable.

          • line integer | null

            The line number of the input file where the error occurred, if applicable.

      • input_file_id string Required

        The ID of the input file for the batch.

      • completion_window string Required

        The time frame within which the batch should be processed.

      • status string Required

        The current status of the batch.

        Values are validating, failed, in_progress, finalizing, completed, expired, cancelling, or cancelled.

      • The ID of the file containing the outputs of successfully executed requests.

      • The ID of the file containing the outputs of requests with errors.

      • created_at integer Required

        The Unix timestamp (in seconds) for when the batch was created.

      • The Unix timestamp (in seconds) for when the batch started processing.

      • expires_at integer

        The Unix timestamp (in seconds) for when the batch will expire.

      • The Unix timestamp (in seconds) for when the batch started finalizing.

      • The Unix timestamp (in seconds) for when the batch was completed.

      • failed_at integer

        The Unix timestamp (in seconds) for when the batch failed.

      • expired_at integer

        The Unix timestamp (in seconds) for when the batch expired.

      • The Unix timestamp (in seconds) for when the batch started cancelling.

      • The Unix timestamp (in seconds) for when the batch was cancelled.

      • The request counts for different statuses within the batch.

        Hide request_counts attributes Show request_counts attributes object
        • total integer Required

          Total number of requests in the batch.

        • completed integer Required

          Number of requests that have been completed successfully.

        • failed integer Required

          Number of requests that have failed.

      • metadata object | null

        Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.

    • first_id string
    • last_id string
    • has_more boolean Required
    • object string Required

      Value is list.

GET /batches
curl \
 -X GET https://api.openai.com/v1/batches \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "data": [
    {
      "id": "string",
      "object": "batch",
      "endpoint": "string",
      "errors": {
        "object": "string",
        "data": [
          {
            "code": "string",
            "message": "string",
            "param": "string",
            "line": 42
          }
        ]
      },
      "input_file_id": "string",
      "completion_window": "string",
      "status": "validating",
      "output_file_id": "string",
      "error_file_id": "string",
      "created_at": 42,
      "in_progress_at": 42,
      "expires_at": 42,
      "finalizing_at": 42,
      "completed_at": 42,
      "failed_at": 42,
      "expired_at": 42,
      "cancelling_at": 42,
      "cancelled_at": 42,
      "request_counts": {
        "total": 42,
        "completed": 42,
        "failed": 42
      },
      "metadata": {}
    }
  ],
  "first_id": "batch_abc123",
  "last_id": "batch_abc456",
  "has_more": true,
  "object": "list"
}