The CalmLens CDN serves retained original files, displayable files, still previews, adaptive streams, embed pages and display info of assets from https://cdn.calmlens.com/v1. Each asset has one URL, and every resource is a path beneath it. Sign an asset URL with the public API to give an untrusted client time-limited access to a private asset.
The CDN serves each asset according to its current classification.moderation.decision: blocked and purged assets are not served, and age-restricted assets need viewerClaims.ageConfirmed: true, including requests with signed URLs or API keys; see Age-restricted assets. Delivery while moderation runs lists every delivery check, including pending content.
Authentication: public assets need no authentication. Private assets need a signed asset URL, or Download assets (assets:download) on the asset's folder, held by a signed-in portal user or by an API key sent in the X-Api-Key header. Signing an asset URL uses a project API key on https://api.calmlens.com/v1. See CDN authentication.
Viewer claims
The SDK accepts viewerClaims: { region: "GB", ageConfirmed: false }. Both fields are optional. Your platform confirms the viewer's age, and your app adds the claims to the URLs it builds (see Age-restricted assets). The CDN defaults ageConfirmed to false and infers the country from the connection reaching it. Through a proxy, explicitly forward the viewer country to avoid using the proxy's country.
For raw HTTP, send viewerClaims as a JSON-encoded query parameter or send the same JSON in X-CalmLens-Viewer-Claims. The query takes precedence. For example, ?viewerClaims=%7B%22region%22%3A%22GB%22%2C%22ageConfirmed%22%3Afalse%7D. Headers suit proxies and fetch clients; URL parameters also work in native browser media elements.
For each viewer, the CDN applies the strictest of the asset's own decision, the rule for the viewer's country and, for viewers in an EU member state, the EU rule unless your project turned the EU standard off. An asset whose outcome is the same everywhere needs no viewer region. An asset that hasn't been checked against a jurisdiction your project serves, such as the EU after you turn its standard back on, returns 403asset/regional-evidence-required to viewers there; see Existing assets and rollout.
Create a short-lived signed URL for a private asset, the base URL of all its CDN resources
CDN URL formats
All paths are relative to https://cdn.calmlens.com/v1. An asset's URL is /assets/{projectId}/{asset}, and each resource is a path beneath it, followed by any selector: /assets/{projectId}/{asset}/{resource}/{selectors}. {asset} is one of:
{asset}
Names
asset_…
The asset by its ID.
ext:{externalId}
The asset by its externalId, URL-encoded, such as ext:users%2F42%2Favatar.
sig_…
A signed asset URL's grant, for a private asset or for /original access.
Only content retained with processingOptions.retainContent: true can be served.
The asset's one displayable file, described by content.rendered: an image, a PDF, or browser-safe video or audio. Text and spreadsheets have none and return 404asset/no-rendered-version.
Any of these resources of a private asset, with any lens or transform, under a signed asset URL. /original is included only in a URL signed for it.
Every URL also answers HEAD requests, with the status and headers a GET would return and no body. What the CDN serves lists the rendered file and preview of each asset type.
Lens and transform selectors work on /preview and on /rendered when it serves an image. On /original, /embed and /info, on a rendered PDF, video or audio, or when a selector is malformed or names an unknown transform, they return 400transform/invalid. A known transform with invalid options returns 400transform-options/invalid, and a lens the project doesn't have returns 404lens/not-found. If the decoder rejects the source image as corrupt, the transform returns 422image/invalid. See Caching and availability for cache behaviour.
Use GET/assets/:projectId/:asset/original for the uploaded file's exact bytes, such as for downloads and processing. It is never re-encoded and takes no lens or transform.
Rendered assets
Use GET/assets/:projectId/:asset/rendered to display an asset in the element content.rendered.kind names. Without an explicit format, images are served as AVIF or WebP when the request's Accept header allows it, and otherwise in the source format; responses carry Vary: Accept. See Displaying images.
Rendered video and audio answer Range requests with 206 Partial Content and carry Accept-Ranges: bytes, so players can seek and stream them.
For named lenses, one-off transform selectors, and supported image options, see Lenses and transforms.
Previews
Use GET/assets/:projectId/:asset/preview for thumbnails, cards, posters and lists: it is always a still image, in the best format the browser accepts, whatever the asset's type. Without a size of its own, it scales down to fit within 400 × 400 pixels; a lens or transform that sets width or height replaces that size.
Adaptive streams
Adaptive streamsPreview
Use GET/assets/:projectId/:asset/hls/index.m3u8 to play audio or video with an HLS player once streaming has prepared it and content.hls.status is ready; until then it returns 404asset/no-rendered-version. The master playlist lists a media playlist for each rendition, and they list fragmented MP4 (CMAF) segments, all beneath /hls/. Playlists list their files by relative paths, so under a signed asset URL every file is requested beneath the same grant and players need only the master playlist's URL. Each playlist also carries the request's viewer claims on its files.
Stream files carry Access-Control-Allow-Origin: *, and segments answer Range requests. Segments are cached like other files; playlists carry the request's viewer claims, so only the viewer's browser keeps them. Each file passes the same delivery checks as the other resources. Lenses and transforms don't apply.
Embed pages
Embed pagesPreview
Use GET/assets/:projectId/:asset/embed as the src of an <iframe>: an HTML page that plays audio and video (the stream when the asset has one, the rendered file otherwise, with its poster or waveform) and shows other assets in the asset viewer for their type. Any site may frame it (frame-ancestors *), and it is sent with Cache-Control: private, no-store and Referrer-Policy: no-referrer. The files the page loads carry its viewer claims, use a grant that expires with the embed URL, and don't count as additional CDN reads. A delivery check that fails, an age-restricted asset without viewerClaims.ageConfirmed: true, and an asset with nothing to show yet each show a status message in the page instead of an error body; see Embed media in any site. The page takes no lens or transform.
Display info
Use GET/assets/:projectId/:asset/info to learn what to show before loading content: a JSON subset of the asset object, with the same field names, plus availability for the request's viewer claims. It holds the asset's id, projectId, type and externalUrl (a website's page, for a link to it), and from content its format (the uploaded MIME type, which tells a spreadsheet from other documents), width, height, durationSeconds, pageCount, rendered, preview and hls.
availability is available, age-restricted (until the viewer's age is confirmed with viewerClaims.ageConfirmed: true) or unavailable (held, blocked in the viewer's region, unmoderated or removed). It is decided by the same checks the CDN applies to the content, so the content resources refuse exactly what it reports as not available. The response never includes moderation results, metadata, names, tags or extracted text. On your server, client.cdn.getAssetInfo(assetUrl) reads it for an asset URL, public or signed, so a page can render the asset component with its info on the first request.
Display info is cached at the edge and withdrawn with the asset's other cached responses, carries Access-Control-Allow-Origin: *, and is not billed as a read. Display info for private, blocked or purged assets requires a signed asset URL or a session or API key with download permission. Age-restricted public assets can report their availability without authentication.
Placeholders
Show GET/assets/:projectId/:asset/placeholder in place of an age-restricted or blocked asset. A public asset's placeholder is served from its URL whatever the decision, so a page can show it in place of a blocked asset. A private asset's needs a signed asset URL or a session or API key with download permission. A purged asset has no placeholder. It is not served for assets whose content was removed, assets under a safety or copyright hold, assets without a preview, or viewers in a jurisdiction whose rules block the asset. Lenses and transforms do not apply; age confirmation is not required for the blurred placeholder.
CDN errors
Every CDN error has the same JSON body as an API error: code, message, requestId and, for some codes, details. The embed page shows a status message in its page instead. The exception is a 403 with the plain text body error code: 1010, which means the request's User-Agent was refused before it reached CalmLens: set one that names your app.
Status
Code
Description
400
viewer-claims/invalid
Supply valid viewer claims with an uppercase ISO country code and a boolean age confirmation. EU is a jurisdiction, not a viewer country.
403
viewer/age-confirmation-required
Your application must confirm the viewer passed its age check before requesting age-restricted content, including requests with API keys or signed URLs.
403
viewer/region-required
Regional controls apply but neither an explicit viewer country nor a usable connection country is available.
403
asset/regional-evidence-required
The asset was uploaded before the project served a jurisdiction whose rules its results don't cover, so it isn't delivered to viewers there. Existing assets aren't checked again; upload the content again to check it.
404
asset/not-found
No asset matches the URL, or the asset is private and the request has no grant, session or API key that may see it. Both answer alike, so a private asset's existence isn't revealed.
403
asset/not-available
The asset can't be delivered to this viewer: it is blocked or purged, under a safety or copyright hold, still uploading, not yet moderated in a project that holds unmoderated content, failed processing, blocked in the viewer's region, or its stored content was removed.
404
asset/no-rendered-version
The asset is deliverable but has no rendered version: a text asset, or a document or website whose page image isn't available. Request its original resource instead.
403
signed-url/expired
The signed asset URL's grant is valid but its expiry has passed. Sign a new asset URL on your server.
403
signed-url/invalid
The URL's `sig_…` grant wasn't signed by CalmLens for this project: it was changed after signing, or used under another project's URL. Use the signed asset URL exactly as returned, adding only resources, selectors and viewer claims.
403
signed-url/original-not-granted
The signed asset URL was signed for another resource, or for none, so it doesn't serve `/original`. Sign a URL with `resource: "original"` to serve the uploaded file.
403
auth/permission-denied
The API key lacks the Download assets (assets:download) permission for the asset's folder.
404
lens/not-found
The URL names a lens that doesn't exist in the project.
400
transform/invalid
The transform selector is malformed or names an unknown transform type.
400
transform-options/invalid
The transform options do not match the supported option schema.
404
request/route-not-found
The path names no CDN resource, such as a resource appended after the URL's query string instead of before it.
A private asset is checked for access before anything else about it, so a request without access gets 404asset/not-found whatever the asset's status, exactly as for an asset that doesn't exist. Your project's own API keys without Download assets get 403auth/permission-denied instead, after the other checks. A transform that fails to process returns 403asset/not-available with HTTP status 500, rather than the usual 403.
Transform errors
For an invalid option such as /rendered/width=-1, the CDN returns 400transform-options/invalid. Each entry in details.issues gives the option as a dotted field name, the validation rule, and a readable message. Fix the selector before retrying.
{ "code": "transform-options/invalid", "message": "One or more image transform options are invalid.", "requestId": "example-request-id", "details": { "issues": [ { "field": "width", "rule": "minimum", "message": "Must be at least 1." } ] }}
If the source cannot be decoded, the CDN returns 422image/invalid with details.retry: "never". Replace the source with a valid image. For a rejected PNG, the CDN can sometimes locate the damaged chunk. For example, a failed checksum in the image data produces a response like this:
{ "code": "image/invalid", "message": "The image is corrupt or cannot be decoded. Upload a valid image file.", "requestId": "example-request-id", "details": { "retry": "never", "format": "png", "reason": "chunk-checksum-mismatch", "chunkType": "IDAT", "byteOffset": 33 }}
An 422image/invalid error identifies the stored source format in details.format when known. When the CDN can inspect a failed source of up to 1 MiB, it reports a more specific reason if it can verify one. The available checks depend on the format.
details.reason
What to check
empty-source
The stored file has no bytes.
invalid-signature
The file does not start with the expected signature. Check the export format.
truncated-header
The header is incomplete. Check that the complete file was uploaded.
truncated-container
A file size or offset points beyond the end of the file.
truncated-chunk
A chunk, segment, box or directory ends before its declared data is complete.
chunk-checksum-mismatch
The chunk fails its integrity check. Re-export or restore the file from its source.
invalid-image-header
Header fields such as the dimensions or encoding settings are invalid.
invalid-chunk-length
A segment or box declares an invalid length.
invalid-chunk-order
The PNG's IHDR chunk is misplaced or repeated, or its IDAT chunks are out of sequence.
invalid-marker
A marker or block identifier is invalid at that position.
missing-image-data
The file has no image data or frames.
invalid-svg-root
The file could not be read as an SVG document.
invalid-compression-header
The compressed stream in the IDAT chunks has an invalid zlib header.
invalid-compressed-data
The PNG's compressed image data or its zlib checksum is invalid.
truncated-compressed-data
The PNG's compressed stream ends before decoding is complete.
missing-end-chunk
The file ends without an end marker or chunk.
invalid-end-chunk
The end marker or chunk is malformed.
unsupported-encoding
The imaging service does not support the encoding used for this transform.
header-decode-failed
The codec could not read the image header.
pixel-decode-failed
The codec read the header but could not decode the pixels.
truncated-image-data
The codec ran out of bytes before it finished reading the image.
invalid-jpeg-scan
The JPEG codec could not decode the compressed scan data.
invalid-webp-frame
The WebP codec could not decode the frame data.
codec-rejected-data
The codec rejected the image data. Check details.decoderMessage for the codec's explanation when available.
decode-failed
The decoder refused the input without a specific cause the CDN could verify.
When present, byteOffset counts from zero and points to the affected field, chunk, or end of the source file. The CDN includes chunkType when it can identify the affected chunk.
If the CDN pinpoints a defect and the codec reports a different reason, details.reason identifies the defect and details.decoderReason preserves the codec's reason. The codec can report a reason even when the source is too large for the CDN's byte inspection.
Images that exceed a processing limit return 422image/too-large. If the decoder times out or is unavailable, the CDN returns HTTP 503 with code image/decoder-unavailable, details.retry: "later", and the reason decode-timeout or decoder-unavailable. If another decoder declined the file before the retryable failure, details.decoderReason can report that earlier result.
Signed asset URLs
A private asset is delivered through a signed asset URL: its asset URL with a sig_… grant in place of the asset, such as https://cdn.calmlens.com/v1/assets/proj_…/sig_…. Sign one on your server with POST/projects/:projectId/signed-asset-urls, by asset ID or externalId, for the resource you need: the URL ends in it, and lenses, transforms and viewer claims are added as to a public asset's URL. The API key needs Share assets (assets:share) for the asset.
A grant is tied to the project, the asset, whether it was signed for /original, and its expiry, from 1 second to 24 hours (15 minutes by default). Under another project's URL it returns 403signed-url/invalid, as does a grant that was changed; once expired it returns 403signed-url/expired.
Only a URL signed for the original resource serves /original; under any other, it returns 403signed-url/original-not-granted. Every other resource is served beneath any signed URL's grant, so the asset component can load the resources it needs from one URL.
Lenses, transforms and selectors aren't part of the grant: add them to the URL as for a public asset, along with any viewer claims. Anyone holding the URL can request other image variants of the asset until it expires.
The signed asset URL object
SignedAssetUrl
url*string
The signed asset URL, ending in the resource it was signed for. Add a lens, transform or viewer claims as to a public asset's URL. Without a resource, append one yourself, such as /rendered, /preview, /hls/index.m3u8, /embed or /info; /original needs a URL signed for it.
expiresAt*number
When the URL expires, in milliseconds since the Unix epoch
Endpoint details
Sign Asset URL
Create a short-lived signed URL for a private asset, the base URL of all its CDN resources
Authentication required. Send your project API key in the X-Api-Key header.
401api-key/invalid
The API key is invalid, revoked or expired. Create a key under Developer → API Keys.
403api-key/project-mismatch
This API key belongs to a different project. Use a key created for the project that owns this resource.
403auth/permission-denied
This API key lacks a permission the request needs (details.permission names it, such as assets:download for an asset's folder, and details.role the least role that includes it), or the resource belongs to another project.
400validation/invalid-request
The request's parameters, query or body are invalid. details.issues lists each problem, with its path and issue code.
415request/unsupported-content-type
Send the request body as application/json.
404asset/not-found
Asset not found
423asset/held
The asset is held and this request can't change or deliver it. details.hold is `safety` for a safety hold or `copyright` for a copyright claim.
404project/not-found
Project not found
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.
Last updated
Signing in
Deleting account
Signing out
Cookies on CalmLens
We use essential cookies for sign-in and security. With your permission, functional cookies remember your preferences and Google Analytics measures website use and signups. Optional ad measurement cookies link Google ad clicks to signups. Personalised advertising stays off. Manage cookies