ReferenceMarkdown
Uploads
A file on your machine goes into a generation as a link. POST /v1/uploads takes the file itself as the request body (no multipart), stores it with us and answers with a link to put in images, end_image, video or audio. It is free.
curl -s -X POST https://vidlab.ai/v1/uploads \
-H "Authorization: Bearer $VIDLAB_API_KEY" \
-H "Content-Type: image/png" \
-H "X-File-Name: presenter.png" \
--data-binary @presenter.pngimport os, requests
with open("presenter.png", "rb") as f:
r = requests.post(
"https://vidlab.ai/v1/uploads",
headers={
"Authorization": f"Bearer {os.environ['VIDLAB_API_KEY']}",
"Content-Type": "image/png",
"X-File-Name": "presenter.png",
},
data=f,
)
url = r.json()["data"]["url"]import { readFile } from "node:fs/promises";
const res = await fetch("https://vidlab.ai/v1/uploads", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VIDLAB_API_KEY}`,
"Content-Type": "image/png",
"X-File-Name": "presenter.png",
},
body: await readFile("presenter.png"),
});
const { url } = (await res.json()).data;{
"data": {
"url": "https://...",
"mime": "image/png",
"bytes": 48213,
"kind": "image",
"expires_at": "2026-11-09T12:00:00.000Z"
}
}| Part | What it is |
|---|---|
| Body | The file's bytes. |
Content-Type | The file's real type. It is checked against the file's first bytes. |
X-File-Name | Optional. Your own record of the name; it never becomes part of the link. |
url | The link to send in an input field. Works for about a week. |
kind | image, video or audio. |
Types and sizes
| Kind | Types | Largest upload |
|---|---|---|
| Image | JPEG, PNG, WEBP, GIF | 20 MB |
| Video | MP4, MOV, WEBM | 200 MB |
| Audio | MP3, WAV, M4A, OGG, WEBM | 50 MB |
- Files are deleted 7 days after the upload.
- A file that is not what its
Content-Typesays, or any other type (SVG and HTML included), is refused with415 unsupported_media_type. A file over its limit answers413 file_too_large. Too many uploads answers429(rate_limited, ordaily_upload_limitonce an account has used its daily share).
Other ways to send a file
- A public https link to a file you host anywhere that serves it without sign-in (a link that lives at least a few minutes). Largest: image 20 MB, video 500 MB, audio 50 MB. Media must download directly.
- A base64 data URL,
data:<type>;base64,<bytes>, for a small file. The whole request body can be at most 2 MB, and base64 makes a file a third bigger, so send anything larger as a link. - At most 24 files in one generation.
While the generation is queued, VidLab reads each file once, checks its type and size and measures every video and sound. The route gets VidLab's own short-lived copy, never your link, and the copy is deleted when the generation finishes. A file that cannot be used fails the generation before it reaches a route, so nothing is charged:
| Failure code | Why | Fix |
|---|---|---|
invalid_input | The link could not be downloaded or took too long (5 minutes), the file is over its kind's limit, it is empty, or it is not the kind of file the field takes. The message says which. | Send a public https link or upload the file, a smaller one if it was too large, and the right file type. |