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

# Delete or cancel a task · Ark

> Cancel a task that has not started or remove a finished task from the list.

`DELETE /v1/contents/generations/tasks/{task_id}` returns 204 on success. A task that has not started is cancelled and its reservation refunded; a finished task is removed from the list.

Only tasks that have not started can be cancelled. A running task cannot be cancelled. If deletion returns `task_not_deletable`, keep polling the original task rather than treating it as cancelled.


## OpenAPI

````yaml openapi/relay.en.json DELETE /v1/contents/generations/tasks/{task_id}
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub public API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: List models
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: Image generation
  - name: OpenAI Images
  - name: Video generation
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: Text completions
  - name: OpenAI Audio
  - name: Realtime API
paths:
  /v1/contents/generations/tasks/{task_id}:
    delete:
      tags:
        - Video generation
      summary: Delete a video task
      description: >
        Deletes the task. A queued task is cancelled and its reservation
        refunded. A finished task is removed from the list.
      operationId: deleteSeedanceVideoTask
      parameters:
        - name: task_id
          in: path
          required: true
          example: task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ
          schema:
            type: string
          description: The `id` returned when the task was created
      responses:
        '204':
          description: Deleted, no body
          headers: {}
        '400':
          description: >-
            The task is running, or was already deleted. `code` is
            `task_not_deletable`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceTaskError'
          headers: {}
        '404':
          description: Unknown task ID. `code` is `task_not_exist`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceTaskError'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    SeedanceTaskError:
      type: object
      description: Error response of the video task endpoints.
      properties:
        code:
          type: string
          description: Error code
          example: invalid_duration
        message:
          type: string
          description: Error message
          example: duration must be between 4 and 30 seconds for this model
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.