Uploads
Get an upload link for a file
https://api.tiktornado.com/api/v1/uploadsScope: posts:write
Step 1 of posting a file from your computer. The answer gives an uploadUrl and a mediaRef.
- Upload the file with an HTTP
PUTtouploadUrl, sending only the headers in the answer'sheaders, for example:curl -X PUT -H 'Content-Type: video/mp4' --upload-file clip.mp4 '<uploadUrl>'. - Pass
mediaRefin a post'smediaRefs, or assettings.coverImageRef.
mediaRef is an opaque value: store it and pass it back exactly as you got it. Ask for one link per file. The link expires, so upload soon after you get it, and post the file soon after you upload it.
Videos: MP4, MOV or WebM, up to 4 GB, 3 seconds to 10 minutes. Photos: JPEG, PNG or WebP, up to 20 MB.
This route needs no Idempotency-Key: a repeat simply gives you a new link.
Request body
accountIdstringRequiredAn id, letters and digits only.
Matches
^[A-Za-z0-9]{1,64}$.filenamestringRequiredThe file's name, for example
clip.mp4.1 to 255 characters.
contentTypestringRequiredThe file's type (
file_type_not_supportedfor any other).One of
video/mp4,video/quicktime,video/webm,image/jpeg,image/png,image/webp.sizeintegerRequiredThe file's size in bytes. Videos up to 4 GB (
file_too_large), photos up to 20 MB (photo_too_large).1 to 4,000,000,000.
Example request
curl -X POST 'https://api.tiktornado.com/api/v1/uploads' \
-H "Authorization: Bearer $TIKTORNADO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "j971x2c4ajrq0w8sd5e8fxz3a57v2k8m",
"filename": "leg-day.mp4",
"contentType": "video/mp4",
"size": 48213504
}'Response 201
The upload link.
uploadUrlstringRequiredWhere to upload the file, with an HTTP
PUT. For this file only. It expires.A URL.
mediaRefstringRequiredAn opaque value for the uploaded file. Pass it back exactly as you got it, in
mediaRefsor assettings.coverImageRef.methodstringRequiredAlways
PUT.headersobjectRequiredThe only headers to send with the upload.
1 field inside
Content-TypestringRequired
{
"uploadUrl": "https://uploads.example.com/put/leg-day.mp4?signature=EXAMPLE",
"mediaRef": "https://media.example.com/uploads/7f3a9c/leg-day.mp4",
"method": "PUT",
"headers": {
"Content-Type": "video/mp4"
}
}Errors
| Status | Reason | Message |
|---|---|---|
| 400 | invalid_request | Something here isn't valid. Check it and try again. |
file_type_not_supported | This file type isn't supported. Use MP4, MOV or WebM for videos, or JPEG, PNG or WebP for photos. | |
file_too_large | This file is too big. Videos can be up to 4 GB and photos 20 MB. | |
photo_too_large | This photo is too big. Photos can be up to 20 MB. | |
account_not_ready | This account isn't ready to post yet. This account is under review by TikTok, so new posts can't be scheduled right now. | |
invalid_state | This can't be done right now. Refresh and try again. | |
| 401 | api_key_invalid | This API key isn't valid. Check it, or create a new one in the app. |
| 403 | access_locked | Your subscription isn't active, so this can't be changed right now. Visit Billing to fix it. |
api_scope_missing | This API key can't do this. Create a key with the access it needs in the app. | |
| 404 | not_found | We couldn't find this. |
| 429 | slow_down | You're going a bit fast. Wait a moment and try again. |
| 500 | unknown_error | Something went wrong on our side. We're on it. |
| 503 | service_unavailable | Something went wrong on our side. We're on it. |