Upload a file to a session
https://vod-uploads-middleware-api.livepush.io/uploads/{session_id}
Base URL https://vod-uploads-middleware-api.livepush.io — Livepush Video Upload Middleware
Sends the video file. The body is the raw file bytes, not a form and not JSON, streamed straight into storage. The response arrives once the whole file has been written, so set no client timeout (or a very long one) on this request.
The session is consumed by the first request to it, whether or not the upload succeeds. To retry a failed upload, call Create an upload session again with the same upload specification.
On {"success": true}, finish with Register an uploaded video.
Authorization
Send a valid access token in the Authorization header.
bearerAuth— Bearer token (JWT)
Authorization: Bearer YOUR_API_TOKEN
Try it
Loading the request builder…
PUT
https://vod-uploads-middleware-api.livepush.io/uploads/{session_id}
— This call changes live data on your account.
Parameters
Path parameters
-
session_idstring requiredLast path segment of theuploadUrlreturned by Create an upload session.example: Qe8rT2pZx
Request body
The raw bytes of the file. See the code samples below.
Code samples
curl -X PUT 'https://vod-uploads-middleware-api.livepush.io/uploads/Qe8rT2pZx' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/octet-stream' \
--data-binary '@video.mp4'
import { readFile } from 'node:fs/promises';
const file = await readFile('video.mp4');
const response = await fetch('https://vod-uploads-middleware-api.livepush.io/uploads/Qe8rT2pZx', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/octet-stream',
},
body: file,
});
if (!response.ok) {
throw new Error(`Livepush API error ${response.status}`);
}
const data = await response.json();
import requests
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/octet-stream',
}
with open('video.mp4', 'rb') as f:
response = requests.put('https://vod-uploads-middleware-api.livepush.io/uploads/Qe8rT2pZx', headers=headers, data=f, timeout=None)
response.raise_for_status()
data = response.json()
Responses
The file was written to storage.
-
successboolean -
errorbooleanPresent andtruewhen the file could not be written to storage.
{
"success": true
}
The session does not exist, has expired or was already used (unsigned request), or the file could not be written to storage (success: false). Create a new session and upload again.
{
"error": "unsigned request"
}
Missing or invalid bearer token.
{
"error": "unauthorized"
}