Asset items
Create, get, list, update and delete image, video and audio assets.
Status
| Status | Meaning |
|---|---|
Pending | Queue state returned by some services (); not usable |
Processing | Service is downloading, transcoding or moderating |
Active | Ready; can be referenced as asset://<ID> |
Failed | Processing failed; inspect Error.Code and Error.Message |
Poll until Active before using an asset.
CreateAsset
curl -X POST 'https://ai.tuiwo.vip/ai?Action=CreateAsset&Version=2024-01-01' \
-H 'Authorization: Bearer $TUIWO_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"GroupId": "GROUP_ID",
"AssetType": "Image",
"URL": "https://example.com/product.png",
"Name": "Product image"
}'| Field | Type | Required | Description |
|---|---|---|---|
GroupId | string | yes | Asset group ID |
AssetType | string | yes | Image, Video or Audio |
URL | string | yes | Publicly reachable asset URL |
Name | string | yes | Asset name |
ProjectName | string | no | Defaults to default |
Response Result.Id. The URL must be downloadable by the service. The platform does not store the file and does not convert Base64 into a URL.
GetAsset
curl -X POST 'https://ai.tuiwo.vip/ai?Action=GetAsset&Version=2024-01-01' \
-H 'Authorization: Bearer $TUIWO_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"Id":"ASSET_ID"}'| Field | Type | Required | Description |
|---|---|---|---|
Id | string | yes | Asset ID |
ProjectName | string | no | Defaults to default |
Result fields: Id, Name, URL, AssetType, Status, GroupId, ProjectName, CreateTime, UpdateTime, LastInferenceTime, Error (Code, Message), Moderation.
ListAssets
curl -X POST 'https://ai.tuiwo.vip/ai?Action=ListAssets&Version=2024-01-01' \
-H 'Authorization: Bearer $TUIWO_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"Filter":{"GroupIds":["GROUP_ID"],"Statuses":["Active"]},"PageNumber":1,"PageSize":20}'| Field | Type | Description |
|---|---|---|
Filter.GroupType | string | Filter by group type |
Filter.GroupIds | string[] | Filter by group IDs |
Filter.Name | string | Filter by name |
Filter.Statuses | string[] | Pending, Processing, Active or Failed; filtering is service-defined, so check each Status |
NextToken | string | Cursor token |
MaxResults | integer | 1-100 |
SortBy | string | For example CreateTime or UpdateTime |
SortOrder | string | Desc or Asc |
PageNumber | integer | Page number |
PageSize | integer | Page size; platform currently caps around 50 |
Result contains Items with the same fields as GetAsset.Result, plus NextToken, PageNumber, PageSize, and TotalCount. Iterate pages; do not assume the first page has every asset.
UpdateAsset
curl -X POST 'https://ai.tuiwo.vip/ai?Action=UpdateAsset&Version=2024-01-01' \
-H 'Authorization: Bearer $TUIWO_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"Id":"ASSET_ID","Name":"New name"}'| Field | Type | Required | Description |
|---|---|---|---|
Id | string | yes | Asset ID |
Name | string | no | New name |
ProjectName | string | no | Defaults to default |
DeleteAsset
curl -X POST 'https://ai.tuiwo.vip/ai?Action=DeleteAsset&Version=2024-01-01' \
-H 'Authorization: Bearer $TUIWO_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"Id":"ASSET_ID"}'Deletion is irreversible; the asset can no longer be used for generation.
Common failure causes
| Error | Meaning |
|---|---|
DownloadFailed | Service cannot download the URL |
ContentRestricted | Moderation failed |
TypeMismatch | AssetType does not match the content |
FormatUnsupported / FormatUndetectable | Unsupported or undetectable format |
FaceMismatch | Real-person asset does not match the verified person |
DurationTooShort / DurationTooLong | Audio or video duration is out of range |
FileSizeTooLarge | File is too large |
InternalError | Service internal error |
Reference in a video request
Once Active:
{
"type": "image_url",
"image_url": {"url": "asset://ASSET_ID"},
"role": "reference_image"
}Use video_url / audio_url with the corresponding role for video and audio. asset:// assets must belong to the current workspace.