> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api/cn/ai/aig/video-generation/seedance/assets/create-asset-group.md). Agents can also search and read this documentation through its [MCP server](https://docs.console.zenlayer.com/api/~gitbook/mcp).

# 创建素材组

## 1. 概述

创建一个素材组（Asset Group），用于管理私有数字人素材库。素材组是组织和管理素材（图片、视频、音频）的基本单位。

{% hint style="warning" %}
**素材库接口默认不开启，需要联系技术支持申请开启后才能使用。**
{% endhint %}

## 2. 请求说明

* **请求方法**:`POST`
* **请求地址**:

  > `https://gateway.theturbo.ai/seedance/assets?Action=CreateAssetGroup`

***

## 3. 请求参数

### 3.1 Query 参数

| 参数名称     | 类型     | 必填 | 说明           | 示例值                |
| -------- | ------ | -- | ------------ | ------------------ |
| `Action` | string | 是  | API 操作名称，固定值 | `CreateAssetGroup` |

### 3.2 Header 参数

| 参数名称            | 类型     | 必填 | 说明                                         | 示例值                    |
| --------------- | ------ | -- | ------------------------------------------ | ---------------------- |
| `Content-Type`  | string | 是  | 设置请求头类型，必须为 `application/json`             | `application/json`     |
| `Authorization` | string | 是  | 身份验证所需的 API\_KEY，格式 `Bearer $YOUR_API_KEY` | `Bearer $YOUR_API_KEY` |

***

### 3.3 Body 参数 (application/json)

| 参数名称        | 类型     | 必填 | 说明                                 | 示例值       |
| ----------- | ------ | -- | ---------------------------------- | --------- |
| **Name**    | string | 是  | 素材组名称，最多 64 个字符。                   | `我的数字人素材` |
| Description | string | 否  | 素材组描述，最多 300 个字符。                  | `测试素材组`   |
| GroupType   | string | 否  | 素材组类型，可选值：`AIGC`（数字人角色）。默认 `AIGC`。 | `AIGC`    |

***

## 4. 请求示例

以下示例演示如何创建一个名为"我的数字人素材"的素材组。

{% tabs %}
{% tab title="HTTP" %}

```http
POST /seedance/assets?Action=CreateAssetGroup HTTP/1.1
Host: gateway.theturbo.ai
Content-Type: application/json
Authorization: Bearer $YOUR_API_KEY

{
    "Name": "我的数字人素材",
    "Description": "测试素材组",
    "GroupType": "AIGC"
}
```

{% endtab %}

{% tab title="Shell" %}

```bash
curl --location 'https://gateway.theturbo.ai/seedance/assets?Action=CreateAssetGroup' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR_API_KEY' \
--data '{
    "Name": "我的数字人素材",
    "Description": "测试素材组",
    "GroupType": "AIGC"
}'
```

{% endtab %}

{% tab title="Go" %}
使用火山官方 SDK `volcengine-go-sdk` 的 Universal API，网关 API Key 通过 `API_KEY` 环境变量注入。

{% hint style="info" %}
SDK 的第一个凭证参数填网关 API Key。网关只校验该 Key，实际回源签名由网关使用自己的 AK/SK 完成，因此第二个参数（Secret Key）可填任意非空字符串。
{% endhint %}

```bash
go get github.com/volcengine/volcengine-go-sdk
```

```go
package main

import (
	"encoding/json"
	"fmt"
	"os"

	"github.com/volcengine/volcengine-go-sdk/volcengine"
	"github.com/volcengine/volcengine-go-sdk/volcengine/credentials"
	"github.com/volcengine/volcengine-go-sdk/volcengine/session"
	"github.com/volcengine/volcengine-go-sdk/volcengine/universal"
)

func main() {
	apiKey := os.Getenv("API_KEY")
	if apiKey == "" {
		fmt.Fprintln(os.Stderr, "API_KEY environment variable required")
		os.Exit(1)
	}

	config := volcengine.NewConfig().
		WithCredentials(credentials.NewStaticCredentials(apiKey, "unused", "")).
		WithRegion("cn-beijing").
		WithEndpoint("https://gateway.theturbo.ai/seedance/assets")

	sess, err := session.NewSession(config)
	if err != nil {
		fmt.Fprintf(os.Stderr, "create session failed: %v\n", err)
		os.Exit(1)
	}

	params := map[string]any{
		"Name":        "我的数字人素材",
		"Description": "测试素材组",
		"GroupType":   "AIGC",
	}

	resp, err := universal.New(sess).DoCall(
		universal.RequestUniversal{
			ServiceName: "ark",
			Action:      "CreateAssetGroup",
			Version:     "2024-01-01",
			HttpMethod:  universal.POST,
			ContentType: universal.ApplicationJSON,
		},
		&params,
	)
	if err != nil {
		fmt.Fprintf(os.Stderr, "CreateAssetGroup failed: %v\n", err)
		os.Exit(1)
	}

	output, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Println(string(output))
}
```

{% endtab %}

{% tab title="Python" %}

```python
import os
import requests

api_key = os.environ["API_KEY"]

resp = requests.post(
    "https://gateway.theturbo.ai/seedance/assets",
    params={"Action": "CreateAssetGroup"},
    headers={"Authorization": f"Bearer {api_key}"},
    json={
        "Name": "我的数字人素材",
        "Description": "测试素材组",
        "GroupType": "AIGC",
    },
    timeout=30,
)
resp.raise_for_status()

print("created group:", resp.json()["Result"]["Id"])
```

{% endtab %}
{% endtabs %}

## 5. 响应示例

创建成功后返回素材组 ID。

```json
{
    "ResponseMetadata": {
        "RequestId": "20260328000000000000000000000000",
        "Action": "CreateAssetGroup",
        "Version": "2024-01-01",
        "Service": "ark",
        "Region": "ap-southeast-1"
    },
    "Result": {
        "Id": "group-2026**********-*****"
    }
}
```

| 参数名称 | 类型     | 说明       |
| ---- | ------ | -------- |
| Id   | string | 素材组的唯一标识 |
