Datei hochladen
POST /api/v1/uploads – signierte URL abrufen, eine lokale Videodatei per PUT hochladen und anschließend hochskalieren.
Liegt dein Video nicht unter einer öffentlichen URL, lädst du es zuerst hoch. Der Upload besteht aus zwei Anfragen: Du holst dir bei uns eine signierte Upload-URL und sendest die Datei dann per PUT direkt an den Speicher.
POST https://videoupscaler.co/api/v1/uploadsAnfrage
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
content_type | string | Ja | video/mp4, video/quicktime oder video/webm |
size | integer | Ja | Dateigröße in Bytes, bis zu 100MB (104857600) |
Dateien über 100MB hostest du selbst und übergibst ihre URL an /upscale (bis zu 500MB).
Antwort
201 Created:
{
"upload_url": "https://api.videoupscaler.co/uploads/eyJrZXki…",
"method": "PUT",
"headers": { "Content-Type": "video/mp4" },
"video_url": "https://storage.videoupscaler.co/videos/api/5f0c…mp4",
"max_bytes": 7340032,
"expires_at": "2026-09-30T09:00:00.000Z"
}| Feld | Beschreibung |
|---|---|
upload_url | Hierhin sendest du die Datei per PUT. Ein Authorization-Header ist nicht nötig – die URL selbst ist die Berechtigung. |
headers | Sende diese Header mit dem PUT mit. Content-Type muss mit dem angegebenen Typ übereinstimmen. |
video_url | Übergib sie nach Abschluss des Uploads an /upscale. |
max_bytes | Der Upload wird abgelehnt, wenn die Datei größer ist als die angegebene size. |
expires_at | Die Upload-URL ist 1 Stunde lang gültig. |
Vollständiges Beispiel
FILE=clip.mp4
SIZE=$(wc -c < "$FILE" | tr -d ' ')
# 1. Get an upload URL
UPLOAD=$(curl -s https://videoupscaler.co/api/v1/uploads \
-H "Authorization: Bearer $VIDEOUPSCALER_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"content_type\": \"video/mp4\", \"size\": $SIZE}")
# 2. Upload the file
curl -X PUT "$(echo "$UPLOAD" | jq -r .upload_url)" \
-H "Content-Type: video/mp4" \
--data-binary @"$FILE"
# 3. Upscale it
curl https://videoupscaler.co/api/v1/upscale \
-H "Authorization: Bearer $VIDEOUPSCALER_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"video_url\": \"$(echo "$UPLOAD" | jq -r .video_url)\", \"resolution\": \"1080p\"}"import { readFile } from 'node:fs/promises';
const api = 'https://videoupscaler.co/api/v1';
const auth = { Authorization: `Bearer ${process.env.VIDEOUPSCALER_API_KEY}` };
const file = await readFile('clip.mp4');
// 1. Get an upload URL
const upload = await fetch(`${api}/uploads`, {
method: 'POST',
headers: { ...auth, 'Content-Type': 'application/json' },
body: JSON.stringify({ content_type: 'video/mp4', size: file.length }),
}).then((r) => r.json());
// 2. Upload the file
await fetch(upload.upload_url, { method: 'PUT', headers: upload.headers, body: file });
// 3. Upscale it
const task = await fetch(`${api}/upscale`, {
method: 'POST',
headers: { ...auth, 'Content-Type': 'application/json' },
body: JSON.stringify({ video_url: upload.video_url, resolution: '1080p' }),
}).then((r) => r.json());import os, requests
api = "https://videoupscaler.co/api/v1"
auth = {"Authorization": f"Bearer {os.environ['VIDEOUPSCALER_API_KEY']}"}
path = "clip.mp4"
# 1. Get an upload URL
upload = requests.post(f"{api}/uploads", headers=auth,
json={"content_type": "video/mp4", "size": os.path.getsize(path)}).json()
# 2. Upload the file
with open(path, "rb") as f:
requests.put(upload["upload_url"], headers=upload["headers"], data=f).raise_for_status()
# 3. Upscale it
task = requests.post(f"{api}/upscale", headers=auth,
json={"video_url": upload["video_url"], "resolution": "1080p"}).json()Ein erfolgreiches PUT gibt 200 mit {"video_url": "…"} zurück.
Hinweise
- Das Anfordern einer Upload-URL ist kostenlos, setzt aber ein Guthaben von mindestens 1 Credit voraus.
- Hochgeladene Dateien werden nur für die Verarbeitung aufbewahrt und können nach 7 Tagen gelöscht werden.
Fehler
| Status | Code | Wann |
|---|---|---|
400 | invalid_request | Nicht unterstützter content_type, ungültige size, oder das PUT hat einen anderen Content-Type gesendet bzw. wurde abgebrochen |
403 | paid_plan_required | Das Konto hat noch nie Credits gekauft oder ein Abo abgeschlossen |
402 | insufficient_credits | Dein Credit-Guthaben ist leer |
403 | invalid_upload_token | Die Upload-URL ist ungültig oder abgelaufen (PUT) |
411 | invalid_request | Das PUT hatte keinen Body oder keine Content-Length |
413 | file_too_large | Die Datei ist größer als 100MB oder größer als die angegebene size |