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

# Digital Human 동영상 생성 API

> Digital Human API guide - Ace Data Cloud

`POST /digital-human/videos`를 통해 인물 동영상 또는 사진과 오디오를 합성하여 입 모양이 동기화된 동영상을 생성합니다.

## 동영상 생성 요청 준비

[애플리케이션 목록](https://platform.acedata.cloud/console/applications)의 일반 애플리케이션에서 API Key를 복사합니다. 예제에서는 동일한 Key로 동영상을 제출하고 합성 진행 상황을 조회하므로, API 범위를 설정한 경우 두 작업을 모두 허용하세요. 생성 비용은 [Digital Human 요금 페이지](https://platform.acedata.cloud/services/digitalhuman?tab=pricing)에서 확인할 수 있습니다.

## 첫 번째 동영상 생성

공개적으로 접근할 수 있는 인물 동영상과 구동 오디오의 URL을 준비하고, 아래의 `YOUR_FACE_VIDEO_URL`과 `YOUR_AUDIO_URL`을 자신의 소재로 바꿉니다. 사진 입력에는 `image_url`을 사용합니다. 예제에서는 먼저 동영상과 오디오 조합을 선택합니다.

```bash theme={null}
export ACEDATACLOUD_API_KEY="YOUR_API_KEY"
curl --request POST 'https://api.acedata.cloud/digital-human/videos' \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "video_url": "YOUR_FACE_VIDEO_URL",
    "audio_url": "YOUR_AUDIO_URL",
    "async": true
  }'
```

### 제출 응답 JSON

다음은 공개된 응답 계약에 따라 표시한 것으로, 작업 ID와 trace\_id에는 실제 반환값을 사용하세요.

```json theme={null}
{
  "success": true,
  "task_id": "YOUR_TASK_ID",
  "trace_id": "YOUR_TRACE_ID",
  "state": "pending"
}
```

제출 응답의 `task_id`를 저장합니다. 동영상이 아직 처리 중이면 동일한 작업을 계속 조회합니다.

## 결과 조회 및 다운로드

```bash theme={null}
curl --request POST 'https://api.acedata.cloud/digital-human/tasks' \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"task_id":"YOUR_TASK_ID"}'
```

### 처리 중 응답 JSON

```json theme={null}
{
  "success": true,
  "task_id": "YOUR_TASK_ID",
  "trace_id": "YOUR_TRACE_ID",
  "state": "pending",
  "progress": 0
}
```

### 완료 응답 JSON

다음은 공개 API의 응답 예제에서 발췌한 것입니다.

```json theme={null}
{
  "success": true,
  "task_id": "task_...",
  "trace_id": "...",
  "state": "succeed",
  "progress": 100,
  "video_url": "https://cdn.acedata.cloud/634d760216.mp4",
  "duration": 17.2,
  "width": 1280,
  "height": 720
}
```

폴링 시 `action`을 생략하면 `state`, `progress`와 완료 후의 `video_url`, `duration`, `width`, `height`를 포함하는 평면 구조의 결과를 얻을 수 있습니다. `state`가 `succeed`이면 `video_url`을 읽어 저장하고, `failed`이면 `error`를 읽고 폴링을 중지합니다. 조회 요청 자체의 `success`는 동영상 생성이 완료되었음을 의미하지 않습니다. 처리 중에는 몇 초마다 계속 조회할 수 있습니다.

`action=retrieve`를 사용하면 상세 작업 기록을 얻으며, 최종 결과는 `response`에 있습니다. 전체 조회 방법은 [작업 조회 가이드](https://platform.acedata.cloud/documents/digitalhuman-tasks-integration)를 참조하세요.

## 입력 및 추가 작업

* 인물 소재에는 `video_url` 또는 `image_url`을 사용할 수 있으며, 오디오 소재에는 `audio_url`을 사용합니다.
* 텍스트 구동에는 `text`와 이미 생성된 `voice_id`를 사용합니다. 음성 생성 매개변수는 [음성 API](https://platform.acedata.cloud/documents/digitalhuman-voices)를 참조하세요.
* `callback_url`로 완료 콜백을 받을 수 있으며, 콜백과 직접 조회는 동일한 작업 ID에 대응해야 합니다.
* 추가 매개변수 및 현재 제약 사항은 [동영상 API 참조](https://platform.acedata.cloud/documents/digitalhuman-videos)를 참조하세요.

## 오류 처리

입력 오류가 발생하면 소재 URL과 선택한 입력 조합을 확인합니다. 인증 또는 잔액 오류가 발생하면 API Key가 속한 애플리케이션, 권한, 유효 기간 및 잔액을 확인합니다. 요청 시간이 초과된 후 `task_id`를 확보한 작업은 먼저 원래 작업을 조회해야 합니다. 지원팀에 문의할 때는 `trace_id`와 작업 ID를 제공하세요.


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