Material Library Overview
Material library API — CRUD for virtual/real-person materials plus real-person verification
The material library API provides create/read/update/delete for virtual (AIGC) asset groups and assets plus real-person (LivenessFace) verification, through two entry points: the gateway path form and the Volcengine Ark-compatible query form. Once created, materials can be referenced in video generation via asset://<asset-id>.
Endpoints
| Form | Endpoint | Business errors | Session actions |
|---|---|---|---|
| Gateway (path) | POST /api/material/{Action} | {"ResponseMetadata":{},"ResponseError":{...}} | Returned unwrapped |
| Ark-compatible (query) | POST /?Action={Action}&Version=2024-01-01alias: POST /api/ark?Action={Action}&Version=2024-01-01 | {"ResponseMetadata":{"Error":{...},"RequestId":"..."}} | Wrapped in ResponseMetadata + Result |
Request bodies use the same schemas on both forms, but the two are not drop-in equivalents — see Differences Between the Two Forms.
Query-form request rules:
Actionis required; missing or blank returns400 InvalidParameter(Action is required).Versionis optional. When omitted the gateway forwards2024-01-01; any other value is forwarded upstream unchanged — the gateway does not validate it.- Any additional query parameters are forwarded upstream as-is, except for
ListAssetGroups, which is answered locally from the gateway ownership table. - The alias
/api/arkexists for deployments where a reverse proxy interceptsPOST /.
Action values fall into three groups — see Asset Groups, Assets, and Real-Person Verification.
Ark-Compatible Action Reference
All 12 Actions below are reachable through the query form. "Gateway ownership check" means the gateway verifies that the resource belongs to the API key that authenticated the request; failures return 404 NotFound without revealing whether the resource exists.
| Action | Module | Required body fields | Gateway ownership check | Served by |
|---|---|---|---|---|
ListAssetGroups | Groups | — (Filter.GroupType, PageNumber, PageSize optional) | Yes — results are limited to groups owned by the current API key | Gateway (local ownership table) |
CreateAssetGroup | Groups | Name, GroupType | None (creates a new group) | Upstream |
GetAssetGroup | Groups | Id | Yes | Upstream |
UpdateAssetGroup | Groups | Id | Yes | Upstream |
DeleteAssetGroup | Groups | Id | Yes | Upstream |
CreateAsset | Assets | GroupId, URL, Name, AssetType | Yes, on GroupId | Upstream |
ListAssets | Assets | Filter.GroupIds, Filter.GroupType, PageNumber, PageSize | Yes, every id in Filter.GroupIds | Upstream |
GetAsset | Assets | Id | Yes, resolved through GetAsset.GroupId | Upstream |
UpdateAsset | Assets | Id | Yes, resolved through GetAsset.GroupId | Upstream |
DeleteAsset | Assets | Id | Yes, resolved through GetAsset.GroupId | Upstream |
CreateVisualValidateSession | Real-person | CallbackURL | None (callback is rewritten and restored) | Upstream |
GetVisualValidateResult | Real-person | BytedToken | Yes — the session must belong to the current API key | Upstream |
Unknown Actions are forwarded upstream unchanged and the upstream result is returned as-is; the gateway does not validate or rewrite the error code. Id / GroupId must be JSON strings; a non-string value is rejected by the gateway with 400 InvalidParameter before any ownership check.
Request/response examples for the query form are shown on each module page:
- Asset Groups — Ark-compatible examples
- Assets — Ark-compatible examples
- Real-Person Verification — Ark-compatible examples
Differences Between the Two Forms
| Aspect | Path form | Ark-compatible query form |
|---|---|---|
Action location | Path segment | Query parameter (required) |
Version | Not applicable | Optional; default 2024-01-01; other values forwarded unchanged |
ListAssetGroups | Served from the gateway ownership table, isolated per API key | Served from the gateway ownership table, isolated per API key |
GetVisualValidateResult | Local session cache first, then upstream | Always upstream, no cache |
Gateway name validation (length, </>) | Rejected with 400 InvalidParameter | Not performed by the gateway; upstream validation only |
| Session responses | Returned unwrapped | Wrapped in ResponseMetadata + Result |
| Errors | ResponseMetadata + top-level ResponseError | ResponseMetadata.Error |
| Unknown Action | Forwarded upstream | Forwarded upstream |
Pagination Limits
- Only page-number pagination (
PageNumber/PageSize) is available; cursor pagination (NextToken/MaxResults) is not supported by upstream. - Deep pagination is unavailable upstream once
PageSize * PageNumberexceeds 20,000.
Authentication
Same as the rest of the platform — Bearer authentication with an API key:
Authorization: Bearer sk-YOUR-KEYAuthentication failures (missing/invalid/disabled key) return
401with an OpenAI-compatible error (type: new_api_error), not this module'sResponseErrorenvelope — see Authentication.
Base URL
| Region | Base URL |
|---|---|
| Domestic | https://yunjizi.cn |
| Overseas | https://api.yunjizi.cn |
Response Formats
Two formats (unified to the gateway's actual response shape):
CRUD envelope (path form, and success responses of the query form):
{
"ResponseMetadata": { "RequestId": "req_xxx", "Action": "ListAssets", "Version": "2024-01-01", "Service": "ark", "Region": "cn-beijing" },
"Result": { }
}Session direct format (path form only — CreateVisualValidateSession / GetVisualValidateResult):
{ "BytedToken": "bt-xxx", "H5Link": "https://.../verify", "CallbackURL": "https://example.com/cb" }On the Ark-compatible query form, session responses are wrapped instead: the same fields appear under
Result, next to aResponseMetadataobject.
Error Codes
Business-layer errors (returned by the gateway or normalized from upstream) use:
{
"ResponseMetadata": {},
"ResponseError": { "Code": "InvalidParameter", "Message": "invalid parameter" }
}The Ark-compatible query form returns the same
Code/MessageunderResponseMetadata.Errorinstead (withRequestIdalongside).
| HTTP | Code | Description |
|---|---|---|
| 400 | InvalidParameter | Invalid request parameter (e.g. empty GroupIds or missing Filter.GroupType in ListAssets, name containing </> or too long) |
| 404 | NotFound | Resource not found or not owned by the current API key (ownership check, returned by the gateway) |
| 404 | — | Unknown Action; the error code is returned by upstream and is not rewritten by the gateway |
| 500 | InternalError | Upstream internal error |
| 502 | — | The gateway failed to query upstream (e.g. a just-created real-person verification session not yet queryable); retry shortly |
| 401 | — | Authentication failures use the OpenAI-style error (see "Authentication"), not listed here |
Ownership Isolation
Materials are isolated by the account owning the API key:
- Group operations (
GetAssetGroup/UpdateAssetGroup/DeleteAssetGroup),ListAssetGroups,ListAssets,CreateAsset,GetAsset,UpdateAsset, andDeleteAssetall verify that the target belongs to the current API key; unauthorized access returns404 NotFound(not distinguishing missing vs. unauthorized, to avoid probing). GetAsset/UpdateAsset/DeleteAssetresolve ownership by calling upstreamGetAssetand checking the returnedGroupId; if upstream fails or returns noGroupId, the request is rejected.GetVisualValidateResultonly returns aGroupIdfor sessions created by the same API key; unknown or other-key tokens return an emptyGroupIdwithout querying upstream.- The Ark-compatible entry uses the same isolation rules as the path entry.
ListAssetGroupson either entry is read from the gateway ownership table and is tenant-isolated; see Differences Between the Two Forms.
Referencing Materials
Once created, materials / real-person groups can be referenced in video generation via asset://<asset-id>:
- Virtual asset:
asset://Asset-xxx - Real-person material: the returned group id
group-xxx, referenced asasset://group-xxx