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

# Upload Files to the AceDataCloud Platform CDN

> Platform integration guide - Ace Data Cloud

Upload local files to the AceDataCloud platform CDN to obtain a publicly accessible URL (in the style of `https://cdn.acedata.cloud/xxxxxx.png`), which can be immediately referenced in parameters such as `image_url`, `reference_url`, etc. of other business APIs (such as Midjourney, Suno, Flux).

Applicable scenarios:

* Upload a reference image to the CDN to obtain a URL before calling Midjourney `/midjourney/imagine`.
* Cache the video generated in the previous step for use as input in the next step.
* Temporarily host materials uploaded by users, avoiding the need to build your own S3.

> ℹ️ This API is an **AceDataCloud platform management API**, with the unified prefix `https://platform.acedata.cloud/api/v1/`.

## API Overview

| Item | Content |
| - | - |
| Method | `POST` |
| URL | `https://platform.acedata.cloud/api/v1/files/` |
| Authentication | ✅ Account token required |
| Content-Type | `multipart/form-data` (**not JSON**) |

## Authentication Instructions (How to Obtain an Account Token)

Request header:

```http theme={null}
Authorization: Bearer ${PLATFORM_TOKEN}
```

How to obtain it: Log in to the [AceDataCloud Platform](https://platform.acedata.cloud) → [Account Token Console](https://platform.acedata.cloud/console/platform-tokens) → click the “Create” button. See [Manage AceDataCloud Platform Account Tokens](https://platform.acedata.cloud/documents/platform-token) for details.

## Request Body (multipart/form-data)

| Field | Type | Required | Description |
| - | - | - | - |
| `file` | file | ✅ | Binary file stream. **The default single-file limit is 100 MB** |

## Request Examples

### cURL

```shell theme={null}
curl -X POST 'https://platform.acedata.cloud/api/v1/files/' \
  -H 'accept: application/json' \
  -H "authorization: Bearer ${PLATFORM_TOKEN}" \
  -F 'file=@./photo.jpg'
```

### Python

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

PLATFORM_TOKEN = os.environ["PLATFORM_TOKEN"]

with open("photo.jpg", "rb") as f:
    resp = requests.post(
        "https://platform.acedata.cloud/api/v1/files/",
        headers={
            "accept": "application/json",
            "authorization": f"Bearer {PLATFORM_TOKEN}",
        },
        files={"file": ("photo.jpg", f, "image/jpeg")},
        timeout=60,
    )

data = resp.json()
print(f"✅ Upload successful: {data['file_url']}")
# Directly use it in other business APIs:
# requests.post("https://api.acedata.cloud/midjourney/imagine",
#     json={"prompt": "...", "image_urls": [data["file_url"]]}, ...)
```

### Node.js

```javascript theme={null}
const fs = require('fs')
const FormData = require('form-data')

const form = new FormData()
form.append('file', fs.createReadStream('./photo.jpg'))

const r = await fetch('https://platform.acedata.cloud/api/v1/files/', {
  method: 'POST',
  headers: {
    authorization: `Bearer ${process.env.PLATFORM_TOKEN}`,
    ...form.getHeaders(),
  },
  body: form,
})
const data = await r.json()
console.log('CDN URL:', data.file_url)
```

## Response Example (HTTP 200)

```json theme={null}
{
  "file_url": "https://cdn.acedata.cloud/qrd7gw.jpg"
}
```

Simply use the `file_url` field in other business APIs—the CDN URL is currently publicly accessible and does not require authentication; do not treat it as a permanent archival guarantee.

## Response Field Description

| Field | Type | Description |
| - | - | - |
| `file_url` | string | CDN access URL |

## Error Handling

| HTTP | Response Example | Meaning |
| - | - | - |
| 400 | `{"error":"No file provided"}` | The `file` field was not attached or the field name is incorrect |
| 401 | DRF authentication error response | Missing or invalid account token |
| 413 | `{"error":"File too large","max_bytes":...}` | The file exceeds 100 MB (default) |

## Practical Tips

* **Upload images as reference images**: Midjourney `image_urls`, Flux `image_url`, and Veo `reference_url` all accept CDN URLs, and **do not** accept base64. Obtaining a URL through this API first is standard practice.
* **Do not upload sensitive data**: The returned URL is publicly accessible; the retention period is subject to the platform's current storage policy. For long-term archiving, use your own object storage.
* **Bulk uploads**: Control concurrency and set a timeout for each upload; throughput depends on file size and network environment.

## Related APIs

* [Get the AceDataCloud Platform Service List](https://platform.acedata.cloud/documents/platform-service-list) — Find business services that accept URL input
* [Create AceDataCloud Platform API Credentials](https://platform.acedata.cloud/documents/platform-credential-create) — After uploading, the next step is usually to create credentials to call business APIs


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