Skip to main content
LocoPal AiLocoPal Ai
Asset LibraryAsset Library API

Guide

Asset Groups

API documentation for creating and querying asset groups

View Markdown

Asset Groups

An asset group is a container for assets. Before submitting images, you need a virtual asset group.

Create an Asset Group

POST/api/v1/materials/groups

Authentication

Authorization: Bearer <API_KEY>, using a platform API key created under "API Keys" in the console.

Request Body · application/json

Prop

Type

Within the same account, a group with the same name and type is not created again; repeated calls return the existing group directly.

Request Example

curl -X POST "$LOCOPAL_BASE_URL/api/v1/materials/groups" \
  -H "Authorization: Bearer $LOCOPAL_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "name": "品牌虚拟角色",
  "description": "电商视频人物设定图",
  "type": "virtual"
}
JSON

To create a portrait group, use the same API and just change type to real:

curl -X POST "$LOCOPAL_BASE_URL/api/v1/materials/groups" \
  -H "Authorization: Bearer $LOCOPAL_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "name": "真人素材库",
  "description": "已完成授权的真人素材",
  "type": "real"
}
JSON

Response Parameters

ParameterTypeDescription
codeinteger0 on success
msgstring素材分组已创建 on success
data.group.idstringThe group ID used by the current account; used as group_id when submitting assets later
data.group.platform_group_idstringThe platform group ID in the asset service, used for troubleshooting; in the current deployment it is usually the same as id
data.group.namestringGroup name
data.group.typestringvirtual or real
data.group.descriptionstring / nullGroup description, null when not provided
data.group.created_atintegerCreation time (Unix seconds)
data.group.updated_atintegerUpdate time (Unix seconds)

Response Body

{
  "code": 0,
  "data": {
    "group": {
      "id": "group-1789069780-5762d1",
      "platform_group_id": "group-1789069780-5762d1",
      "name": "品牌虚拟角色",
      "type": "virtual",
      "description": "电商视频人物设定图",
      "created_at": 1789069780,
      "updated_at": 1789069780
    }
  },
  "msg": "素材分组已创建"
}

Error Responses

HTTPmsgDescription
400请求体必须是 JSON 对象The request body is not valid JSON
400type 只能是 virtual 或 realInvalid type value
400素材分组名称不能为空name is missing
400素材分组名称不能超过 64 个字符name is too long
400素材分组说明不能超过 300 个字符description is too long
401Invalid tokenThe API key is missing, wrong, or expired
502 / 503素材服务暂不可用The asset service is abnormal; keep the request information and retry

Query Asset Groups

GET/api/v1/materials/groups

Authentication

Authorization: Bearer <API_KEY>. GET requests must also include it.

Request Parameters · query

ParameterTypeRequiredDefaultDescription
pageintegerNo1Page number; values less than 1 are treated as 1
page_sizeintegerNo20Items per page, maximum 100; out-of-range values are treated as 20

Request Example

curl "$LOCOPAL_BASE_URL/api/v1/materials/groups?page=1&page_size=20" \
  -H "Authorization: Bearer $LOCOPAL_API_KEY"

Response Parameters

ParameterTypeDescription
codeinteger0 on success
msgstringOK on success
data.totalintegerTotal number of groups in the current account
data.pageintegerCurrent page number
data.page_sizeintegerItems per page for this request
data.groupsarrayGroup list; fields are the same as the create API; contains only the current account's own groups

Response Body

{
  "code": 0,
  "data": {
    "groups": [
      {
        "id": "group-1789069780-5762d1",
        "platform_group_id": "group-1789069780-5762d1",
        "name": "品牌虚拟角色",
        "type": "virtual",
        "description": "电商视频人物设定图",
        "created_at": 1789069780,
        "updated_at": 1789069780
      }
    ],
    "total": 1,
    "page": 1,
    "page_size": 20
  },
  "msg": "OK"
}

Error Responses

HTTPmsgDescription
401Invalid tokenThe API key is missing, wrong, or expired
500 / 502 / 503素材服务暂不可用The asset service is abnormal; keep the request information and retry
Was this page helpful?

On this page