> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tạo nhóm tài sản nhân vật

> Tạo nhóm tài sản nhân vật CometAPI cho các tham chiếu Seedance. Nhóm ảo được kích hoạt ngay, còn nhóm người thật cần xác minh.

Tạo một nhóm trước khi tải hình ảnh nhân vật lên. Gửi mã thông báo truy cập thô trong tiêu đề `Authorization` mà không có tiền tố `Bearer`.

```bash theme={null}
curl \
  https://api.cometapi.com/api/asset/groups \
  -H "Authorization: $COMETAPI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-character",
    "type": "virtual"
  }'
```

## Các trường yêu cầu

| Trường | Kiểu | Mô tả |
| - | - | - |
| `name` | string | Tên nhóm gồm từ 1 đến 64 ký tự. |
| `type` | string | Dùng `virtual` cho nhân vật ảo hoặc `real` cho người thật. |

Phản hồi lưu ID nhóm CometAPI trong `data.id`. Nhóm `virtual` trả về `data.status=active`. Nhóm `real` trả về `data.status=pending` và chứa `data.liveness.platform_wrapper_url` đã ký.

## Các trường phản hồi

| Trường | Mô tả |
| - | - |
| `data.id` | ID nhóm được dùng bởi các endpoint tải lên và nhóm. |
| `data.group_type` | Loại nhóm bạn đã gửi. |
| `data.status` | `active`, `pending` hoặc `expired`. |
| `data.liveness` | Có trong nhóm người thật đang chờ. |

Với nhóm người thật, hãy tiếp tục bằng [Truy xuất nhóm tài sản nhân vật](https://apidoc.cometapi.com/vi/api/video/seedance/get-character-asset-group.md) và [Kích hoạt xác minh người thật](https://apidoc.cometapi.com/vi/api/video/seedance/activate-character-asset-liveness.md). Với nhóm ảo, hãy tiếp tục bằng [Tải lên tài sản nhân vật](https://apidoc.cometapi.com/vi/api/video/seedance/upload-character-asset.md).


## OpenAPI

````yaml api/openapi/video/seedance/post-create-character-asset-group.openapi.json POST /api/asset/groups
openapi: 3.1.0
info:
  title: Create character asset group API
  version: 1.0.0
  description: Create a CometAPI character asset group for Seedance references.
servers:
  - url: https://api.cometapi.com
security:
  - accessTokenAuth: []
paths:
  /api/asset/groups:
    post:
      summary: Create a character asset group
      description: >-
        Create a character asset group. Virtual groups become active
        immediately. Real-person groups begin in pending status and require
        liveness verification.
      operationId: seedance_create_character_asset_group
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGroupRequest'
            examples:
              virtual:
                summary: Create a virtual character group
                value:
                  name: my-character
                  type: virtual
              real:
                summary: Create a real-person group
                value:
                  name: my-real-character
                  type: real
      responses:
        '200':
          description: Character asset group created.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - message
                  - data
                properties:
                  success:
                    type: boolean
                    description: Whether the request succeeded.
                  message:
                    type: string
                    description: Status or error message.
                  data:
                    $ref: '#/components/schemas/GroupView'
              examples:
                success:
                  summary: Active virtual group
                  value:
                    success: true
                    message: ''
                    data:
                      id: ag-example
                      name: my-character
                      group_type: virtual
                      status: active
                      created_at: 1777385418
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: invalid request body
        '401':
          description: The access token is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: unauthorized
      x-codeSamples:
        - lang: Shell
          label: Character asset request
          source: |-
            curl https://api.cometapi.com/api/asset/groups \
              -H "Authorization: $COMETAPI_ACCESS_TOKEN" \
              -H "Content-Type: application/json" \
              -d '{"name":"my-character","type":"virtual"}'
        - lang: Python
          label: Character asset request
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/api/asset/groups",
                headers={"Authorization": os.environ["COMETAPI_ACCESS_TOKEN"]},
                json={"name": "my-character", "type": "virtual"},
                timeout=30,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Character asset request
          source: >
            const response = await
            fetch("https://api.cometapi.com/api/asset/groups", {
              method: "POST",
              headers: {
                Authorization: process.env.COMETAPI_ACCESS_TOKEN,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({ name: "my-character", type: "virtual" }),
            });


            if (!response.ok) throw new Error(await response.text());

            console.log(await response.json());
components:
  schemas:
    CreateGroupRequest:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 64
          description: Group name.
          example: my-character
        type:
          type: string
          enum:
            - virtual
            - real
          description: Character type.
    GroupView:
      type: object
      required:
        - id
        - name
        - group_type
        - status
        - created_at
      properties:
        id:
          type: string
          description: CometAPI group ID.
          example: ag-example
        name:
          type: string
          description: Group name.
          example: my-character
        group_type:
          type: string
          enum:
            - virtual
            - real
          description: Character type.
        status:
          type: string
          enum:
            - pending
            - active
            - expired
          description: Group status.
        created_at:
          type: integer
          description: Creation time as a Unix timestamp in seconds.
        liveness:
          type: object
          description: Present for a pending real-person group.
          properties:
            platform_wrapper_url:
              type: string
              format: uri
              description: Signed verification URL.
            activated:
              type: boolean
              description: Whether a verification session is active.
            hint:
              type: string
              description: Optional action hint.
          required:
            - platform_wrapper_url
            - activated
    ErrorResponse:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          description: Whether the request succeeded.
        message:
          type: string
          description: Description of the request error.
        data:
          type:
            - object
            - array
            - 'null'
          description: Error details when returned.
      additionalProperties: true
  securitySchemes:
    accessTokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Raw CometAPI access token. Do not prefix it with Bearer.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.