> ## 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 Video Generation API

> Digital Human integration guide - Ace Data Cloud

Use `POST /digital-human/videos` to combine a person’s video or photo with audio into a lip-synced video.

## Prepare a Video Generation Request

Copy the API Key from a general-purpose application in the [application list](https://platform.acedata.cloud/console/applications). The example uses the same Key to submit the video and query the generation progress; if you have configured API scopes, allow both operations. Generation costs are available on the [Digital Human pricing page](https://platform.acedata.cloud/services/digitalhuman?tab=pricing).

## Generate Your First Video

Prepare publicly accessible URLs for the person’s video and the driving audio, and replace `YOUR_FACE_VIDEO_URL` and `YOUR_AUDIO_URL` below with your own assets. Use `image_url` for photo input. The example starts with a video and audio combination.

```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
  }'
```

### Submission Response JSON

The following shows the public response contract; use the actual values returned for the task ID and trace\_id.

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

Save the `task_id` from the submission response. While the video is still processing, continue querying the same task.

## Query and Download the Result

```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"}'
```

### Processing Response JSON

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

### Completed Response JSON

The following is an excerpt from a response example in the public 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
}
```

When polling, omit `action` to obtain a flat result containing `state`, `progress`, and, upon completion, `video_url`, `duration`, `width`, and `height`. When `state` is `succeed`, read and save `video_url`; when it is `failed`, read `error` and stop polling. The `success` field of the query request itself does not mean that the video has finished generating. While processing, you can continue querying every few seconds.

Use `action=retrieve` to obtain a detailed task record, with the final result in `response`. For complete query methods, see the [Task Query Guide](https://platform.acedata.cloud/documents/digitalhuman-tasks-integration).

## Inputs and More Operations

* Use `video_url` or `image_url` for the person’s asset, and `audio_url` for the audio asset.
* For text-driven generation, use `text` and a previously created `voice_id`. For voice creation parameters, see the [Voice API](https://platform.acedata.cloud/documents/digitalhuman-voices).
* `callback_url` can receive a completion callback; the callback and active queries should correspond to the same task ID.
* For more parameters and current constraints, see the [Video API Reference](https://platform.acedata.cloud/documents/digitalhuman-videos).

## Error Handling

For input errors, check the asset URLs and the selected input combination. For authentication or balance errors, check the API Key’s associated application, permissions, validity period, and balance. After a request times out, if you have obtained a `task_id`, query the original task first. Provide the `trace_id` and task ID when contacting support.


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