Asset LibraryAsset Library API
Guide
Portrait Asset Authorization
Create a portrait QR code session and confirm that capture is complete
Portrait Asset Authorization
Portrait assets must be captured and authorized by the person themselves on a mobile phone; ordinary image uploads cannot replace this.
Create a Portrait QR Code Session
POST
/api/v1/materials/portrait/sessionsAuthentication
Authorization: Bearer <API_KEY>.
Request Body · application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
continuous_create | boolean | No | When true, continue creating the next authorization session after resolution completes |
Request Example
curl -X POST "$LOCOPAL_BASE_URL/api/v1/materials/portrait/sessions" \
-H "Authorization: Bearer $LOCOPAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"continuous_create":false}'Response Parameters
| Parameter | Type | Description |
|---|---|---|
code | integer | 0 on success |
msg | string | 真人授权会话已创建 on success |
data.session.authorization_url | string | Authorization page address; turn it into a QR code for the person to scan |
data.session.session_token | string | Session token; keep it on the server only |
data.session.expires_in | integer | Session validity period (seconds) |
data.session.expire_time | string | Session expiration time (ISO time string) |
Response Body
{
"code": 0,
"data": {
"session": {
"authorization_url": "https://授权页面地址",
"session_token": "session-token",
"expires_in": 600,
"expire_time": "2026-09-09T08:10:00.000Z"
}
},
"msg": "真人授权会话已创建"
}Do not write session_token to logs, send it to other accounts, or retain it long-term; create a new session after it expires.
Error Responses
| HTTP | msg | Description |
|---|---|---|
400 | 请求体必须是 JSON 对象 | The request body is not valid JSON |
401 | Invalid token | The API key is missing, wrong, or expired |
503 | 素材服务暂不可用 | The portrait capture channel is not ready; keep the request time and contact platform support |
Confirm Portrait Scan Completion
POST
/api/v1/materials/portrait/resolveAuthentication
Authorization: Bearer <API_KEY>.
Request Body · application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
session_token | string | Yes | The data.session.session_token returned when creating the QR code session |
Request Example
curl -X POST "$LOCOPAL_BASE_URL/api/v1/materials/portrait/resolve" \
-H "Authorization: Bearer $LOCOPAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"session_token":"session-token"}'Response Parameters
| Parameter | Type | Description |
|---|---|---|
code | integer | 0 on success |
msg | string | 真人授权已完成 on success |
data.group.id | string | ID of the portrait asset group generated by the capture |
data.group.name | string | Group name |
data.group.type | string | Fixed to real |
data.group.description | string / null | Group description |
Response Body
{
"code": 0,
"data": {
"group": {
"id": "group-20260911034940-lrtht",
"name": "真人素材库",
"type": "real",
"description": null
}
},
"msg": "真人授权已完成"
}After resolution succeeds, call Sync Asset Status and query the asset list to read the portrait asset's asset_id and status.
Error Responses
| HTTP | msg | Description |
|---|---|---|
400 | 请求体必须是 JSON 对象 | The request body is not valid JSON |
401 | Invalid token | The API key is missing, wrong, or expired |
503 | 素材服务暂不可用 | The session does not exist, capture has not been completed, or the portrait capture channel is not ready |
Was this page helpful?
