Start a direct upload
Upload a file from your own machine or browser straight to LiveReacting storage. The bytes never pass through the API, so large files work.
- Call this endpoint with the file name, type and exact size in bytes.
- PUT each part of the file to its URL from parts (no Authorization header; the URL is signed). Part N holds bytes (N-1) * partSize up to N * partSize - 1, and must be exactly parts[].size bytes: storage refuses a part of any other size with 403. You can upload parts in parallel and re-send a part that failed.
- Call POST /files/upload/complete with the uploadToken.
Same limits as a Studio upload: the extension must match the type, the size must fit your plan's max file size, and a video upload is refused once your storage is full. Encoding and thumbnails start after completion, as for a Studio upload.
One-part file (up to 256 MiB):
FILE=intro.mp4
SIZE=$(wc -c < "$FILE" | tr -d ' ')
START=$(curl -s -X POST https://api.livereacting.com/v1/external/files/upload \
-H "Authorization: Bearer $LR_API_KEY" -H "Content-Type: application/json" \
-d "{\"name\": \"$FILE\", \"type\": \"video\", \"size\": $SIZE}")
# -f fails on an HTTP error, -w prints the status, --speed-* stop a stalled transfer
curl -sS -f -o /dev/null -w 'part 1: %{http_code}\n' --speed-limit 1024 --speed-time 60 \
-T "$FILE" "$(echo "$START" | jq -r '.parts[0].url')"
curl -X POST https://api.livereacting.com/v1/external/files/upload/complete \
-H "Authorization: Bearer $LR_API_KEY" -H "Content-Type: application/json" \
-d "{\"uploadToken\": \"$(echo "$START" | jq -r '.uploadToken')\"}"
Larger file: run the first four lines above (FILE, SIZE, START), then this, then the upload/complete call above. If a part fails, the loop stops: PUT that part again before you complete.
split -b "$(echo "$START" | jq -r '.partSize')" -a 4 "$FILE" part_
i=0
for PART in part_*; do
URL=$(echo "$START" | jq -r ".parts[$i].url")
curl -sS -f -o /dev/null -w "part $((i + 1)): %{http_code}\n" --speed-limit 1024 --speed-time 60 \
-T "$PART" "$URL" || break
i=$((i + 1))
done
Browser clients: the part URLs point to the storage bucket, not to the API. A web page can upload to them only from an origin the bucket allows; contact us to add yours.
Request
- Base URL: https://api.livereacting.com/v1/external
- URL: https://api.livereacting.com/v1/external/files/upload
- Auth: HTTP bearer
Request body
Example request
{
"name": "intro.mp4",
"type": "video",
"size": 52428800
}Response
Upload started. Upload the parts, then complete it.
Example response
{
"partSize": 268435456,
"parts": [
{
"partNumber": 1,
"size": 52428800
}
]
}Changes
No recorded changes to this operation across all 1 revision of this API.