POST
/api/v3/delete_images删除图片
按 imgid 批量删除图片,每天 10 次、每次最多 10 张。
删除后不可恢复:存储里的文件和数据库记录会被一并移除。
限制
| 项目 | 限制 |
|---|---|
| 每日请求次数 | 10 次 |
| 单次删除数量 | 10 张 |
超过限制会返回 delete.limit.reached 或 max.10.items。需要一次删除更多图片时,请到网页版控制台操作。
接口信息
| 项目 | 说明 |
|---|---|
| 接口地址 | POST /api/v3/delete_images |
| 请求类型 | POST |
| 内容类型 | application/json |
| 鉴权 | Authorization: Bearer sk-xxx |
请求头
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | 格式 Bearer sk-xxx |
| Content-Type | string | 是 | 固定为 application/json |
请求体
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image_ids | array[string] | 是 | 要删除的 imgid 列表,最多 10 个 |
只能删除自己账号下的图片;imgid 不存在或不属于当前账号时返回 not.found.images。
请求示例
cURL
curl --location --request POST 'https://vip.imgurl.org/api/v3/delete_images' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"image_ids": ["WTfdGUBq", "Aib0ZDoF"]
}'
Python
import requests
url = "https://vip.imgurl.org/api/v3/delete_images"
headers = {
"Authorization": "Bearer sk-xxx",
"Content-Type": "application/json"
}
data = {
"image_ids": ["WTfdGUBq", "Aib0ZDoF"]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
JavaScript
fetch('https://vip.imgurl.org/api/v3/delete_images', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
image_ids: ['WTfdGUBq', 'Aib0ZDoF']
})
})
.then((response) => response.json())
.then((data) => console.log(data))
成功响应
{
"code": 200,
"msg": "delete.success",
"data": {
"count": 2
}
}
count 是实际进入删除队列的图片数量。
失败响应
{
"code": -1000,
"msg": "not.found.images",
"data": null
}
| msg | 说明 |
|---|---|
| invalid.token | Token 缺失、格式不对、已禁用或已过期 |
| empty.imgid.list | image_ids 为空 |
| max.10.items | 一次超过 10 张 |
| invalid.imgid.format | imgid 格式不合法 |
| not.found.images | 图片不存在或不属于当前账号 |
| delete.limit.reached | 超过每天 10 次 |
| delete.failed | 删除过程出错,可重试 |
完整错误码见总览。