Blue Whale APIBlue Whale API
Material Library

Real-Person Verification

H5 liveness verification loop for real-person (LivenessFace) materials (CreateVisualValidateSession / GetVisualValidateResult)

Real-person materials (LivenessFace) require an H5 liveness verification loop: first create a verification session to obtain H5Link and BytedToken, have the verifier open the link and complete liveness verification, then query the result with BytedToken. Session endpoints return the direct format (no ResponseMetadata/Result envelope).

Ark-compatible entry: the same Actions also work as POST /?Action={Action}&Version=2024-01-01 (alias /api/ark). There, session responses are wrapped into ResponseMetadata + Result instead of the direct format. The query form also has no local result cache — GetVisualValidateResult always queries upstream, while the path form can return a result already settled in the gateway's local session record. See Ark-compatible examples below and Differences Between the Two Forms.

CreateVisualValidateSession — Create a Verification Session

Request

FieldTypeRequiredDescription
NamestringNoGroup name, used as the ownership group name after verification
CallbackURLstringYesClient callback URL (the gateway 302-redirects to it after verification); missing → 400 MissingParameter.CallbackURL
ProjectNamestringNoProject name
BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/api/material/CreateVisualValidateSession" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{"Name":"My real-person group","CallbackURL":"https://example.com/cb","ProjectName":"default"}'

Response

Direct format (no envelope):

{ "BytedToken": "bt-xxx", "H5Link": "https://h5.example.com/verify", "CallbackURL": "https://example.com/cb" }

BytedToken is the session identifier (used to query the verification result), and H5Link is opened by the verifier to complete liveness verification. Once verification completes, the gateway 302-redirects to the CallbackURL with the verification result, and the CallbackURL in the response is the value you passed in.

GetVisualValidateResult — Query the Verification Result

Request

FieldTypeRequiredDescription
BytedTokenstringYesThe BytedToken returned when creating the session
BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

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

Response

Direct format (no envelope):

{ "GroupId": "group-xxx" }

Note: after verification completes, the real-person group id group-xxx is returned:

  • Token not found / not owned by you → 200 + {"GroupId":""} (local fail-closed, no upstream call, no leakage)
  • Session exists but verification incomplete → the gateway queries upstream once: 200 + {"GroupId":""} when queryable (keep polling); 502 right after creation if not yet queryable (retry shortly)
  • Verification complete → 200 + {"GroupId":"group-xxx"}

The real-person group id group-xxx returned after verification can be referenced in video generation via asset://group-xxx (see Material Library Overview).

Ark-Compatible Examples

The same Actions work through the query form. Unlike the path form, success responses are wrapped:

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

# CreateVisualValidateSession
curl -X POST "$BASE_URL/?Action=CreateVisualValidateSession&Version=2024-01-01" \
  -H "Authorization: Bearer sk-YOUR-KEY" -H "Content-Type: application/json" \
  -d '{"Name":"My real-person group","CallbackURL":"https://example.com/cb","ProjectName":"default"}'

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

Response through the query form:

{
  "ResponseMetadata": { "RequestId": "req_xxx", "Action": "GetVisualValidateResult", "Version": "2024-01-01", "Service": "ark", "Region": "cn-beijing" },
  "Result": { "GroupId": "group-xxx" }
}

GroupId is empty until verification completes; poll until it is populated. Because the query form has no local result cache, it reads upstream on every call; the path form can return a result already settled locally without calling upstream. The gateway still substitutes its own callback URL upstream and restores your CallbackURL in the response.