> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bigmodel.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 检索批处理任务

> 根据批处理任务`ID`获取批量处理任务详情。见 [批量服务](/cn/guide/tools/batch)。点击 **Try it** 按钮可快速试用。



## OpenAPI

````yaml /openapi/openapi.json get /paas/v4/batches/{batch_id}
openapi: 3.0.1
info:
  title: ZHIPU AI API
  description: ZHIPU AI 接口提供强大的 AI 能力，包括聊天对话、工具调用和视频生成。
  license:
    name: ZHIPU AI 开发者协议和政策
    url: https://chat.z.ai/legal-agreement/terms-of-service
  version: 1.0.0
  contact:
    name: Z.AI 开发者
    url: https://chat.z.ai/legal-agreement/privacy-policy
    email: user_feedback@z.ai
servers:
  - url: https://open.bigmodel.cn/api/
    description: 开放平台服务
security:
  - bearerAuth: []
tags:
  - name: 模型 API
    description: Chat API
  - name: 工具 API
    description: Web Search API
  - name: Agent API
    description: Agent API
  - name: 文件 API
    description: File API
  - name: 知识库 API
    description: Knowledge API
  - name: 实时 API
    description: Realtime API
  - name: 批处理 API
    description: Batch API
  - name: 助理 API
    description: Assistant API
  - name: 智能体 API（旧）
    description: QingLiu Agent API
paths:
  /paas/v4/batches/{batch_id}:
    get:
      tags:
        - 批处理 API
      summary: 检索批处理任务
      description: >-
        根据批处理任务`ID`获取批量处理任务详情。见 [批量服务](/cn/guide/tools/batch)。点击 **Try it**
        按钮可快速试用。
      parameters:
        - name: batch_id
          in: path
          required: true
          description: 批处理任务的唯一标识符。
          schema:
            type: string
      responses:
        '200':
          description: 请求成功，返回 Batch 对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
        default:
          description: 请求失败。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Batch:
      type: object
      properties:
        id:
          type: string
          description: 批处理的唯一标识符。
        object:
          type: string
          description: 对象类型，这里为 `batch`。
        endpoint:
          type: string
          description: 批处理使用的 `API` 端点。
        input_file_id:
          type: string
          description: 批处理使用的输入文件的`ID`。
        completion_window:
          type: string
          description: 批处理应在此时间框架内完成的期限。
        status:
          type: string
          description: 批处理的当前状态。
        output_file_id:
          type: string
          description: 包含成功执行请求的输出的文件`ID`。
        error_file_id:
          type: string
          description: 包含出现错误的请求的输出的文件`ID`。
        created_at:
          type: integer
          description: 创建批处理的`Unix`时间戳（秒）。
        in_progress_at:
          type: integer
          description: 批处理开始处理的`Unix`时间戳（秒）。
        expires_at:
          type: integer
          description: 批处理将过期的`Unix`时间戳（秒）。
        finalizing_at:
          type: integer
          description: 批处理开始最终处理的`Unix`时间戳（秒）。
        completed_at:
          type: integer
          description: 批处理完成的`Unix`时间戳（秒）。
        failed_at:
          type: integer
          description: 批处理失败的`Unix`时间戳（秒）。
        expired_at:
          type: integer
          description: 批处理过期的`Unix`时间戳（秒）。
        cancelling_at:
          type: integer
          description: 批处理开始取消的`Unix`时间戳（秒）。
        cancelled_at:
          type: integer
          description: 批处理取消完成的`Unix`时间戳（秒）。
        request_counts:
          type: integer
          description: batch 请求计数。
        total:
          type: integer
          description: 批处理中的请求总数。
        completed:
          type: integer
          description: 批处理中已成功完成的请求数量。
        failed:
          type: integer
          description: 批处理中失败的请求数量。
        metadata:
          type: object
          description: >-
            可附加到对象上的 `16` 个键值对的集合。这有助于以结构化格式存储对象的附加信息。键的长度最多为 `64` 个字符，值的长度最多为
            `512` 个字符。
    Error:
      type: object
      properties:
        error:
          required:
            - code
            - message
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        标准的 HTTP Bearer 认证方式，在 [API
        Keys](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) 页面获取密钥。

````