Upload media
const url = 'https://api.loomta.com/public/v1/media';const form = new FormData();form.append('file', 'file');form.append('fileName', 'example');form.append('mimeType', 'example');form.append('mediaType', 'image');form.append('folderId', 'example');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.loomta.com/public/v1/media \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=@file \ --form fileName=example \ --form mimeType=example \ --form mediaType=image \ --form folderId=exampleUpload an image or video via multipart/form-data. TikTok only ingests media that Loomta hosts, so uploading is a prerequisite for posting. The returned object is immediately READY; pass its id to POST /posts.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The image or video file.
Overrides the uploaded file’s name.
One of image/jpeg, image/webp, video/mp4, video/webm, video/quicktime. Inferred from the file when omitted.
Inferred from the MIME type when omitted.
Target folder UUID, or the string null for the root.
Responses
Section titled “Responses”The uploaded media object.
A media object in the workspace library.
object
Example
{ "mimeType": "image/jpeg", "mediaType": "image", "status": "PENDING"}The file field is missing or the type is unsupported.
object
A stable, machine-readable error code to branch on.
A human-readable description.
Optional structured detail (for example Zod validation issues).
Example
{ "code": "invalid_media_file", "message": "The file field is required."}The API key is missing or invalid.
object
A stable, machine-readable error code to branch on.
A human-readable description.
Optional structured detail (for example Zod validation issues).
Examples
{ "code": "missing_api_key", "message": "A Bearer API key is required."}{ "code": "invalid_api_key", "message": "The API key is invalid."}