DELETE
/
v1
/
api
/
v3
/
contents
/
generations
/
tasks
/
{task_id}
删除视频
curl --request DELETE \
  --url https://suanwuyou.com.cn/v1/api/v3/contents/generations/tasks/{task_id} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://suanwuyou.com.cn/v1/api/v3/contents/generations/tasks/{task_id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.text)
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch('https://suanwuyou.com.cn/v1/api/v3/contents/generations/tasks/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://suanwuyou.com.cn/v1/api/v3/contents/generations/tasks/{task_id}"

req, _ := http.NewRequest("DELETE", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
{}
{
"error": {
"message": "invalid api key",
"type": "invalid_request_error",
"code": "unauthorized"
}
}
{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}
{
"error": {
"code": "task_running",
"message": "任务在执行中,无法取消"
}
}
根据任务状态取消任务或删除任务记录。该操作只接受算无忧“创建视频”接口返回的公开任务 ID。
执行中的任务不能取消。running 状态会返回 409 task_running;已取消的任务也不能重复操作。

参数说明

参数位置类型必填说明
task_idPathstring是“创建视频”接口返回的算无忧公开任务 ID。
不同状态的处理方式:
当前状态操作结果
queued向原渠道取消任务,成功后更新为 cancelled。
running拒绝操作,返回 409。
succeeded / failed删除当前用户可见的任务记录;计费和审计记录仍由平台保留。
cancelled拒绝重复操作,返回 409。
任务必须存在且未超过 7 天操作期限。上游接口可参考火山方舟取消或删除视频生成任务。

请求示例

curl --location --request DELETE \
  'https://suanwuyou.com.cn/v1/api/v3/contents/generations/tasks/task_01k5example' \
  --header 'Authorization: Bearer sk-请输入算无忧令牌'

返回示例

成功时返回空 JSON 对象:
{}
任务正在执行时:
{
  "error": {
    "code": "task_running",
    "message": "任务在执行中,无法取消"
  }
}

Authorizations

Authorization
string
header
default:Bearer sk-请输入算无忧令牌
required

填写完整的 Bearer 鉴权值,例如 Bearer sk-你的算无忧令牌。

Path Parameters

task_id
string
required

创建接口返回的算无忧公开任务 ID。

Example:

"task_01k5example"

Response

取消或删除成功。

The response is of type object.