Skip to content

Person verification ​

For person verification, follow: server creates a session → user completes H5 → server queries GroupId → manage materials. Ordinary video generation can start directly with quick start.

Request conventions

Use https://api.tokenlio.ai, Authorization: Bearer $TOKENLIO_API_KEY and a JSON body. Verification Actions use POST and PascalCase fields. Version is optional, default 2024-01-01. See request conventions.

1. Create a session ​

Call CreateVisualValidateSession. Required CallbackURL accepts up to8192 characters. Optional ProjectName is1–128 characters and defaults to default. Set a stable TOKENLIO_VISUAL_KEY for this new session; retain the original key/body when recovering an uncertain outcome.

bash
curl -sS --fail-with-body "https://api.tokenlio.ai/?Action=CreateVisualValidateSession&Version=2024-01-01" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${TOKENLIO_VISUAL_KEY:?Set a stable session key}" \
  --data '{
    "CallbackURL": "https://customer.example/verify-return?state=RANDOM_STATE",
    "ProjectName": "default"
  }'

Example successful Result:

json
{
  "BytedToken": "OPAQUE_TOKEN",
  "H5Link": "https://example.com/verify?token=OPAQUE_TOKEN",
  "CallbackURL": "https://customer.example/verify-return?state=RANDOM_STATE"
}

On your server, associate BytedToken with this user and state. Keep the token opaque: do not modify it, log it or store it in public environment files. Give the user H5Link unchanged.

2. Complete H5 and return in the browser ​

The user opens H5Link in a browser and completes verification. Do not attach platform Authorization or replace this step with an HTTP client inheriting API authentication.

Set CallbackURL to a browser return page you control. Generate, store and validate random state in your application, matching the return to the user and this BytedToken. Never put the platform Key in the URL.

The H5 return may append resultCode; 10000 indicates verification passed. Use it for UI feedback, then query the result on your server before using GroupId. A page-loading failure does not prove H5 failure, and a successful redirect alone is not authorization proof.

CallbackURL is a browser return. Video-generation server notifications use callback_url. For manual testing, use an accessible HTTPS page you control, complete H5 and then query the result.

3. Query the verified group ​

After the user completes H5, call GetVisualValidateResult with the original platform Key, ProjectName and BytedToken. The opaque token accepts up to4096 characters.

bash
curl -sS --fail-with-body "https://api.tokenlio.ai/?Action=GetVisualValidateResult&Version=2024-01-01" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "BytedToken": "OPAQUE_TOKEN",
    "ProjectName": "default"
  }'

Successful Result:

json
{
  "GroupId": "GROUP_ID"
}

Check HTTP, ResponseMetadata.Error and Result.Error. If verification is incomplete or returns an error, do not infer GroupId from an empty response or automatically create another session. Follow errors and recovery.

4. Use the verified material group ​

Use GroupId as CreateAsset's parent group. GetAssetGroup takes Id in its body. List verified groups with Filter.GroupType=LivenessFace:

bash
curl -sS --fail-with-body "https://api.tokenlio.ai/api/v3/assets?Action=ListAssetGroups" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "ProjectName": "default",
    "Filter": {
      "GroupType": "LivenessFace"
    },
    "PageNumber": 1,
    "PageSize": 10
  }'

Follow material management to create and query assets, then use asset://ASSET_ID in video generation when ready. Ordinary CreateAssetGroup does not establish completed person verification.

Next steps ​

Official references ​

Access leading AI models through one unified API