Blue Whale APIBlue Whale API
Material Library

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

FormEndpointBusiness errorsSession actions
Gateway (path)POST /api/material/{Action}{"ResponseMetadata":{},"ResponseError":{...}}Returned unwrapped
Ark-compatible (query)POST /?Action={Action}&Version=2024-01-01
alias: 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:

  • Action is required; missing or blank returns 400 InvalidParameter (Action is required).
  • Version is optional. When omitted the gateway forwards 2024-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/ark exists for deployments where a reverse proxy intercepts POST /.

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.

ActionModuleRequired body fieldsGateway ownership checkServed by
ListAssetGroupsGroups— (Filter.GroupType, PageNumber, PageSize optional)Yes — results are limited to groups owned by the current API keyGateway (local ownership table)
CreateAssetGroupGroupsName, GroupTypeNone (creates a new group)Upstream
GetAssetGroupGroupsIdYesUpstream
UpdateAssetGroupGroupsIdYesUpstream
DeleteAssetGroupGroupsIdYesUpstream
CreateAssetAssetsGroupId, URL, Name, AssetTypeYes, on GroupIdUpstream
ListAssetsAssetsFilter.GroupIds, Filter.GroupType, PageNumber, PageSizeYes, every id in Filter.GroupIdsUpstream
GetAssetAssetsIdYes, resolved through GetAsset.GroupIdUpstream
UpdateAssetAssetsIdYes, resolved through GetAsset.GroupIdUpstream
DeleteAssetAssetsIdYes, resolved through GetAsset.GroupIdUpstream
CreateVisualValidateSessionReal-personCallbackURLNone (callback is rewritten and restored)Upstream
GetVisualValidateResultReal-personBytedTokenYes — the session must belong to the current API keyUpstream

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:

Differences Between the Two Forms

AspectPath formArk-compatible query form
Action locationPath segmentQuery parameter (required)
VersionNot applicableOptional; default 2024-01-01; other values forwarded unchanged
ListAssetGroupsServed from the gateway ownership table, isolated per API keyServed from the gateway ownership table, isolated per API key
GetVisualValidateResultLocal session cache first, then upstreamAlways upstream, no cache
Gateway name validation (length, </>)Rejected with 400 InvalidParameterNot performed by the gateway; upstream validation only
Session responsesReturned unwrappedWrapped in ResponseMetadata + Result
ErrorsResponseMetadata + top-level ResponseErrorResponseMetadata.Error
Unknown ActionForwarded upstreamForwarded 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 * PageNumber exceeds 20,000.

Authentication

Same as the rest of the platform — Bearer authentication with an API key:

Authorization: Bearer sk-YOUR-KEY

Authentication failures (missing/invalid/disabled key) return 401 with an OpenAI-compatible error (type: new_api_error), not this module's ResponseError envelope — see Authentication.

Base URL

RegionBase URL
Domestichttps://yunjizi.cn
Overseashttps://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 a ResponseMetadata object.

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 / Message under ResponseMetadata.Error instead (with RequestId alongside).

HTTPCodeDescription
400InvalidParameterInvalid request parameter (e.g. empty GroupIds or missing Filter.GroupType in ListAssets, name containing </> or too long)
404NotFoundResource 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
500InternalErrorUpstream 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, and DeleteAsset all verify that the target belongs to the current API key; unauthorized access returns 404 NotFound (not distinguishing missing vs. unauthorized, to avoid probing).
  • GetAsset / UpdateAsset / DeleteAsset resolve ownership by calling upstream GetAsset and checking the returned GroupId; if upstream fails or returns no GroupId, the request is rejected.
  • GetVisualValidateResult only returns a GroupId for sessions created by the same API key; unknown or other-key tokens return an empty GroupId without querying upstream.
  • The Ark-compatible entry uses the same isolation rules as the path entry.
  • ListAssetGroups on 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 as asset://group-xxx