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

# 取消或删除视频生成任务

> 按任务状态取消（queued）或删除（终态）视频生成任务。

本接口会根据任务的**当前状态**自动执行取消或删除，行为如下：

| 任务状态             | 执行操作（action） | 说明                 |
| :--------------- | :----------- | :----------------- |
| `queued`（排队中）    | `cancel`     | 取消任务，任务尚未开始生成，无扣费  |
| `succeeded`（成功）  | `delete`     | 删除任务记录             |
| `failed`（失败）     | `delete`     | 删除任务记录             |
| `expired`（超时）    | `delete`     | 删除任务记录             |
| `running`（运行中）   | —            | 不可操作，返回错误（生成中无法取消） |
| `cancelled`（已取消） | —            | 不可操作，返回错误          |


## OpenAPI

````yaml api-reference/video/generation/api/v2-video-generation.json DELETE /v2/video_generation/{task_id}
openapi: 3.1.0
info:
  title: MiniMax API
  description: MiniMax video generation V2 (Hailuo-03) API
  license:
    name: MIT
  version: 2.0.0
servers:
  - url: https://api.minimaxi.com
security:
  - bearerAuth: []
paths:
  /v2/video_generation/{task_id}:
    delete:
      tags:
        - Video V2
      summary: 取消或删除视频生成任务
      description: |-
        根据任务当前状态取消或删除视频生成任务：
        - `queued`（排队中）：取消任务（`action=cancel`），任务尚未开始生成。
        - `succeeded` / `failed` / `expired`（终态）：删除任务记录（`action=delete`）。
        - `running`（运行中）/ `cancelled`（已取消）：不可操作，返回错误。
      operationId: videoGenerationV2Delete
      parameters:
        - name: task_id
          in: path
          required: true
          description: 要取消或删除的视频生成任务 ID。
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteVideoGenerationV2Resp'
        '400':
          $ref: '#/components/responses/Err400'
        '401':
          $ref: '#/components/responses/Err401'
        '429':
          $ref: '#/components/responses/Err429'
        '500':
          $ref: '#/components/responses/Err500'
components:
  schemas:
    DeleteVideoGenerationV2Resp:
      type: object
      properties:
        task_id:
          type: string
          description: 被操作的任务 ID。
        action:
          type: string
          description: 实际执行的操作：`cancel`（取消，仅 queued 态）或 `delete`（删除记录，终态任务）。
          enum:
            - cancel
            - delete
        status:
          type: string
          description: 操作后任务的状态。
      example:
        task_id: '424010985738629'
        action: cancel
        status: cancelled
    OaiError:
      type: object
      description: OpenAI 风格错误响应。出错时 HTTP 状态码为真实错误码(401/400/429/402/422/500…),响应体为该结构。
      properties:
        type:
          type: string
          description: 固定为 `error`。
          example: error
        error:
          $ref: '#/components/schemas/OaiErrorDetail'
        request_id:
          type: string
          description: 请求追踪 ID(便于排查)。
    OaiErrorDetail:
      type: object
      properties:
        type:
          type: string
          description: >-
            错误类型:`authorized_error`(401)/`bad_request_error`(400)/`rate_limit_error`(429)/`insufficient_balance_error`(402)/`unprocessable_entity_error`(422)/`overloaded_error`(529)/`server_error`(500)
            等。
        message:
          type: string
          description: 错误详情,结尾括号内为内部错误码(如 `... (1004)`)。
        http_code:
          type: string
          description: HTTP 状态码字符串,如 `401`。
  responses:
    Err400:
      description: 参数错误
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OaiError'
          example:
            type: error
            error:
              type: bad_request_error
              message: invalid params (2013)
              http_code: '400'
            request_id: 021785229015510a2c883cf675b9804d
    Err401:
      description: 鉴权失败
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OaiError'
          example:
            type: error
            error:
              type: authorized_error
              message: >-
                login fail: Please carry the API secret key in the
                'Authorization' field of the request header (1004)
              http_code: '401'
            request_id: 021785229015510a2c883cf675b9804d
    Err429:
      description: 触发限流
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OaiError'
          example:
            type: error
            error:
              type: rate_limit_error
              message: rate limit, please retry later (1002)
              http_code: '429'
            request_id: 021785229015510a2c883cf675b9804d
    Err500:
      description: 服务端错误
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OaiError'
          example:
            type: error
            error:
              type: server_error
              message: internal error (1000)
              http_code: '500'
            request_id: 021785229015510a2c883cf675b9804d
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |-
        `HTTP: Bearer Auth`
         - Security Scheme Type: http
         - HTTP Authorization Scheme: Bearer API_key，用于验证账户信息，可在 [账户管理>接口密钥](https://platform.minimaxi.com/user-center/basic-information/interface-key) 中查看。

````