Upload an Asset
Upload a new asset. The same endpoint accepts two modes — the server picks by Content-Type:
- Upload a file (
multipart/form-data) — we host it during processing. - Upload by URL (
application/json) — you already host the file publicly; no file transfer through us.
Both modes are asynchronous and return 202 Accepted. Poll Get an Asset until status is active (or failed).
POST
https://console-api.siraya.ai/extapi/v1/assets
Mode A — File Upload
Content-Type: multipart/form-data
assetType
string
Required
One of
image, video, audio.
file
file
Required
The binary file to upload.
name
string
Asset name.
groupId
string
Normal: ignored. VIP: optional, defaults to your account's group.
Mode B — Upload by URL
Content-Type: application/json
url
string
Required
Absolute http(s) URL, publicly reachable (no credentials, no internal/private hosts).
assetType
string
Required
One of
image, video, audio.
name
string
Asset name.
groupId
string
Normal: ignored. VIP: optional, defaults to your account's group.
# Mode A — upload a file (async → 202)
curl -X POST https://console-api.siraya.ai/extapi/v1/assets \
-H "Authorization: Bearer <API_KEY>" \
-F "assetType=image" \
-F "name=hero.png" \
-F "file=@./hero.png"
# Mode B — upload by URL (async → 202)
curl -X POST https://console-api.siraya.ai/extapi/v1/assets \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"url":"https://your-cdn.com/hero.png","assetType":"image","name":"hero.png"}'
import requests
url = "https://console-api.siraya.ai/extapi/v1/assets"
headers = {"Authorization": "Bearer <API_KEY>"}
# Mode A — upload a file
with open("hero.png", "rb") as f:
response = requests.post(
url,
headers=headers,
data={"assetType": "image", "name": "hero.png"},
files={"file": f},
)
asset_id = response.json()["data"]["assetId"] # 202 → asset id
print(asset_id)
# Mode B — upload by URL
response = requests.post(
url,
headers=headers,
json={"url": "https://your-cdn.com/hero.png", "assetType": "image", "name": "hero.png"},
)
print(response.json()["data"]["assetId"])
Example Response