Skip to main content
Batch

List batches

List batch jobs for your account. Results are sorted by creation time in descending order. Only tasks from the last 30 days are available.

GET
/batches
Python
from openai import OpenAI
import os

client = OpenAI(
  api_key=os.getenv("DASHSCOPE_API_KEY"),
  base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

batches = client.batches.list(limit=2)

for batch in batches.data:
    print(batch.id, batch.status)
{
  "object": "list",
  "data": [
    {
      "id": "batch_abc123",
      "object": "batch",
      "endpoint": "/v1/chat/completions",
      "errors": {
        "object": "list",
        "data": [
          {
            "code": "<string>",
            "message": "<string>",
            "param": "<string>",
            "line": 0
          }
        ]
      },
      "input_file_id": "file-abc123",
      "completion_window": "24h",
      "status": "validating",
      "output_file_id": "file-xyz789",
      "error_file_id": "file-err456",
      "created_at": 1735113344,
      "in_progress_at": 0,
      "expires_at": 0,
      "finalizing_at": 0,
      "completed_at": 0,
      "failed_at": 0,
      "expired_at": 0,
      "cancelled_at": 0,
      "cancelling_at": 0,
      "request_counts": {
        "total": 0,
        "completed": 0,
        "failed": 0
      },
      "metadata": {
        "ds_name": "<string>",
        "ds_description": "<string>"
      }
    }
  ],
  "first_id": "batch_abc123",
  "last_id": "batch_abc456",
  "has_more": false
}

Authorizations

string
header
required

Qwen Cloud API Key. Create one in the console.

Query Parameters

string

Cursor for pagination. Value is the ID of the last batch on the previous page.

batch_abc123
integer
default20

Number of batches to return per page. Range: [1, 100]. Default: 20.

20
1 <= x <= 100
string

Fuzzy match by task name.

string

Filter by input file ID. Multiple IDs separated by commas, up to 20.

file-batch-xxx,file-batch-yyy
string

Filter by task status. Multiple statuses separated by commas. Values: validating, in_progress, finalizing, completed, failed, expired, cancelling, cancelled.

completed,expired
string

Filter tasks created after this time point. Format: yyyyMMddHHmmss.

20250304000000
string

Filter tasks created before this time point. Format: yyyyMMddHHmmss.

20250306123000

Response

200-application/json
enum<string>

Always list.

list
object[]

List of batch objects.

string | null

ID of the first batch in the list.

batch_abc123
string | null

ID of the last batch in the list.

batch_abc456
boolean

Whether there are more batches available after this page.