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

# 仮想アバターアセット

>  - プライベートドメイン仮想アバターアセット送信 API
- バッチ送信対応、1 回のリクエストで最大 20 件
- アセットグループの自動作成または再利用、タスク ID を返してステータス確認が可能
- 審査通過済みアセットは Seedance 2.0 の動画生成で直接利用可能 

<RequestExample>
  ```bash cURL（バッチ送信・新規グループ作成） theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/seedance2/private-avatar \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "group": {
        "name": "virtual-avatar-group",
        "description": "demo group"
      },
      "project_name": "default",
      "asset_type": "Image",
      "assets": [
        {
          "url": "https://example.com/avatar-a.png",
          "name": "avatar-a"
        },
        {
          "url": "https://example.com/avatar-b.png",
          "name": "avatar-b"
        }
      ]
    }'
  ```

  ```bash cURL（既存グループを使用） theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/seedance2/private-avatar \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "group_id": "group_xxx",
      "project_name": "default",
      "asset_type": "Image",
      "assets": [
        {
          "url": "https://example.com/avatar-a.png",
          "name": "avatar-a"
        }
      ]
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/seedance2/private-avatar"

  payload = {
      "group": {
          "name": "virtual-avatar-group",
          "description": "demo group"
      },
      "project_name": "default",
      "asset_type": "Image",
      "assets": [
          {
              "url": "https://example.com/avatar-a.png",
              "name": "avatar-a"
          },
          {
              "url": "https://example.com/avatar-b.png",
              "name": "avatar-b"
          }
      ]
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/seedance2/private-avatar";

  const payload = {
    group: {
      name: "virtual-avatar-group",
      description: "demo group"
    },
    project_name: "default",
    asset_type: "Image",
    assets: [
      {
        url: "https://example.com/avatar-a.png",
        name: "avatar-a"
      },
      {
        url: "https://example.com/avatar-b.png",
        name: "avatar-b"
      }
    ]
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": {
      "id": "task_01K...",
      "object": "seedance.avatar.asset.task",
      "status": "processing",
      "progress": 10,
      "model": "doubao-seedance-2.0"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "リクエストパラメータが無効です",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "認証に失敗しました。APIキーをご確認ください。",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "残高不足です。チャージしてから再試行してください。",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "リクエストが多すぎます。しばらくしてから再試行してください。",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "サーバー内部エラーが発生しました。しばらくしてから再試行してください。",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## 認証

<ParamField header="Authorization" type="string" required>
  すべてのリクエストに Bearer Token 認証が必要です

  API Key の取得：

  [API Key 管理ページ](https://apimart.ai/keys) にアクセスして API Key を取得してください

  各リクエストに以下のヘッダーを追加してください：

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## リクエストパラメータ

<ParamField body="group" type="object">
  アセットグループ情報

  `group_id` を指定しない場合、サーバーはこのフィールドをもとに `AIGC` タイプのアセットグループを自動作成します

  <Expandable title="フィールド説明">
    <ParamField body="name" type="string">
      アセットグループ名
    </ParamField>

    <ParamField body="description" type="string">
      アセットグループの説明
    </ParamField>
  </Expandable>

  例：

  ```json theme={null}
  {
    "group": {
      "name": "virtual-avatar-group",
      "description": "demo group"
    }
  }
  ```

  <Warning>
    `group_id` と同時に指定することはできません。どちらか一方を使用してください
  </Warning>
</ParamField>

<ParamField body="group_id" type="string">
  既存アセットグループ ID

  指定した場合はグループ作成をスキップし、そのグループに直接アセットを送信します

  <Warning>
    `group` と同時に指定することはできません。どちらか一方を使用してください
  </Warning>
</ParamField>

<ParamField body="project_name" type="string" default="default">
  プロジェクト名

  デフォルト：`default`
</ParamField>

<ParamField body="asset_type" type="string" default="Image">
  アセットタイプ

  選択肢：

  * `Image` - 画像アセット（デフォルト）
  * `Video` - 動画アセット
  * `Audio` - 音声アセット

  デフォルト：`Image`
</ParamField>

<ParamField body="assets" type="array">
  アセットリスト、1 回のリクエストで複数のアセットを送信できます

  <Warning>
    1 回の送信で最大 **20** 件まで
  </Warning>

  <Expandable title="フィールド説明">
    <ParamField body="url" type="string" required>
      アセット URL — 公開アクセス可能なリンクを指定してください
    </ParamField>

    <ParamField body="name" type="string" required>
      アセット名
    </ParamField>
  </Expandable>

  例：

  ```json theme={null}
  {
    "assets": [
      {
        "url": "https://example.com/avatar-a.png",
        "name": "avatar-a"
      },
      {
        "url": "https://example.com/avatar-b.png",
        "name": "avatar-b"
      }
    ]
  }
  ```
</ParamField>

<ParamField body="url" type="string">
  単一アセット互換記法：アセット URL

  <Warning>
    `assets` 配列とどちらか一方のみ使用可能。単一アセットの送信に適しています
  </Warning>
</ParamField>

<ParamField body="name" type="string">
  単一アセット互換記法：アセット名

  <Warning>
    `assets` 配列とどちらか一方のみ使用可能。単一アセットの送信に適しています
  </Warning>
</ParamField>

## レスポンス

<ResponseField name="code" type="integer">
  レスポンスステータスコード。成功時は 200
</ResponseField>

<ResponseField name="data" type="object">
  タスク情報

  <Expandable title="フィールド説明">
    <ResponseField name="id" type="string">
      ローカルタスク ID。アセット審査状態の確認に使用します
    </ResponseField>

    <ResponseField name="object" type="string">
      タスクオブジェクトタイプ。常に `seedance.avatar.asset.task`
    </ResponseField>

    <ResponseField name="status" type="string">
      タスクの初期状態。送信後は `processing`
    </ResponseField>

    <ResponseField name="progress" type="integer">
      タスクの進捗（0 \~ 100）
    </ResponseField>

    <ResponseField name="model" type="string">
      使用中のモデル名
    </ResponseField>
  </Expandable>
</ResponseField>

## 使用例

### 例 1：バッチ送信（グループ自動作成）

`group_id` を指定しない場合、サーバーが `AIGC` タイプのアセットグループを自動作成してから送信します。

```json theme={null}
{
  "group": {
    "name": "virtual-avatar-group",
    "description": "demo group"
  },
  "project_name": "default",
  "asset_type": "Image",
  "assets": [
    {
      "url": "https://example.com/avatar-a.png",
      "name": "avatar-a"
    },
    {
      "url": "https://example.com/avatar-b.png",
      "name": "avatar-b"
    }
  ]
}
```

### 例 2：既存グループへのアセット追加

`group_id` を指定することでグループ作成をスキップして直接送信します。

```json theme={null}
{
  "group_id": "group_xxx",
  "project_name": "default",
  "asset_type": "Image",
  "assets": [
    {
      "url": "https://example.com/avatar-a.png",
      "name": "avatar-a"
    }
  ]
}
```

### 例 3：単一アセット互換記法

アセットが 1 件のみの場合、トップレベルの `url` と `name` フィールドを直接使用できます。

```json theme={null}
{
  "group_id": "group_xxx",
  "url": "https://example.com/avatar.png",
  "asset_type": "Image",
  "name": "avatar-1"
}
```

## 審査結果の確認

アセット送信後は非同期審査タスクになります。[タスク状態の取得](/ja/api-reference/tasks/status) エンドポイントで進捗を確認してください：

```http theme={null}
GET /v1/tasks/{id}
```

### 全件承認

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01K...",
    "status": "completed",
    "progress": 100,
    "result": {
      "assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        },
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Active"
        }
      ],
      "usable_assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        },
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Active"
        }
      ],
      "failed_assets": []
    }
  }
}
```

### 一部失敗

バッチ送信で 1 件でも審査に失敗した場合、タスク状態は `failed` になります。承認済みアセットは引き続き使用可能で、`result.usable_assets` に表示されます。

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01K...",
    "status": "failed",
    "progress": 100,
    "result": {
      "assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        },
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Failed"
        }
      ],
      "usable_assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        }
      ],
      "failed_assets": [
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Failed"
        }
      ]
    },
    "error": {
      "code": "task_failed",
      "message": "一部のアセットの審査に失敗しました"
    }
  }
}
```

<Note>
  * `result.usable_assets[].asset_url` は Seedance 2.0 の動画生成で直接使用できます
  * `result.failed_assets` 内のアセットはソースファイルを差し替えるか再送信が必要です
  * 単一アセットのタスクでも互換として `result.asset_url` が返されます
</Note>

## 審査済みアセットの使用

`asset://...` URL を [Seedance 2.0 動画生成](/ja/api-reference/videos/doubao-seedance-2-0/generation) エンドポイントに直接渡してください：

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "キャラクターが都市の街路を自然に歩く",
  "image_urls": ["asset://asset_a"],
  "duration": 5,
  "resolution": "720p"
}
```

<Note>
  サーバーが `asset://` プレフィックスを検出すると、アセット審査を再度トリガーせず、直接生成タスクを送信します。
</Note>
