Livepush Developers

Videos

Upload a file to a session

PUT 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)
headers.txt
Authorization: Bearer YOUR_API_TOKEN

Try it

PUT https://vod-uploads-middleware-api.livepush.io/uploads/{session_id} — This call changes live data on your account.

Parameters

Path parameters

  • session_id string required
    Last path segment of the uploadUrl returned by Create an upload session.
    example: Qe8rT2pZx

Request body

application/octet-stream required

The raw bytes of the file. See the code samples below.

Code samples

request.sh
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.

application/json

  • success boolean
  • error boolean
    Present and true when the file could not be written to storage.
Example 200 response response.json
{
  "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.

application/json

Example 400 response response.json
{
  "error": "unsigned request"
}

Missing or invalid bearer token.

application/json

Example 401 response response.json
{
  "error": "unauthorized"
}