Start an upload
const url = 'http://localhost:8300/v1/studio/uploads';const options = { method: 'POST', headers: { 'x-api-key': '<x-api-key>', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"filename":"example","content_type":"image/png","bytes":1,"duration_s":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8300/v1/studio/uploads \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "filename": "example", "content_type": "image/png", "bytes": 1, "duration_s": 1 }'Stores a pending take (source upload, invisible until completed) and signs a single-use PUT link for the key u/<caller>/uploads/<take_id>.<png|jpg|webp|wav|mp3|m4a>, valid 15 minutes (PUT /files/{path}): image/png, an audio take; duration_s required, at most 600 s), at most 50 MB (52428800 bytes). 422 for any other type or size (“only png, jpeg and webp images or wav, mp3 and m4a audio can be uploaded”, “file is larger than 50 MB”, “audio is longer than 600 s”). A pending upload not completed within an hour is discarded. optimises a file before this call: bytes is the file it uploads.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The file’s name; only its base name (without extension) is kept, as the title
Audio only (required): its length as the browser decoded it; studio records it, the runner reads the file itself
Responses
Section titled “Responses”The upload
object
Pass to /v1/studio/uploads/{take_id}/complete; becomes the take’s id
Signed single-use link: PUT the bytes here with exactly this Content-Type and Content-Length
Example
{ "upload_url": "/files/u/7d1e.../uploads/9b2f....png?exp=1767225600&bytes=48213&ct=image%2Fpng&sig=ab12"}Missing or invalid x-api-key (Kong), or missing/invalid/expired/revoked bearer token
object
Example generated
{ "detail": "example"}Invalid input
object
Example generated
{ "detail": "example"}Retryable
object
Example generated
{ "detail": "example"}