Skip to main content

Endpoint

Auth: API Key, session, or a presigned signature from Sign Upload Content-Type: multipart/form-data

Form fields

file[]
required
One or more files to upload. Each file is validated for type and size.Allowed types: JPEG, PNG, WebP, AVIF, GIF, HEIC/HEIF, PSD, MP4, MOV, WebM, WAV, MP3, OGG, GLB, glTFMax size per file: Configurable via MAX_FILE_SIZE_MB (default: 50 MB)
HEIC/HEIF files are transcoded to JPEG on upload. The returned filename, path, and url will have a .jpg extension instead of the original .heic/.heif.
Content is checked, not just the extension. The first bytes of each file must match the format it claims to be, so a .jpg holding an HTML document or a .glb holding an arbitrary binary is rejected here rather than stored. A mismatch fails that one file with File content does not match its .jpg type and the rest of the batch still uploads.This matters because delivery serves stored bytes as they are, with nosniff and no content sniffing. Upload is where the type is decided, which is why it is strict.
string
Destination folder path within storage. Nested folders are supported.photos · uploads/2024/januaryIf omitted, files are stored at the root.
string[]
Custom filenames for each uploaded file, in the same order as files. If omitted, the original filename is used.Must include the file extension.
string[]
Transformation segments to prewarm (pre-generate and cache) immediately after upload. Supports up to 20 variants.w_800,h_600,c_fill · w_400,f_webp,q_85Pre-warming ensures the first user request is served from cache without any processing delay.

Response

200, All files uploaded successfully 207, Partial success (some files failed) 400, Validation error (invalid type, size exceeded, etc.) A fully successful upload returns only success and files. There is no errors key, and the optional per-file arrays appear only when they have something in them:
boolean
true if at least one file was processed. On a 207 this is still true, so check errors rather than success to detect partial failure.
array
Successfully uploaded files.
array
Files that failed to upload. Present only on a 207 or a 400.

Examples

Create Folder

Create an empty folder in storage.

Upload & Cache Warming

Prewarm strategy guide.

Delete File

Remove a file and its cached variants.

Sign Upload

Let an untrusted client upload without your API key.