Skip to main content
LocoPal AiLocoPal Ai
Asset LibraryAsset Library API

Guide

Portrait Asset Authorization

Create a portrait QR code session and confirm that capture is complete

View Markdown

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/sessions

Authentication

Authorization: Bearer <API_KEY>.

Request Body · application/json

ParameterTypeRequiredDescription
continuous_createbooleanNoWhen 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

ParameterTypeDescription
codeinteger0 on success
msgstring真人授权会话已创建 on success
data.session.authorization_urlstringAuthorization page address; turn it into a QR code for the person to scan
data.session.session_tokenstringSession token; keep it on the server only
data.session.expires_inintegerSession validity period (seconds)
data.session.expire_timestringSession 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

HTTPmsgDescription
400请求体必须是 JSON 对象The request body is not valid JSON
401Invalid tokenThe 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/resolve

Authentication

Authorization: Bearer <API_KEY>.

Request Body · application/json

ParameterTypeRequiredDescription
session_tokenstringYesThe 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

ParameterTypeDescription
codeinteger0 on success
msgstring真人授权已完成 on success
data.group.idstringID of the portrait asset group generated by the capture
data.group.namestringGroup name
data.group.typestringFixed to real
data.group.descriptionstring / nullGroup 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

HTTPmsgDescription
400请求体必须是 JSON 对象The request body is not valid JSON
401Invalid tokenThe 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?

On this page