资源管理
确认资源上传
接口说明:客户端直传对象存储完成后回调确认,记录资源最终状态与访问路径。
POST
/
api
/
assets
/
{id}
/
confirm
确认资源上传
curl --request POST \
--url https://aitoearn.cn/api/assets/{id}/confirm \
--header 'X-Api-Key: <api-key>'import requests
url = "https://aitoearn.cn/api/assets/{id}/confirm"
headers = {"X-Api-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://aitoearn.cn/api/assets/{id}/confirm', 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://aitoearn.cn/api/assets/{id}/confirm"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"code": 0,
"message": "请求成功",
"data": {
"id": "string",
"userId": "string",
"userType": "user",
"path": "string",
"type": "aiImage",
"status": "pending",
"mimeType": "string",
"createdAt": "2026-07-02T12:00:00.000Z",
"updatedAt": "2026-07-02T12:00:00.000Z",
"url": "string",
"size": 1,
"filename": "string"
}
}授权
需要从 AiToEarn 获取 API Key。点击前往「API Key 获取教程」。
路径参数
响应
200 - application/json
请求已被服务处理。业务是否成功以响应体 code === 0 为准。
业务状态码。0 表示成功,非 0 表示业务错误。
响应消息。
Hide child attributes
Hide child attributes
唯一标识
用户 ID
用户类型
可用选项:
user, admin, system 资源存储路径
类型标识
可用选项:
aiImage, aiVideo, aiCard, aiChatImage, aideoOutput, videoEdit, dramaRecap, styleTransfer, imageEdit, subtitle, userMedia, userFile, publishMedia, avatar, agentSession, videoThumbnail, googlePlace, brandLibrary, temp 业务状态
可用选项:
pending, uploaded, confirmed, failed 媒体类型
创建时间
更新时间
资源 URL
资源大小
文件名
请求 ID。
错误响应时间戳,Unix 毫秒。
⌘I
确认资源上传
curl --request POST \
--url https://aitoearn.cn/api/assets/{id}/confirm \
--header 'X-Api-Key: <api-key>'import requests
url = "https://aitoearn.cn/api/assets/{id}/confirm"
headers = {"X-Api-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://aitoearn.cn/api/assets/{id}/confirm', 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://aitoearn.cn/api/assets/{id}/confirm"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"code": 0,
"message": "请求成功",
"data": {
"id": "string",
"userId": "string",
"userType": "user",
"path": "string",
"type": "aiImage",
"status": "pending",
"mimeType": "string",
"createdAt": "2026-07-02T12:00:00.000Z",
"updatedAt": "2026-07-02T12:00:00.000Z",
"url": "string",
"size": 1,
"filename": "string"
}
}
