Vault for developers. One URL per file.
The URL grammar, the SDK and webhooks, from first upload to paid download.
URL shapes
Every file has a URL on a Vault delivery host. Images take one transformation component; video, posters, other files and download links have their own shapes. Square brackets are optional parts.
- Image
https://<media>/<library>/image/<delivery>/[s--<sig>--/][<transform>/][v<version>/]<public_id>[.<ext>] - Video stream
https://<video>/<library>/video/<delivery>/[s--<sig>--/][v<version>/]<public_id>.(m3u8|mp4) - Video poster
https://<media>/<library>/video/<delivery>/[s--<sig>--/][<transform>/][v<version>/]<public_id>.(jpg|png|webp|avif) - Any other file
https://<files|dl>/<library>/raw/<delivery>/[s--<sig>--/][fl_attachment[:<name>]/][v<version>/]<public_id>[.<ext>] - Download link
https://<dl>/<library>/dl/<link_id>/<filename>?sig=<sig>
| Part | Rule |
|---|---|
library | Your library's delivery name, for example acme-shop. |
delivery | upload for public files, private (every URL signed) or authenticated (signed and expiring). |
s--<sig>-- | A signature: one key-version character and 22 base64url characters. |
transform | One component of comma-separated key_value parameters, in canonical order. |
v<version> | A cache-buster. The current version is cached for a year as immutable. |
public_id | 1 to 10 segments joined by /, letters, digits, _ and -, no dots, 255 bytes at most. |
query | Only exp, tok and sig. Any other query parameter is refused, so caches stay clean. |
| Host | Example | Serves |
|---|---|---|
media | media.qooalcdn.com | Images, posters and sanitised SVG, always re-encoded. |
video | video.qooalcdn.com | HLS playlists and segments, MP4 fallbacks. |
files | files.qooalcdn.com | Every other file up to 10 MB, on a separate domain that never sets a cookie. |
dl | dl.qooalcdn.com | Larger files and download links, on the same separate domain. |
Host names are examples until launch.
Image parameters
A transformation is comma-separated key_value pairs. Write them in any order: the SDK and the delivery host use one canonical order, so each image has one cached URL.
| Key | What it does | Values | Rules | Example |
|---|---|---|---|---|
t | Named preset | t_<preset> | At most one. The library's preset expands first; parameters you add override it. | t_card |
c | Crop mode | scale (default), fit, limit, fill, pad, thumb, crop | limit never upscales. crop needs w, h, x and y. | c_fill,w_400,h_400 |
g | Gravity | auto, center, north, north_east, east, south_east, south, south_west, west, north_west | Only with fill, thumb, pad or crop. Default center; auto for thumb. | c_fill,g_auto,w_400,h_400 |
ar | Aspect ratio | <a>:<b>, integers 1 to 100 | Reduced by the greatest common divisor and folded into the missing side. Not with both w and h. | c_fill,ar_4:3 |
w | Width | 1 to 8192 | Output at most 8192 px a side and 50 MP in total. | w_640 |
h | Height | 1 to 8192 | Output at most 8192 px a side and 50 MP in total. | h_480 |
x | Crop x | 0 to 65535 | Only with c_crop. | c_crop,w_200,h_200,x_40,y_10 |
y | Crop y | 0 to 65535 | Only with c_crop. | c_crop,w_200,h_200,x_40,y_10 |
a | Rotate | 90, 180, 270 | EXIF orientation is always applied first. | a_90 |
e | Effect | grayscale, sharpen, blur:<1 to 100> | Repeatable: up to 3, each effect once. | e_grayscale |
b | Background | white (default), black, transparent, rgb:<6 hex> | Only with c_pad. | c_pad,w_400,h_400,b_rgb:f5f6fb |
q | Quality | auto (default), auto:low, auto:eco, auto:good, auto:best, 1 to 100 | auto picks a quality per output format. | q_auto:eco |
f | Format | auto, jpg, png, gif, webp, avif | auto serves AVIF or WebP when the browser accepts it. A fixed format becomes the extension. | f_auto |
fl | Flags | attachment[:<name>], progressive, animated, sanitize | Up to 3, each once. sanitize is for SVG files and stands alone. | fl_progressive |
dpr | Pixel ratio | 1, 1.5, 2, 3 | Needs w or h, which it multiplies, then it is dropped. Not with c_crop. | dpr_2,w_400 |
| You write | Canonical |
|---|---|
w_400,c_fill,h_300 | c_fill,w_400,h_300 |
c_scale,w_400,q_auto | w_400 |
dpr_2,w_400 | w_800 |
ar_16:9,w_1280 | w_1280,h_720 |
Errors
A URL the grammar refuses answers 400 with a problem document and one of these codes, so a broken link never turns into a new cached variant.
| Code | Meaning |
|---|---|
unknown_param | A key the grammar does not know. |
duplicate_param | A key given twice (e and fl may repeat, each value once). |
bad_value | A value outside the key's list or pattern. |
out_of_range | A number outside its range. |
conflicting_params | Parameters that cannot go together, such as ar with both w and h. |
too_many_components | More than one transformation component (chains come later). |
bad_public_id | A public ID outside the rules above. |
bad_extension | An extension the resource cannot have. |
bad_version | A version that is not v1 or more. |
bad_query | A query parameter other than exp, tok or sig. |
path_too_long | A path longer than 1,024 bytes. |
not_canonical | A signed URL whose transformation is not in canonical form. |
Quick starts
The @qooal/vault package: a URL builder that runs anywhere, an upload widget, React and Next.js components, and server helpers.
Build a URL
Anywhere: browser, server or edge. The output is always canonical.
import { srcSet, vaultUrl } from "@qooal/vault";
const lib = { urls: { media: "https://media.qooalcdn.com/acme-shop" } };
vaultUrl(lib, "products/mug-blue", {
transformation: "w_400,c_fill,g_auto,h_400,f_auto",
version: 3,
});
// https://media.qooalcdn.com/acme-shop/image/upload/c_fill,g_auto,w_400,h_400,f_auto/v3/products/mug-blue
srcSet(lib, "products/mug-blue", [320, 640, 960], {
transformation: "c_fill,g_auto,ar_1:1,f_auto",
});Let visitors upload
A ticket from your backend limits what a browser may upload.
// server: mint a short-lived upload ticket with your API key
import { createUploadTicket } from "@qooal/vault/server";
const { ticket } = await createUploadTicket(process.env.QOOAL_API_KEY!, "acme-shop", {
tags: ["review"],
allowedClasses: ["image", "video"],
maxBytes: 50_000_000,
});
// browser: upload with progress, resumable for large files
import { createUploader } from "@qooal/vault/upload";
const uploader = createUploader({ library: "acme-shop", ticket });Stream a video
Adaptive HLS with a poster from the same grammar.
import { VaultVideo } from "@qooal/vault/react";
<VaultVideo library="acme-shop" publicId="videos/mug-spin" controls />
// the playlist and poster it plays:
// https://video.qooalcdn.com/acme-shop/video/upload/v2/videos/mug-spin.m3u8
// https://media.qooalcdn.com/acme-shop/video/upload/w_1280/v2/videos/mug-spin.jpgSell a download
Mint a link when an order is paid. It expires and counts downloads.
import { createDownloadLink } from "@qooal/vault/server";
const { url } = await createDownloadLink(process.env.QOOAL_API_KEY!, "acme-shop", {
asset: "downloads/glaze-patterns",
expiresInSeconds: 7 * 24 * 3600,
maxDownloads: 5,
label: "Order 1042",
});
// email `url` to the buyerWebhooks
Add an endpoint per library in the console. Each event is a signed POST in the Standard Webhooks format, retried for about three days until your endpoint answers with a 2xx.
| Event | Sent when |
|---|---|
vault.asset.created | An upload starts and the file has an ID. |
vault.asset.ready | The file is processed and can be delivered. |
vault.asset.failed | Processing failed; the payload says why. |
vault.asset.updated | Tags, folder, access or metadata changed. |
vault.asset.deleted | The file was deleted. |
vault.asset.infected | Malware scanning flagged the file. |
vault.quota.warning | A meter passed 80% of the package. |
vault.quota.reached | A meter reached 100% of the package. |
POST /hooks/vault HTTP/1.1
content-type: application/json
user-agent: Qooal-Vault-Webhooks/1
webhook-id: vevt_01jexample0000000000000000
webhook-timestamp: 1767225600
webhook-signature: v1,<base64 HMAC-SHA-256 of id.timestamp.body>
{
"type": "vault.asset.ready",
"timestamp": "2026-12-01T00:00:00Z",
"data": {
"libraryId": "vlib_01jexample0000000000000000",
"librarySlug": "acme-shop",
"asset": { "id": "vast_acme_0001", "publicId": "products/mug-blue", "version": 3 }
}
}import { verifyWebhook } from "@qooal/vault/server";
export async function POST(req: Request) {
const body = await req.text();
const event = await verifyWebhook(body, req.headers, process.env.VAULT_WEBHOOK_SECRET!);
// throws on a bad signature or an old timestamp
if (event.type === "vault.asset.ready") {
// mark the product photo as ready
}
return new Response(null, { status: 204 });
}REST API
Libraries, folders, files, uploads, presets and download links are resources in the Qooal API, with scoped API keys. Read the API reference preview for the conventions every product shares.
