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/uploads

Anfrage

FeldTypPflichtBeschreibung
content_typestringJavideo/mp4, video/quicktime oder video/webm
sizeintegerJaDateigröß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"
}
FeldBeschreibung
upload_urlHierhin sendest du die Datei per PUT. Ein Authorization-Header ist nicht nötig – die URL selbst ist die Berechtigung.
headersSende 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_bytesDer Upload wird abgelehnt, wenn die Datei größer ist als die angegebene size.
expires_atDie 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

StatusCodeWann
400invalid_requestNicht unterstützter content_type, ungültige size, oder das PUT hat einen anderen Content-Type gesendet bzw. wurde abgebrochen
403paid_plan_requiredDas Konto hat noch nie Credits gekauft oder ein Abo abgeschlossen
402insufficient_creditsDein Credit-Guthaben ist leer
403invalid_upload_tokenDie Upload-URL ist ungültig oder abgelaufen (PUT)
411invalid_requestDas PUT hatte keinen Body oder keine Content-Length
413file_too_largeDie Datei ist größer als 100MB oder größer als die angegebene size