API reference

The CalmLens REST API lets your server upload content for moderation, read decisions, organize assets and create CDN links. Each reference page lists its endpoints, describes the objects they return, and gives every endpoint a card with parameters, request and response schemas, error codes and code samples. For walkthroughs, start with the Quick start or a guide.

Base URLs

ServiceBase URL
REST APIhttps://api.calmlens.com/v1
CDNhttps://cdn.calmlens.com/v1

Request and response bodies are JSON unless an endpoint says otherwise, and timestamps are milliseconds since the Unix epoch. The full API is also available as an OpenAPI document.

Authentication

Authenticate every request, except the health check, with a project API key in the X-Api-Key header:

X-Api-Key: your-api-key

Keep API keys on your server. Do not expose them in browser code or public client bundles. Each key belongs to one project and grants only the permissions you choose when you create it; see Authentication. Browsers and other untrusted clients should load private assets through signed URLs.

Conventions

  • IDs. Resources are addressed by their UUIDs. Assets can also carry your own externalId, which the CDN accepts in place of the asset ID.
  • Pagination. List endpoints take a zero-based pageIndex and a pageSize from 1 to 100, and return items, total and hasMore. The events feed uses a cursor instead. See Pagination.
  • Filtering. The asset list accepts an RSQL-style filter. See Asset filters.
  • Errors. Failed requests return an HTTP error status with a JSON body of code, message and traceId. Handle errors by code; each endpoint card lists the codes it can return. See Error handling.
  • Request IDs. Every response carries an X-Request-Id header. Include it when you contact support about a request.
  • Idempotency. Upload and create requests accept an Idempotency-Key header, so a retry after a timeout returns the first response instead of creating a second asset. See Retrying requests safely.
  • Rate limits. CalmLens does not publish a general requests-per-second limit. Throttled requests return 429 with a Retry-After header. Upload allowances and file-size limits return their own upload/* errors.
  • SDKs. The JavaScript, Python Go, Rust, Ruby and Java SDKs wrap these endpoints, handle authentication and uploads, and return typed errors.

All endpoints

Assets

EndpointDescription
Upload
POST /projects/:projectId/assetsUpload a new asset to a project.
POST /projects/:projectId/assets/uploadUpload a file by sending its raw bytes as the request body, with the X-CalmLens-Upload: content header and the file's Content-Type.
POST /projects/:projectId/assets/multipart-uploadStart a multipart upload by streaming the first part's raw bytes as the request body, with the X-CalmLens-Upload: part header and the file's Content-Type.
POST /assets/:assetId/partUpload a sequential part for an in-progress asset upload.
Read and review
GET /projects/:projectId/assets/pageGet a paginated list of assets for a project
GET /projects/:projectId/assets/searchSearch accessible assets by keyword or describe an image in natural language.
GET /assets/:assetIdGet a single asset by ID
GET /assets/:assetId/childrenGet child assets of a parent asset
POST /assets/:assetId/retryProcess an asset that failed (status error) again.
Organise
PATCH /assets/:assetIdUpdate an existing asset
POST /assets/:assetId/moveMove an asset into a folder, or to the project root
Remove and batch
DELETE /assets/:assetId/contentRemove stored content, including the content derived from it in child assets, while retaining the asset records
DELETE /assets/:assetIdDelete an asset, its child assets and their stored content from a project
POST /projects/:projectId/assets/batchQueue a bounded batch operation for selected assets

Folders

EndpointDescription
GET /projects/:projectId/foldersList all asset folders in a project
POST /projects/:projectId/foldersCreate an asset folder with an optional parent folder ID
GET /folders/:folderIdGet an asset folder by ID
PATCH /folders/:folderIdRename an asset folder
DELETE /folders/:folderIdDelete an empty asset folder by ID
POST /folders/:folderId/moveMove a folder under another folder, or to the project root
POST /assets/:assetId/moveMove an asset into a folder, or to the project root

Lenses

EndpointDescription
PUT /lenses/:lensIdentifierCreate a lens or update it with a version greater than the current version
PUT /projects/:projectId/lensesCreate lenses or update them with their next versions

CDN

EndpointDescription
POST /assets/:assetId/signed-urlCreate a short-lived signed CDN URL for an asset

Events

EndpointDescription
GET /projects/:projectId/eventsList project events, oldest first, after a cursor.

Health check

EndpointDescription
GET /health-checkCheck whether the public API worker is responding

Signing in

Signing out

Cookies on CalmLens

We use essential cookies to keep you signed in and the site secure. With your permission, we'll also use functional cookies to remember preferences such as your layout and documentation language, and to offer Google One Tap sign-in. We don't use analytics or advertising cookies. Manage cookies