RelayDanceRelayDance
HomeModelsPricingDocsGuides
Get API Key →

Docs / API Reference / Upload Files

POST/v1/files

Upload 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-...:

FieldTypeDescription
fileFileThe 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)
purposestringOptional. 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
}
FieldTypeDescription
idstringFile identifier
urlstringSigned URL, ready to use as reference media; valid for expires_in seconds (6 hours). source_url is the same link
bytesintegerSize of the stored file
content_typestringType detected from the file
existsbooleantrue 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

StatusCodeMeaning
401invalid_api_keyMissing, unknown, disabled or expired API key
400missing_fileNo multipart field named file
400unsupported_file_typeThe file type is not one of the accepted ones
400file_type_mismatchThe content does not match the extension, for example a text file named .png
413file_too_largeOver the size limit for its type
429rate_limit_exceededMore than 120 uploads in an hour from one account
404file_not_foundGET 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.