Folders API reference

Folders organize assets hierarchically within a project without changing asset IDs or CDN URLs. Folders and assets are always addressed by ID; names are display values, unique among siblings.

Guide: Organising assets.

Endpoints

EndpointDescription
GET /projects/:projectId/foldersList a page of child folders, or search them by name.
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

The folder object

Folder
idstring
Unique folder ID
projectIdstring
ID of the project that owns the folder
namestring
Display name, unique among folders with the same parent. 1 to 100 characters, without slashes.
createdAtnumber
When the folder was created, in milliseconds since the Unix epoch
parentIdstring (optional)
ID of the parent folder; null for folders at the project root
updatedAtnumber (optional)
When the folder was last updated, in milliseconds since the Unix epoch

Endpoint details

List Folders

List a page of child folders, or search them by name. The default is the first page of folders at the project root.

OpenAPI YAML
GET
https://api.calmlens.com/v1/projects/
/folders
const response = await client.folders.list({
  "parentId": "fldr_7Nc4Wq2Lm8Xt5Rk9Bv3P",
  "sort": "name"
});

Query Parameters

Edit any value to update the generated request examples.

number
string (optional)
string (optional)
The previous page’s nextCursor; omit for the first page
string (optional)
Sort order: a field from name, createdAt, each ascending unless prefixed with -. The default is name.
string (optional)

Response


Error Codes

401api-key/missing
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
404folder/not-found
Folder 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 Folder

Create an asset folder with an optional parent folder ID

OpenAPI YAML
POST
https://api.calmlens.com/v1/projects/
/folders
const response = await client.folders.create({
  "name": "example"
});

Request Body

Edit any value to update the generated request examples.

string
string (optional)

Response


Error Codes

401api-key/missing
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
404folder/not-found
Folder not found
409folder/duplicate-name
A folder with this name already exists in this location.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.

Get Folder

Get an asset folder by ID

OpenAPI YAML
GET
https://api.calmlens.com/v1/folders/
const response = await client.folders.retrieve({
  "folderId": "fldr_7Nc4Wq2Lm8Xt5Rk9Bv3P"
});

Response


Error Codes

401api-key/missing
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
404folder/not-found
Folder not found
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.

Update Folder

Rename an asset folder

OpenAPI YAML
PATCH
https://api.calmlens.com/v1/folders/
const response = await client.folders.update({
  "folderId": "fldr_7Nc4Wq2Lm8Xt5Rk9Bv3P"
});

Request Body

Edit any value to update the generated request examples.

string (optional)

Response


Error Codes

401api-key/missing
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
404folder/not-found
Folder not found
409folder/duplicate-name
A folder with this name already exists in this location.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.

Delete Folder

Delete an empty asset folder by ID

OpenAPI YAML
DELETE
https://api.calmlens.com/v1/folders/
const response = await client.folders.delete({
  "folderId": "fldr_7Nc4Wq2Lm8Xt5Rk9Bv3P"
});

Error Codes

401api-key/missing
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
404folder/not-found
Folder not found
409folder/not-empty
Folder must be empty before it can be deleted.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.

Move Folder

Move a folder under another folder, or to the project root. Needs the Manage project permission (project:manage), which administrators hold, because moving a folder changes who can access everything inside it.

OpenAPI YAML
POST
https://api.calmlens.com/v1/folders/
/move
const response = await client.folders.move({
  "folderId": "fldr_7Nc4Wq2Lm8Xt5Rk9Bv3P",
  "parentId": null
});

Request Body

Edit any value to update the generated request examples.

string (optional)

Response


Error Codes

401api-key/missing
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.
404folder/not-found
Folder not found
409folder/duplicate-name
A folder with this name already exists in this location.
409folder/parent-cycle
A folder cannot be moved inside itself or one of its descendants.
500server/internal-error
An internal error occurred. Retry later, and quote requestId to support.

Move Asset

Move an asset into a folder, or to the project root

OpenAPI YAML
POST
https://api.calmlens.com/v1/assets/
/move
const response = await client.assets.move({
  "assetId": "asset_5Gm2Rk8XqT3wLp9VbN4c",
  "folderId": null
});

Request Body

Edit any value to update the generated request examples.

string (optional)

Response


Error Codes

401api-key/missing
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.
404asset/not-found
Asset not found
500asset/update-failed
Failed to update asset
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.
404folder/not-found
Folder not found
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