Skip to content

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.

  • Imagehttps://<media>/<library>/image/<delivery>/[s--<sig>--/][<transform>/][v<version>/]<public_id>[.<ext>]
  • Video streamhttps://<video>/<library>/video/<delivery>/[s--<sig>--/][v<version>/]<public_id>.(m3u8|mp4)
  • Video posterhttps://<media>/<library>/video/<delivery>/[s--<sig>--/][<transform>/][v<version>/]<public_id>.(jpg|png|webp|avif)
  • Any other filehttps://<files|dl>/<library>/raw/<delivery>/[s--<sig>--/][fl_attachment[:<name>]/][v<version>/]<public_id>[.<ext>]
  • Download linkhttps://<dl>/<library>/dl/<link_id>/<filename>?sig=<sig>
The parts of a delivery URL
PartRule
libraryYour library's delivery name, for example acme-shop.
deliveryupload for public files, private (every URL signed) or authenticated (signed and expiring).
s--<sig>--A signature: one key-version character and 22 base64url characters.
transformOne 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_id1 to 10 segments joined by /, letters, digits, _ and -, no dots, 255 bytes at most.
queryOnly exp, tok and sig. Any other query parameter is refused, so caches stay clean.
Delivery hosts
HostExampleServes
mediamedia.qooalcdn.comImages, posters and sanitised SVG, always re-encoded.
videovideo.qooalcdn.comHLS playlists and segments, MP4 fallbacks.
filesfiles.qooalcdn.comEvery other file up to 10 MB, on a separate domain that never sets a cookie.
dldl.qooalcdn.comLarger 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.

Image transformation parameters
KeyWhat it doesValuesRulesExample
tNamed presett_<preset>At most one. The library's preset expands first; parameters you add override it.t_card
cCrop modescale (default), fit, limit, fill, pad, thumb, croplimit never upscales. crop needs w, h, x and y.c_fill,w_400,h_400
gGravityauto, center, north, north_east, east, south_east, south, south_west, west, north_westOnly with fill, thumb, pad or crop. Default center; auto for thumb.c_fill,g_auto,w_400,h_400
arAspect ratio<a>:<b>, integers 1 to 100Reduced by the greatest common divisor and folded into the missing side. Not with both w and h.c_fill,ar_4:3
wWidth1 to 8192Output at most 8192 px a side and 50 MP in total.w_640
hHeight1 to 8192Output at most 8192 px a side and 50 MP in total.h_480
xCrop x0 to 65535Only with c_crop.c_crop,w_200,h_200,x_40,y_10
yCrop y0 to 65535Only with c_crop.c_crop,w_200,h_200,x_40,y_10
aRotate90, 180, 270EXIF orientation is always applied first.a_90
eEffectgrayscale, sharpen, blur:<1 to 100>Repeatable: up to 3, each effect once.e_grayscale
bBackgroundwhite (default), black, transparent, rgb:<6 hex>Only with c_pad.c_pad,w_400,h_400,b_rgb:f5f6fb
qQualityauto (default), auto:low, auto:eco, auto:good, auto:best, 1 to 100auto picks a quality per output format.q_auto:eco
fFormatauto, jpg, png, gif, webp, avifauto serves AVIF or WebP when the browser accepts it. A fixed format becomes the extension.f_auto
flFlagsattachment[:<name>], progressive, animated, sanitizeUp to 3, each once. sanitize is for SVG files and stands alone.fl_progressive
dprPixel ratio1, 1.5, 2, 3Needs w or h, which it multiplies, then it is dropped. Not with c_crop.dpr_2,w_400
What you write and the canonical form
You writeCanonical
w_400,c_fill,h_300c_fill,w_400,h_300
c_scale,w_400,q_autow_400
dpr_2,w_400w_800
ar_16:9,w_1280w_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.

Grammar error codes
CodeMeaning
unknown_paramA key the grammar does not know.
duplicate_paramA key given twice (e and fl may repeat, each value once).
bad_valueA value outside the key's list or pattern.
out_of_rangeA number outside its range.
conflicting_paramsParameters that cannot go together, such as ar with both w and h.
too_many_componentsMore than one transformation component (chains come later).
bad_public_idA public ID outside the rules above.
bad_extensionAn extension the resource cannot have.
bad_versionA version that is not v1 or more.
bad_queryA query parameter other than exp, tok or sig.
path_too_longA path longer than 1,024 bytes.
not_canonicalA 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.

url.ts
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.

upload.ts
// 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.

video.tsx
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.jpg

Sell a download

Mint a link when an order is paid. It expires and counts downloads.

order-paid.ts
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 buyer

Webhooks

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.

Webhook events
EventSent when
vault.asset.createdAn upload starts and the file has an ID.
vault.asset.readyThe file is processed and can be delivered.
vault.asset.failedProcessing failed; the payload says why.
vault.asset.updatedTags, folder, access or metadata changed.
vault.asset.deletedThe file was deleted.
vault.asset.infectedMalware scanning flagged the file.
vault.quota.warningA meter passed 80% of the package.
vault.quota.reachedA meter reached 100% of the package.
POST to your endpoint
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 }
  }
}
verify.ts
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.

Every file, one URL away.