---
title: "取消批处理任务"
method: POST
path: "/paas/v4/batches/{batch_id}/cancel"
tags: ["批处理 API"]
---

# 取消批处理任务

`POST /paas/v4/batches/{batch_id}/cancel`

根据批处理任务`ID`取消正在运行的批量处理任务。见 [批量服务](/cn/guide/tools/batch)。点击 **Try it** 按钮可快速试用。

## Path parameters

- `batch_id` string, required

## Response `200`

业务处理成功

- Batch
  - `id` string — 批处理的唯一标识符。
  - `object` string — 对象类型，这里为 `batch`。
  - `endpoint` string — 批处理使用的 `API` 端点。
  - `input_file_id` string — 批处理使用的输入文件的`ID`。
  - `completion_window` string — 批处理应在此时间框架内完成的期限。
  - `status` string — 批处理的当前状态。
  - `output_file_id` string — 包含成功执行请求的输出的文件`ID`。
  - `error_file_id` string — 包含出现错误的请求的输出的文件`ID`。
  - `created_at` integer — 创建批处理的`Unix`时间戳（秒）。
  - `in_progress_at` integer — 批处理开始处理的`Unix`时间戳（秒）。
  - `expires_at` integer — 批处理将过期的`Unix`时间戳（秒）。
  - `finalizing_at` integer — 批处理开始最终处理的`Unix`时间戳（秒）。
  - `completed_at` integer — 批处理完成的`Unix`时间戳（秒）。
  - `failed_at` integer — 批处理失败的`Unix`时间戳（秒）。
  - `expired_at` integer — 批处理过期的`Unix`时间戳（秒）。
  - `cancelling_at` integer — 批处理开始取消的`Unix`时间戳（秒）。
  - `cancelled_at` integer — 批处理取消完成的`Unix`时间戳（秒）。
  - `request_counts` integer — batch 请求计数。
  - `total` integer — 批处理中的请求总数。
  - `completed` integer — 批处理中已成功完成的请求数量。
  - `failed` integer — 批处理中失败的请求数量。
  - `metadata` object — 可附加到对象上的 `16` 个键值对的集合。这有助于以结构化格式存储对象的附加信息。键的长度最多为 `64` 个字符，值的长度最多为 `512` 个字符。

## Other responses

- `default` — 请求失败。

---

[API](https://skmtc.net/bigmodel/apis/zhipu-ai-api.md) · [All operations](https://skmtc.net/bigmodel/apis/zhipu-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bigmodel/zhipu-ai-api/versions/37de2d7b73de/schema)
