Use the REST API to moderate content, read decisions, organise assets and create CDN links. Endpoint cards include parameters, schemas, errors and code samples. For integration steps, start with the quick start or moderation guide.
Base URLs
Service
Base URL
REST API
https://api.calmlens.com/v1
CDN
https://cdn.calmlens.com/v1
MCP server
https://api.calmlens.com/mcp
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. AI assistants reach the same endpoints as tools through the MCP server; see MCP and OAuth.
Authentication
Authenticate project API requests with a project API key in the X-Api-Key header:
X-Api-Key: your-api-key
The GEThealth check needs no authentication. Upload-preset endpoints use an upload token instead, or accept uploads without a token when the preset is open to anyone.
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 IDs. Each ID is a prefix for its type, an underscore and letters and digits, such as proj_8fK2mQx7Lp4NvB3tRz9Y for a project, asset_e5Gm2Rk8XqT3wLp9VbN4 for an asset and evt_7Lm3Xq8Rk2Vt9Wb4Np5C for an event. Treat IDs as opaque, case-sensitive strings: store them whole, don't parse them and don't rely on their length. Assets can also carry your own externalId, which the CDN accepts in place of the asset ID.
Pagination. Every list takes an optional cursor and a pageSize from 1 to 100 (default 50), and returns items, nextCursor and hasMore. Pass nextCursor as the next request’s cursor until hasMore is false. Lists that can be sorted take sort, a comma-separated list of fields, each descending when prefixed with -, such as -createdAt,id. The events feed always returns a nextCursor to keep for later events, and search returns its best matches without a cursor. See Pagination.
Filtering. The asset list accepts an RSQL-style filter. See Asset filters.
Query values. List-valued query parameters are comma-separated, such as types=asset.blocked,asset.purged, and structured ones are URL-encoded JSON. See Query values.
Errors. Failed requests return an HTTP error status with a JSON body of code, message, requestId and details. 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, and error bodies repeat it as requestId. Include it when you contact support about a request.
Idempotency. Asset uploads, upload parts, decisions and hash list entries 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. An organisation can start up to 100 uploads every 10 seconds; see Upload rate. Throttled requests return 429 with a Retry-After header. Running out of free uploads returns 403usage/free-uploads-exhausted, and oversized files return 413upload/too-large.
SDKs. The CalmLens SDKs wrap these endpoints, handle authentication and uploads, and return typed errors.
Compatibility
The /v1 API changes only in ways that keep working integrations working. Build your client to accept these additions, which can arrive at any time without a new version:
new endpoints, and new optional query parameters, body fields and headers;
new properties in response bodies, webhook bodies and nested objects;
new values in response enums, such as statuses, asset types, categories and removal reasons;
new event types and event facts;
new error codes on any endpoint, so handle a code you don't recognise by its HTTP status.
Within /v1, CalmLens doesn't remove or rename endpoints, fields or enum values, change a field's type, make an optional input required or change what an existing code means. A change like that comes with a new major version, such as /v2, which runs alongside /v1.
When something in /v1 is deprecated, the changelog and the endpoint's reference say so and name its replacement, and it keeps working for at least 12 months. Message text, ID lengths and the order of object properties aren't part of the contract.
Preview features
Endpoints and fields marked Preview in this reference and in the OpenAPI document (x-calmlens-preview) are outside this promise: they can change or be removed without a deprecation period while their design settles.
Switch automatic updates on or off for one of the organisation's own preset policies: on turns a pinned policy live, so it always has the latest preset settings, and off pins a live policy at its current preset release.
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