Blue Whale APIBlue Whale API
Material Library

Assets

Upload, list, query, update, and delete assets (CreateAsset / ListAssets / GetAsset / UpdateAsset / DeleteAsset)

An asset is a concrete file (image/video/audio) attached to an asset group. Create a group first (see Asset Groups). All five Actions below use the CRUD envelope response format. Asset status enum: Active (ready), Processing (in progress), Failed (failed).

CreateAsset — Upload Asset

Uploads an asset into a group (by URL, registered asynchronously).

Request

FieldTypeRequiredDescription
GroupIdstringYesTarget asset group id (must be owned by the current API key, otherwise 404)
URLstringYesPublicly accessible URL of the asset
NamestringYesAsset name (≤255 chars, no </>, otherwise 400)
AssetTypestringYesImage / Video / Audio
BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/api/material/CreateAsset" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{"GroupId":"group-xxx","URL":"https://example.com/image.jpg","Name":"Asset 1","AssetType":"Image"}'

Response

{
  "ResponseMetadata": { "RequestId": "req_xxx", "Action": "CreateAsset", "Version": "2024-01-01", "Service": "ark", "Region": "cn-beijing" },
  "Result": { "Id": "Asset-xxx" }
}

Registration is asynchronous; check the status via ListAssets or GetAsset.

Ark-Compatible Endpoint

When migrating code written for the Ark management plane, upload with Action in the query string instead of the path:

BASE_URL="https://api.yunjizi.cn"

curl -X POST "$BASE_URL/?Action=CreateAsset&Version=2024-01-01" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{"GroupId":"group-xxx","URL":"https://example.com/image.jpg","Name":"Asset 1","AssetType":"Image"}'

# Alias for deployments where the root path is intercepted by a reverse proxy:
# POST "$BASE_URL/api/ark?Action=CreateAsset&Version=2024-01-01"
  • Request body, ownership checks and Result.Id are identical to /api/material/CreateAsset.
  • Version is optional: when omitted the gateway forwards 2024-01-01; any other value is forwarded as-is.
  • Errors use the Ark envelope instead of a top-level error object: {"ResponseMetadata":{"Error":{"Code":"...","Message":"..."},"RequestId":"..."}}.
  • The query-string form works for every Action in the material library. See Ark-compatible examples below and Differences Between the Two Forms.

ListAssets — List Assets

Lists assets by asset group. Both Filter.GroupIds and Filter.GroupType are required — when empty/missing the gateway returns 400 InvalidParameter, preventing unauthorized listing of all assets under the shared account.

Request

FieldTypeRequiredDescription
Filter.GroupIds[]stringYesAsset group id list (must all be owned by the current API key, otherwise 404)
Filter.GroupTypestringYesGroup type filter (currently AIGC / LivenessFace)
Filter.Statuses[]stringNoActive / Processing / Failed
Filter.NamestringNoFuzzy name match
PageNumberintYesPage number (missing → 400 MissingParameter.PageNumber)
PageSizeintYesPage size (default 20, range 1–100; required together with PageNumber)
BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/api/material/ListAssets" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{"Filter":{"GroupIds":["group-xxx"],"GroupType":"AIGC"},"PageNumber":1,"PageSize":10}'

Response

{
  "ResponseMetadata": { "RequestId": "req_xxx", "Action": "ListAssets", "Version": "2024-01-01", "Service": "ark", "Region": "cn-beijing" },
  "Result": {
    "TotalCount": 1,
    "Items": [
      { "Id": "Asset-xxx", "Name": "Asset 1", "URL": "https://example.com/image.jpg", "GroupId": "group-xxx", "AssetType": "Image", "Status": "Active", "CreateTime": "2026-08-19T02:10:00Z", "UpdateTime": "2026-08-19T02:10:00Z" }
    ],
    "PageNumber": 1,
    "PageSize": 10
  }
}

GetAsset — Get Asset Details

Queries the full information of an asset by Id (including Status, URL, Error).

Request

FieldTypeRequiredDescription
IdstringYesAsset id (Asset-...)
BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/api/material/GetAsset" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{"Id":"Asset-xxx"}'

Response

{
  "ResponseMetadata": { "RequestId": "req_xxx", "Action": "GetAsset", "Version": "2024-01-01", "Service": "ark", "Region": "cn-beijing" },
  "Result": { "Id": "Asset-xxx", "Name": "Asset 1", "URL": "https://example.com/image.jpg", "GroupId": "group-xxx", "AssetType": "Image", "Status": "Active", "Error": null }
}

UpdateAsset — Update Asset

Renames an asset by Id.

Request

FieldTypeRequiredDescription
IdstringYesAsset id
NamestringNoNew name (≤255 chars, no </>, otherwise 400)
BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/api/material/UpdateAsset" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{"Id":"Asset-xxx","Name":"New name"}'

Response

{
  "ResponseMetadata": { "RequestId": "req_xxx", "Action": "UpdateAsset", "Version": "2024-01-01", "Service": "ark", "Region": "cn-beijing" },
  "Result": {}
}

DeleteAsset — Delete Asset

Deletes a single asset by Id.

Request

FieldTypeRequiredDescription
IdstringYesAsset id
BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/api/material/DeleteAsset" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{"Id":"Asset-xxx"}'

Response

{
  "ResponseMetadata": { "RequestId": "req_xxx", "Action": "DeleteAsset", "Version": "2024-01-01", "Service": "ark", "Region": "cn-beijing" },
  "Result": {}
}

Ownership note: GetAsset / UpdateAsset / DeleteAsset resolve ownership by calling upstream GetAsset and checking the returned GroupId against the current API key; if upstream fails or returns no GroupId, the request is rejected with 404 NotFound. The Ark-compatible entry applies the same check. Assets in groups not registered to the current API key (for example, groups created outside the gateway) are treated as not found.

Ark-Compatible Examples

Every Action on this page also accepts Action in the query string. Request bodies are unchanged; the success Result is the same object shown above, wrapped in ResponseMetadata:

BASE_URL="https://api.yunjizi.cn"

# CreateAsset
curl -X POST "$BASE_URL/?Action=CreateAsset&Version=2024-01-01" \
  -H "Authorization: Bearer sk-YOUR-KEY" -H "Content-Type: application/json" \
  -d '{"GroupId":"group-xxx","URL":"https://example.com/image.jpg","Name":"Asset 1","AssetType":"Image"}'

# ListAssets — Filter.GroupIds is required and must be non-empty
curl -X POST "$BASE_URL/?Action=ListAssets&Version=2024-01-01" \
  -H "Authorization: Bearer sk-YOUR-KEY" -H "Content-Type: application/json" \
  -d '{"Filter":{"GroupIds":["group-xxx"],"GroupType":"AIGC"},"PageNumber":1,"PageSize":10}'

# GetAsset
curl -X POST "$BASE_URL/?Action=GetAsset&Version=2024-01-01" \
  -H "Authorization: Bearer sk-YOUR-KEY" -H "Content-Type: application/json" \
  -d '{"Id":"Asset-xxx"}'

# UpdateAsset — ownership resolved through GetAsset.GroupId
curl -X POST "$BASE_URL/?Action=UpdateAsset&Version=2024-01-01" \
  -H "Authorization: Bearer sk-YOUR-KEY" -H "Content-Type: application/json" \
  -d '{"Id":"Asset-xxx","Name":"New name"}'

# DeleteAsset — ownership resolved through GetAsset.GroupId
curl -X POST "$BASE_URL/?Action=DeleteAsset&Version=2024-01-01" \
  -H "Authorization: Bearer sk-YOUR-KEY" -H "Content-Type: application/json" \
  -d '{"Id":"Asset-xxx"}'

Empty Filter.GroupIds returns 400 InvalidParameter (Filter.GroupIds is required) before any upstream call. Errors use ResponseMetadata.Error; the /api/ark alias accepts the same query string when POST / is intercepted.