Upload Files to the Fishapi Cloud Platform CDN
Upload local files to the Fishapi Cloud platform CDN to obtain a publicly accessible URL (in the style of https://cdn.acedata.cloud/uploads/<uuid>.png), which can be immediately referenced in parameters such as image_url and reference_url of other business APIs (such as Midjourney, Suno, and Flux).
Applicable scenarios:
- Upload a base 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 user-uploaded assets to avoid building your own S3.
ℹ️ This API is an Fishapi Cloud Platform Management API, with the unified prefix
https://fishapi.platform.acedata.cloud/api/v1/.
¶ API Overview
| Item | Content |
|---|---|
| Method | POST |
| URL | https://fishapi.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:
Authorization: Bearer ${PLATFORM_TOKEN}
How to obtain it: Log in to the Fishapi Cloud Platform → Account Token Console → Click the “Create” button. For details, see Manage Fishapi Cloud Platform Account Tokens.
¶ Request Body (multipart/form-data)
| Field | Type | Required | Description |
|---|---|---|---|
file |
file | ✅ | Binary file stream. The default single-file limit is 100 MB |
The platform generates a unique file path on its own and retains safe extensions from the uploaded filename. For example, photo.jpg corresponds to uploads/<uuid>.jpg. The MIME type provided by the upload part is written into the file metadata; if it is not provided or is application/octet-stream, the platform infers the type using the filename and standard MIME mappings. Extension and MIME inference do not convert file contents; please ensure that the filename matches the actual format.
¶ Request Examples
¶ cURL
curl -X POST 'https://fishapi.platform.acedata.cloud/api/v1/files/' \
-H 'accept: application/json' \
-H "authorization: Bearer ${PLATFORM_TOKEN}" \
-F 'file=@./photo.jpg'
¶ Python
import os
import requests
PLATFORM_TOKEN = os.environ["PLATFORM_TOKEN"]
with open("photo.jpg", "rb") as f:
resp = requests.post(
"https://fishapi.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"✅ 上传成功:{data['file_url']}")
# 直接用于其他业务接口:
# requests.post("https://api.fishapi.cloud/midjourney/imagine",
# json={"prompt": "...", "image_urls": [data["file_url"]]}, ...)
¶ Node.js
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://fishapi.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, Excerpt)
{
"file_url": "https://cdn.acedata.cloud/uploads/550e8400-e29b-41d4-a716-446655440000.jpg",
"mime": "image/jpeg"
}
Simply use the file_url field in other business APIs—the CDN URL is currently publicly accessible and requires no authentication; do not treat it as a commitment to permanent storage.
¶ Response Field Description
| Field | Type | Description |
|---|---|---|
file_url |
string | CDN access URL |
mime |
string | MIME type written to object storage |
¶ 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 | The account token is missing or invalid |
| 413 | {"error":"File too large","max_bytes":...} |
The file exceeds 100 MB (default) |
¶ Practical Tips
- Upload images as base images: Midjourney
image_urls, Fluximage_url, and Veoreference_urlall 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 conditions.
¶ Related APIs
- Get the Fishapi Cloud Platform Service List — Find business services that accept URL input
- Create Fishapi Cloud Platform API Credentials — After uploading, the usual next step is to create credentials to call business APIs