Tạo nhóm tài nguyên vật liệu Seedance
curl --request POST \
--url https://api.tokenlab.sh/v1/videos/assets/groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"library_type": "aigc_avatar",
"group_name": "Product references",
"description": "Ảnh sản phẩm có thể tái sử dụng"
}
'import requests
url = "https://api.tokenlab.sh/v1/videos/assets/groups"
payload = {
"library_type": "aigc_avatar",
"group_name": "Product references",
"description": "Ảnh sản phẩm có thể tái sử dụng"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
library_type: 'aigc_avatar',
group_name: 'Product references',
description: 'Ảnh sản phẩm có thể tái sử dụng'
})
};
fetch('https://api.tokenlab.sh/v1/videos/assets/groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tokenlab.sh/v1/videos/assets/groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'library_type' => 'aigc_avatar',
'group_name' => 'Product references',
'description' => 'Ảnh sản phẩm có thể tái sử dụng'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tokenlab.sh/v1/videos/assets/groups"
payload := strings.NewReader("{\n \"library_type\": \"aigc_avatar\",\n \"group_name\": \"Product references\",\n \"description\": \"Ảnh sản phẩm có thể tái sử dụng\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tokenlab.sh/v1/videos/assets/groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"library_type\": \"aigc_avatar\",\n \"group_name\": \"Product references\",\n \"description\": \"Ảnh sản phẩm có thể tái sử dụng\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tokenlab.sh/v1/videos/assets/groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"library_type\": \"aigc_avatar\",\n \"group_name\": \"Product references\",\n \"description\": \"Ảnh sản phẩm có thể tái sử dụng\"\n}"
response = http.request(request)
puts response.read_body{
"id": "group-20260720123456-vrt01",
"object": "seedance.material_asset_group",
"library_type": "aigc_avatar",
"group_name": "Product references",
"description": "Ảnh sản phẩm có thể tái sử dụng",
"status": "ACTIVE",
"metadata": null,
"created_at": 1782998400000
}{
"error": {
"message": "model: Model is required",
"type": "invalid_request_error",
"param": "model"
},
"validation_errors": [
{
"field": "model",
"message": "Model is required"
}
]
}{
"error": {
"message": "Invalid API key provided",
"type": "invalid_api_key"
}
}{
"error": {
"message": "<string>",
"type": "unauthorized",
"code": "<string>",
"param": "<string>",
"model": "<string>",
"did_you_mean": "<string>",
"suggestions": [
{
"id": "<string>"
}
],
"alternatives": [
{
"id": "<string>",
"status": "<string>",
"tags": [
"<string>"
]
}
],
"hint": "<string>",
"retry_after": 123,
"retryable": true,
"balance_usd": 123,
"estimated_cost_usd": 123,
"supported_operations": [
"<string>"
],
"supported_parameters": [
"<string>"
],
"required_selectors": [
"<string>"
],
"optional_selectors": [
"<string>"
],
"allowed_resolutions": [
"<string>"
],
"allowed_durations": [
"<string>"
],
"allowed_aspect_ratios": [
"<string>"
],
"prompt_max_characters": 123,
"recommended_request": {},
"request_endpoint": "<string>",
"request_shape_mode": "<string>",
"status_mode": "<string>",
"request_id": "<string>"
}
}{
"error": {
"message": "An internal error occurred",
"type": "server_error"
}
}{
"error": {
"message": "Seedance material library request failed",
"type": "server_error",
"code": "seedance_material_library_request_failed"
}
}Video & tư liệu
Tạo Nhóm Tài Nguyên Vật Liệu
Tạo một nhóm vật liệu avatar ảo Seedance.
POST
/
v1
/
videos
/
assets
/
groups
Tạo nhóm tài nguyên vật liệu Seedance
curl --request POST \
--url https://api.tokenlab.sh/v1/videos/assets/groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"library_type": "aigc_avatar",
"group_name": "Product references",
"description": "Ảnh sản phẩm có thể tái sử dụng"
}
'import requests
url = "https://api.tokenlab.sh/v1/videos/assets/groups"
payload = {
"library_type": "aigc_avatar",
"group_name": "Product references",
"description": "Ảnh sản phẩm có thể tái sử dụng"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
library_type: 'aigc_avatar',
group_name: 'Product references',
description: 'Ảnh sản phẩm có thể tái sử dụng'
})
};
fetch('https://api.tokenlab.sh/v1/videos/assets/groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tokenlab.sh/v1/videos/assets/groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'library_type' => 'aigc_avatar',
'group_name' => 'Product references',
'description' => 'Ảnh sản phẩm có thể tái sử dụng'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tokenlab.sh/v1/videos/assets/groups"
payload := strings.NewReader("{\n \"library_type\": \"aigc_avatar\",\n \"group_name\": \"Product references\",\n \"description\": \"Ảnh sản phẩm có thể tái sử dụng\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tokenlab.sh/v1/videos/assets/groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"library_type\": \"aigc_avatar\",\n \"group_name\": \"Product references\",\n \"description\": \"Ảnh sản phẩm có thể tái sử dụng\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tokenlab.sh/v1/videos/assets/groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"library_type\": \"aigc_avatar\",\n \"group_name\": \"Product references\",\n \"description\": \"Ảnh sản phẩm có thể tái sử dụng\"\n}"
response = http.request(request)
puts response.read_body{
"id": "group-20260720123456-vrt01",
"object": "seedance.material_asset_group",
"library_type": "aigc_avatar",
"group_name": "Product references",
"description": "Ảnh sản phẩm có thể tái sử dụng",
"status": "ACTIVE",
"metadata": null,
"created_at": 1782998400000
}{
"error": {
"message": "model: Model is required",
"type": "invalid_request_error",
"param": "model"
},
"validation_errors": [
{
"field": "model",
"message": "Model is required"
}
]
}{
"error": {
"message": "Invalid API key provided",
"type": "invalid_api_key"
}
}{
"error": {
"message": "<string>",
"type": "unauthorized",
"code": "<string>",
"param": "<string>",
"model": "<string>",
"did_you_mean": "<string>",
"suggestions": [
{
"id": "<string>"
}
],
"alternatives": [
{
"id": "<string>",
"status": "<string>",
"tags": [
"<string>"
]
}
],
"hint": "<string>",
"retry_after": 123,
"retryable": true,
"balance_usd": 123,
"estimated_cost_usd": 123,
"supported_operations": [
"<string>"
],
"supported_parameters": [
"<string>"
],
"required_selectors": [
"<string>"
],
"optional_selectors": [
"<string>"
],
"allowed_resolutions": [
"<string>"
],
"allowed_durations": [
"<string>"
],
"allowed_aspect_ratios": [
"<string>"
],
"prompt_max_characters": 123,
"recommended_request": {},
"request_endpoint": "<string>",
"request_shape_mode": "<string>",
"status_mode": "<string>",
"request_id": "<string>"
}
}{
"error": {
"message": "An internal error occurred",
"type": "server_error"
}
}{
"error": {
"message": "Seedance material library request failed",
"type": "server_error",
"code": "seedance_material_library_request_failed"
}
}Tạo một nhóm vật liệu với
library_type: "aigc_avatar". Sử dụng endpoint này cho các avatar ảo, sản phẩm, phong cách và các tài liệu tham khảo có thể tái sử dụng khác mà không yêu cầu xác minh người thật.
Các nhóm vật liệu người thật mới được tạo thông qua Tạo phiên xác thực trực quan và không thể tạo trực tiếp bằng endpoint này.
project_name tách biệt tài nguyên trong tổ chức đã xác thực. Mặc định là default; dùng cùng một giá trị phân biệt chữ hoa, chữ thường cho nhóm và tài nguyên liên quan. Gửi trong nội dung JSON với POST/PUT và tham số truy vấn với GET/DELETE.
Ví dụ Yêu cầu
curl https://api.tokenlab.sh/v1/videos/assets/groups \
-H "Authorization: Bearer $TOKENLAB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"library_type":"aigc_avatar","group_name":"Product references","description":"Reusable product shots","project_name":"default"}'
Ví dụ Phản hồi
{
"id": "group-20260720123456-vrt01",
"object": "seedance.material_asset_group",
"project_name": "default",
"library_type": "aigc_avatar",
"group_name": "Product references",
"description": "Reusable product shots",
"status": "ACTIVE",
"metadata": null,
"created_at": 1782998400000
}
Ủy quyền
Xác thực bằng Khóa API. Tạo hoặc quản lý khóa API trong Dashboard > API > API Keys.
Nội dung
application/json
Tên hiển thị tùy chọn cho nhóm tài liệu.
Required string length:
1 - 128Maximum string length:
500Lớp thư viện tài liệu. Việc tạo trực tiếp hỗ trợ aigc_avatar. Tạo các nhóm liveness_face thông qua CreateVisualValidateSession sau đó là GetVisualValidateResult.
Tùy chọn có sẵn:
aigc_avatar, liveness_face Phạm vi dự án cho nhóm tài liệu.
Required string length:
1 - 128Phản hồi
Nhóm tài nguyên vật liệu đã được tạo
ID nhóm tài liệu TokenLab. Sử dụng nó làm group_id khi tải tài liệu lên.
Tùy chọn có sẵn:
seedance.material_asset_group Tùy chọn có sẵn:
aigc_avatar, liveness_face Phạm vi dự án cho nhóm tài liệu này.