> ## 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` 배열과 둘 중 하나만 사용 가능. 에셋 1개 제출 시 적합합니다
  </Warning>
</ParamField>

<ParamField body="name" type="string">
  단일 에셋 단축 표기: 에셋 이름

  <Warning>
    `assets` 배열과 둘 중 하나만 사용 가능. 에셋 1개 제출 시 적합합니다
  </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"
}
```

## 심사 결과 조회

에셋 제출 후 비동기 심사 태스크가 됩니다. [태스크 상태 조회](/ko/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 동영상 생성](/ko/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>
