> ## 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.

# ACE Music Reference Assets API

> ACE Music integration guide - Ace Data Cloud

On accounts with the relevant asset type enabled, use `POST https://api.acedata.cloud/acemusic/assets` to import MIDI, images, or videos, then use your own asset IDs to guide inspiration-based creation. When uploading an MP3 as a cover or fusion track, use the song API's existing `action=upload`. [Song Integration Guide](https://platform.acedata.cloud/documents/acemusic-audios-integration)

## Credentials and Fees

Use an API Key from a general-purpose application or an application with ACE Music access. Restricted keys require asset API permissions. Generating songs and querying asynchronous tasks require song and task API permissions, respectively. A one-time import fee is charged after one asset is successfully delivered. Asset details and history are free to access, and you can read your own assets even with a zero balance. See [Service Pricing](https://platform.acedata.cloud/services/acemusic?tab=pricing) for actual prices.

## Import

Send `Bearer YOUR_API_TOKEN` in the `Authorization` request header. Replace the URL in the request body below with a publicly downloadable HTTPS file link that you have the right to use. For local files, you can first obtain a `file_url` through the platform's file upload API. Keep the source file available during processing.

```json theme={null}
{
  "action": "upload",
  "type": "midi",
  "url": "https://example.com/melody.mid",
  "name": "副歌旋律",
  "async": true
}
```

`type` can be `midi`, `image`, or `video`, with one file imported at a time. You can submit standard MIDI files, PNG/JPEG/WebP images, or MP4 videos no longer than 60 seconds. The limit per file is 32 MiB. Each type is being enabled in batches. Import supports idempotent recovery using the original task; you can reuse the same `Idempotency-Key` and original request body for retries of the same operation. When the request is successfully accepted, save the returned `task_id` and use `retrieve` in the task API to check progress. You can also provide an HTTPS `callback_url` to receive completion notifications. [Original Task Query](https://platform.acedata.cloud/documents/acemusic-tasks-integration)

Once completed, the task's `response.data` is the asset object. Save `data.id` and `data.type` for use when creating songs. Videos return `duration_seconds` when verified. When an expiration time is known, you can read `expires_at` (Unix seconds). If the operation status is `submission_unknown`, save the original task ID and trace ID for support staff to investigate.

## Retrieve an Asset

Replace `id` with the ID of an asset that has been successfully imported.

```json theme={null}
{"action":"retrieve","id":"YOUR_ASSET_ID"}
```

The synchronous response's `data` contains `id`, `type`, `name`, and `status`. The status of an available asset is `available`. Expired asset records can be queried while their metadata is still retained, and their status is `expired`.

## Asset History

Omit `id` to list your own assets. You can filter by `type`; the default is 20 items per page, with a maximum of 100. The allowed number of records to skip is 0 to 10,000. The list returns `items` and the total `count` under the current conditions, sorted by import time from newest to oldest.

```json theme={null}
{"action":"retrieve","type":"image","page":1,"page_size":20}
```

## Generate Songs Using an Asset

Submit an inspiration-mode request to `POST /acemusic/audios`, using the `id` and `type` of the same available asset for `asset_id` and `asset_type`. An asset can be reused for multiple generations within its validity period, and each new generation is billed separately.

```json theme={null}
{
  "action": "generate",
  "model": "acemusic-v1.1",
  "asset_id": "YOUR_ASSET_ID",
  "asset_type": "midi",
  "prompt": "保留这段旋律，编成一首轻快的民谣。",
  "async": true
}
```

A successful generation delivers two songs through the original task. Assets that are missing or do not belong to the current caller return 404, and using an expired asset to create a new song returns 410. Reading an existing task or asset, or receiving the callback for the same task again, does not incur new creation fees.


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