Docs / API Reference / Upload Files
POST
/v1/filesUpload Files
Upload a local file and receive a signed URL. Use that URL in metadata.content[] of a video task, for example as a reference_image.
#Request
Send as multipart/form-data with Authorization: Bearer sk-...:
| Field | Type | Description |
|---|---|---|
file | File | The file to upload: jpg, jpeg, png, webp, gif (up to 10 MB), mp3, wav (up to 20 MB), mp4, mov, webm (up to 47 MB) |
purpose | string | Optional. Accepted and returned unchanged, for compatibility with the OpenAI SDK |
#Example: cURL
terminalbash
curl https://relaydance.com/v1/files \
-H "Authorization: Bearer $RELAYDANCE_API_KEY" \
-F "[email protected]"#Example: Python
upload.pypython
import requests, os
with open("input.jpg", "rb") as f:
resp = requests.post(
"https://relaydance.com/v1/files",
headers={"Authorization": f"Bearer {os.environ['RELAYDANCE_API_KEY']}"},
files={"file": f},
timeout=300,
)
data = resp.json()
print(data["id"], data["url"])#Response
response.jsonjson
{
"id": "file-0123456789abcdef0123456789abcdef-jpg",
"object": "file",
"bytes": 482113,
"created_at": 1794710000,
"filename": "input.jpg",
"purpose": "user_data",
"status": "processed",
"content_type": "image/jpeg",
"md5": "0123456789abcdef0123456789abcdef",
"url": "https://...",
"source_url": "https://...",
"expires_in": 21600,
"url_expires_at": 1794731600,
"exists": false
}| Field | Type | Description |
|---|---|---|
id | string | File identifier |
url | string | Signed URL, ready to use as reference media; valid for expires_in seconds (6 hours). source_url is the same link |
bytes | integer | Size of the stored file |
content_type | string | Type detected from the file |
exists | boolean | true when the same file was uploaded before and was not stored again |
#Get a fresh link
GET
/v1/files/{id}Returns the same object with a new url, valid for another 6 hours. Only the account that uploaded a file can retrieve it.
#Errors
| Status | Code | Meaning |
|---|---|---|
401 | invalid_api_key | Missing, unknown, disabled or expired API key |
400 | missing_file | No multipart field named file |
400 | unsupported_file_type | The file type is not one of the accepted ones |
400 | file_type_mismatch | The content does not match the extension, for example a text file named .png |
413 | file_too_large | Over the size limit for its type |
429 | rate_limit_exceeded | More than 120 uploads in an hour from one account |
404 | file_not_found | GET with an id that does not exist for this account |
See Upload Files for SDK samples, the two-step upload for videos up to 100 MB, and the end-to-end workflow; and Generate Video for the content[] schema the URL plugs into.