Use a project API key to list, create, update and delete the project's lenses. The ensure endpoint creates or updates lenses by identifier and returns an unchanged lens as it is, so you can run it on every deploy; the other endpoints address one lens by ID. The built-in lenses (thumbnail, sm, md, lg, xl and 2xl) are reserved identifiers that every project already has; creating a lens with one returns 409lens/identifier-reserved.
Name used in CDN URLs after @. Lowercase letters, numbers and hyphens, at most 50 characters.
name*string
Display name
type*LensType
Asset type the lens applies to
Allowed values
imagevideoaudiodocumentwebsite
active*boolean
Whether the CDN serves the lens
createdAt*number
When the lens was created, in milliseconds since the Unix epoch
projectIdstring (optional)
ID of the project that owns the lens; null for built-in lenses
descriptionstring (optional)
Optional description of what the lens produces
transformrecord (optional)
Image transform options, such as width and format, applied in one pass to produce the derived asset
updatedAtnumber (optional)
When the lens was last updated, in milliseconds since the Unix epoch
Endpoint details
Ensure Lenses
Create each lens, or change it to the definition sent, by identifier. An unchanged lens is returned as it is, so applications can send their lenses every time they start.
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), 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.
409lens/identifier-reserved
The identifier belongs to a built-in lens (thumbnail, sm, md, lg, xl or 2xl). Give the lens another identifier.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.
List Lenses
List a page of the project's lenses, newest first. The built-in lenses are always available and aren't listed.
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), 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.
404project/not-found
Project not found
400cursor/invalid
The cursor is invalid or belongs to a different query.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.
Create Lens
Create a lens. Its identifier must be new to the project.
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), 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.
404project/not-found
Project not found
409lens/identifier-reserved
The identifier belongs to a built-in lens (thumbnail, sm, md, lg, xl or 2xl). Give the lens another identifier.
409lens/identifier-taken
The project already has a lens with this identifier. Update that lens, or give this one another identifier.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.
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), 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.
404lens/not-found
Lens not found. Check the lens ID or identifier in the portal.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.
Update Lens
Change a lens's name, description, type, transform or whether the CDN serves it. The CDN serves the new transform from then on.
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), 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.
404lens/not-found
Lens not found. Check the lens ID or identifier in the portal.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.
Delete Lens
Delete a lens. URLs that select it stop being served; files the CDN already delivered may stay in caches until they expire.
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), 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.
404lens/not-found
Lens not found. Check the lens ID or identifier in the portal.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.
Last updated
Signing in
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