On this page
Overview
Our REST API lets you automate everything you can do in the interface: create libraries, upload videos, query the encoding status and embed finished videos. It is ideal for shop systems, headless CMSes and your own workflows.
Every request is bound to your organization. You only ever see and change data inside your own organization — permissions follow your role.
Base URL
https://api.videooptimizer.eu/api/v1
Authentication
All requests (except the public embed endpoint) are authenticated with a bearer token. Here is how to get yours:
- Sign in to the app and open „Account → API-Tokens“ (Account → API tokens).
- Create a new token and give it a descriptive name.
- Copy the token immediately — it is shown in full only once.
Send the token in the Authorization header with every request:
Authorization: Bearer vp_your_token_here
Your first request
Use a simple GET to check that your token works. This request returns all libraries in your organization.
curl https://api.videooptimizer.eu/api/v1/libraries \
-H "Authorization: Bearer vp_your_token_here"
const res = await fetch("https://api.videooptimizer.eu/api/v1/libraries", {
headers: { Authorization: "Bearer vp_your_token_here" },
});
const { data } = await res.json();
console.log(data); // -> array of your libraries
End-to-end flow: from upload to embed
The following four steps show the typical flow of an integration: create a library, upload a video, wait for encoding and finally fetch the embed data.
1 Create a library
A library groups your videos and defines the encoding settings (codecs and resolutions). The response contains the library UUID (id) you will upload into next.
curl -X POST https://api.videooptimizer.eu/api/v1/libraries \
-H "Authorization: Bearer vp_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"name": "My first library",
"codec": "h264,h265",
"resolutions": "360p,720p,1080p"
}'
const res = await fetch("https://api.videooptimizer.eu/api/v1/libraries", {
method: "POST",
headers: {
Authorization: "Bearer vp_your_token_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "My first library",
codec: "h264,h265",
resolutions: "360p,720p,1080p",
}),
});
const { data: library } = await res.json();
console.log(library.id); // the library UUID you'll upload into
2 Upload a video
The upload is a multipart request. The target library is selected via the x-library-id header, the title optionally via x-title. The response contains the video UUID and the status processing.
curl -X POST https://api.videooptimizer.eu/api/v1/videos \
-H "Authorization: Bearer vp_your_token_here" \
-H "x-library-id: <LIBRARY_UUID>" \
-H "x-title: My product video" \
-F "file=@/path/to/video.mp4"
const form = new FormData();
form.append("file", fileInput.files[0]);
const res = await fetch("https://api.videooptimizer.eu/api/v1/videos", {
method: "POST",
headers: {
Authorization: "Bearer vp_your_token_here",
"x-library-id": "<LIBRARY_UUID>",
"x-title": "My product video",
},
body: form, // do NOT set Content-Type manually — the browser adds the boundary
});
const { data } = await res.json();
console.log(data); // { uuid: "...", status: "processing" }
3 Wait for encoding
Encoding runs asynchronously. Poll the video status at intervals until it is ready. Only then is the video playable.
curl https://api.videooptimizer.eu/api/v1/videos/<VIDEO_UUID> \
-H "Authorization: Bearer vp_your_token_here"
async function waitUntilReady(uuid) {
while (true) {
const res = await fetch(`https://api.videooptimizer.eu/api/v1/videos/${uuid}`, {
headers: { Authorization: "Bearer vp_your_token_here" },
});
const { data } = await res.json();
if (data.status === "ready") return data;
await new Promise(r => setTimeout(r, 5000)); // poll every 5s
}
}
4 Embed a video
As soon as the video is ready, the public embed endpoint returns everything the player needs. This endpoint requires no token and can be called straight from the browser.
curl https://api.videooptimizer.eu/api/v1/embed/<VIDEO_UUID>
// Public endpoint — no token required.
const res = await fetch("https://api.videooptimizer.eu/api/v1/embed/<VIDEO_UUID>");
const { data } = await res.json();
// data contains the player sources, poster and embed URL you can render.
If you would rather copy and paste the finished HTML embed code, see the embed guide for content teams.
Advanced features
For production use the API offers more: fetch long lists page by page, upload very large files reliably, import videos directly from a URL, and get notified by webhook instead of polling.
Pagination
The list endpoints GET /api/v1/libraries and GET /api/v1/libraries/:id/videos return their results page by page (cursor-based, no page numbers). Control the page size with ?limit= (default 50, maximum 100) and page on with ?cursor=. The response also contains a pagination object with next_cursor and has_more — pass next_cursor as the next cursor value until has_more is false.
curl "https://api.videooptimizer.eu/api/v1/libraries?limit=20" \
-H "Authorization: Bearer vp_your_token_here"
let cursor;
do {
const url = new URL("https://api.videooptimizer.eu/api/v1/libraries");
url.searchParams.set("limit", "20");
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, {
headers: { Authorization: "Bearer vp_your_token_here" },
});
const { data, pagination } = await res.json();
// ...process this page of results...
cursor = pagination.next_cursor;
} while (cursor);
Large files & resumable upload
For smaller files the simple multipart upload from step 2 above is enough. For very large files you upload in parts directly to our storage instead: POST /api/v1/videos/upload/initiate returns a presigned URL per part, which you upload individually with PUT; afterwards POST /api/v1/videos/upload/complete reports the uploaded parts so the video can be assembled.
# 1. Initiate — get one presigned PUT URL per part
curl -X POST https://api.videooptimizer.eu/api/v1/videos/upload/initiate \
-H "Authorization: Bearer vp_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"libraryId": "<LIBRARY_UUID>",
"filename": "movie.mp4",
"fileSize": 524288000
}'
# 2. PUT each part straight to its presigned URL (repeat per part —
# read the ETag from each PUT response, you need it for step 3)
curl -X PUT "<PRESIGNED_PART_URL>" --data-binary @part-1.bin
# 3. Complete — hand back the part ETags to assemble the video
curl -X POST https://api.videooptimizer.eu/api/v1/videos/upload/complete \
-H "Authorization: Bearer vp_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"libraryId": "<LIBRARY_UUID>",
"uuid": "<VIDEO_UUID_FROM_INITIATE>",
"key": "<KEY_FROM_INITIATE>",
"uploadId": "<UPLOAD_ID_FROM_INITIATE>",
"title": "My product video",
"parts": [{ "partNumber": 1, "etag": "<ETAG_FROM_STEP_2>" }]
}'
const { data: init } = await fetch("https://api.videooptimizer.eu/api/v1/videos/upload/initiate", {
method: "POST",
headers: {
Authorization: "Bearer vp_your_token_here",
"Content-Type": "application/json",
},
body: JSON.stringify({ libraryId, filename: file.name, fileSize: file.size }),
}).then(r => r.json());
const parts = [];
for (const part of init.parts) {
const chunk = file.slice((part.partNumber - 1) * init.partSize, part.partNumber * init.partSize);
const putRes = await fetch(part.url, { method: "PUT", body: chunk });
parts.push({ partNumber: part.partNumber, etag: putRes.headers.get("ETag") });
}
await fetch("https://api.videooptimizer.eu/api/v1/videos/upload/complete", {
method: "POST",
headers: {
Authorization: "Bearer vp_your_token_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
libraryId, uuid: init.uuid, key: init.key, uploadId: init.uploadId, parts,
}),
});
Import a video by URL
Instead of uploading the file yourself, you can also call POST /api/v1/videos with JSON and supply a publicly reachable https URL (source_url) — the platform then downloads the file itself.
curl -X POST https://api.videooptimizer.eu/api/v1/videos \
-H "Authorization: Bearer vp_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"library_id": "<LIBRARY_UUID>",
"source_url": "https://example.com/videos/movie.mp4",
"title": "My product video"
}'
const res = await fetch("https://api.videooptimizer.eu/api/v1/videos", {
method: "POST",
headers: {
Authorization: "Bearer vp_your_token_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
library_id: "<LIBRARY_UUID>",
source_url: "https://example.com/videos/movie.mp4",
title: "My product video",
}),
});
const { data } = await res.json();
console.log(data); // { uuid: "...", status: "processing" }
Store your own data and find videos by it
Give a video your own key/value data as metadata – for example the space, environment and asset ID of the CMS entry it belongs to – and find the video later by any of these values. Unlike tags, metadata is meant for exactly this: identifiers from your system, stored exactly and compared exactly.
- Set it when you create the video (
metadatain the JSON body ofPOST /api/v1/videoswithsource_url, or onupload/complete); after a multipart upload, set it withPATCH. PATCH /api/v1/videos/:uuidmerges: the keys you send are set, a key withnullis removed, all others stay."metadata": nullremoves everything.- Find videos with
GET /api/v1/videos?metadata[key]=value(also onGET /api/v1/libraries/:id/videos); up to 5 such filters, combined with AND. Every video object – in API responses, webhooks and MCP – containsmetadata({}when empty). - The comparison is exact and case-sensitive (
ABCdoes not findabc); values are not unique – several videos may carry the same value, so a search returns a list. - At most 10 keys per video; keys are 1–40 characters of lowercase letters, digits,
_,.and-; values are 1–64 characters without control characters, leading and trailing spaces are removed. An invalid value is rejected with 400 (data.codenames the reason), never silently dropped.
# Store your own ids when creating the video …
curl -X POST https://api.videooptimizer.eu/api/v1/videos \
-H "Authorization: Bearer vp_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"library_id": "<LIBRARY_UUID>",
"source_url": "https://example.com/videos/movie.mp4",
"metadata": {
"contentful_space": "abc123",
"contentful_environment": "master",
"contentful_asset_id": "4ycPbMkEPCPWDBVVuJSVJy"
}
}'
# … find the video by one of them later (exact, case-sensitive match) …
curl -G https://api.videooptimizer.eu/api/v1/videos \
-H "Authorization: Bearer vp_your_token_here" \
--data-urlencode "metadata[contentful_asset_id]=4ycPbMkEPCPWDBVVuJSVJy"
# … or change it: keys you send are set, null removes a key, the rest stays
curl -X PATCH https://api.videooptimizer.eu/api/v1/videos/<VIDEO_UUID> \
-H "Authorization: Bearer vp_your_token_here" \
-H "Content-Type: application/json" \
-d '{ "metadata": { "contentful_environment": "staging", "contentful_space": null } }'
const params = new URLSearchParams({
"metadata[contentful_asset_id]": "4ycPbMkEPCPWDBVVuJSVJy",
});
const res = await fetch(`https://api.videooptimizer.eu/api/v1/videos?${params}`, {
headers: { Authorization: "Bearer vp_your_token_here" },
});
const { data } = await res.json();
// Not unique: zero, one or several videos can carry the same value.
console.log(data.map(v => [v.uuid, v.metadata]));
Webhooks instead of polling
Instead of polling for the video status you can be notified by webhook as soon as a video is ready (video.ready) or encoding has failed (video.failed). Webhooks are configured in the app under „Organization → Webhooks“ (Organization → Webhooks) and are available to owners and admins only — not via the API.
Every delivery is signed. Verify the X-VideoOptimizer-Signature header (sha256= + HMAC-SHA256 over timestamp + raw body, see the example below, using your endpoint secret) against the accompanying X-VideoOptimizer-Timestamp before you trust the payload. Every delivery also carries a unique X-VideoOptimizer-Delivery-Id.
import crypto from "crypto";
function isValidWebhook(rawBody, timestamp, signatureHeader, secret) {
const expected = "sha256=" + crypto
.createHmac("sha256", secret)
.update(`${timestamp}.${rawBody}`)
.digest("hex");
return signatureHeader === expected;
}
// Inside your webhook route handler:
const timestamp = req.headers["x-videooptimizer-timestamp"];
const signature = req.headers["x-videooptimizer-signature"];
if (!isValidWebhook(rawBody, timestamp, signature, process.env.WEBHOOK_SECRET)) {
return res.status(401).send("Invalid signature");
}
Limits & hosts
- Rate limit: 120 requests per minute per token or IP.
- The API is reachable only via its own API subdomain — other hosts respond with 404.
- Each token is scoped to exactly one organization; permissions are checked live on every request.
Best practices for high-traffic pages
Querying the API on every page view from your shop or CMS works, but it is the slowest and most fragile option. With these patterns your pages stay fast and independent of the API:
- Cache API responses on your side. A video's embed config, sources and image URLs only change when you change the video – an hour of caching (and refreshing via webhook) is safe. Our plugins for Shopware, WordPress, TYPO3 and Sulu do exactly that.
- Embed the stable URLs directly instead of looking them up on every page view:
embed_url,hls_url,poster_urlandthumbnail_urldo not change for a video, their content is kept up to date. Store them once – stored URLs stay valid permanently, even if we change how we deliver. - Use webhooks (
video.ready,video.failed) instead of pollingGET /videos/{uuid}in a loop. - Handle
429cleanly: wait for the seconds given inRetry-After, then retry – never in a tight loop. - Browsers and CDNs may cache public embed and media responses for up to 60 seconds, so a changed player design or thumbnail can take up to a minute to appear everywhere.
AI assistants (MCP)
VideoOptimizer provides an MCP server (Model Context Protocol). With it, AI assistants such as Claude or Cursor work directly with your videos: add videos from a URL by voice, maintain titles and tags, check the status, fetch embed code or translate and upload subtitles.
Enter the address below in your MCP client as a “Streamable HTTP” server and send an API token as a bearer header. The assistant works with exactly the permissions of this token.
https://api.videooptimizer.eu/api/v1/mcp
claude mcp add --transport http videooptimizer https://api.videooptimizer.eu/api/v1/mcp \
--header "Authorization: Bearer vp_your_token_here"
{
"mcpServers": {
"videooptimizer": {
"type": "http",
"url": "https://api.videooptimizer.eu/api/v1/mcp",
"headers": { "Authorization": "Bearer vp_your_token_here" }
}
}
}
Available tools: list libraries and videos, video details with embed code, read and upload subtitles, tags, bandwidth savings, add a video from a URL, change titles/tags, create a library. Deleting is deliberately not possible.
Every tool call counts towards the rate limit and, for write actions, appears in your organisation’s audit log.
Detailed guide for all clients