smartFolder¶
Smart folder operations read, create, edit, delete and evaluate saved query language views. Smart folders form a hierarchy via parentId: a child smart folder's query narrows its ancestors' queries, while a parent smart folder with an empty query acts as a union of its subfolders' queries. Smart folders also support groupBy to generate live virtual subfolders grouped by a built-in property or custom field.
Every operation in this namespace targets a single library (see Choose a library or window).
| Operation | HTTP Endpoint | Permission | MCP Tool | Summary |
|---|---|---|---|---|
smartFolder.list |
POST /api/v1/smartFolder/list |
metadata.read |
smartFolder_list |
List all smart folders with their queries and grouping settings. |
smartFolder.get |
POST /api/v1/smartFolder/get |
metadata.read |
smartFolder_get |
Fetch one smart folder with its live item count. |
smartFolder.create |
POST /api/v1/smartFolder/create |
organize |
smartFolder_create |
Create a smart folder from a query, optional parent and optional groupBy. |
smartFolder.update |
POST /api/v1/smartFolder/update |
organize |
smartFolder_update |
Update a smart folder's name, query, icon or groupBy. |
smartFolder.delete |
POST /api/v1/smartFolder/delete |
organize |
smartFolder_delete |
Delete a smart folder and its child smart folders. |
smartFolder.items |
POST /api/v1/smartFolder/items |
metadata.read |
smartFolder_items |
Paginate the items matched by a smart folder. |
smartFolder.list¶
Returns every smart folder in the library as a flat array ordered by sortOrder and case-insensitive name. For fast listing, count is always null on entries returned by smartFolder.list; call smartFolder.get when you need the evaluated item count.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
library |
string |
No | Active window's library | Library ID from library.list, folder path or library name. |
Returns
SmartFolder[] — flat array of smart folder objects (count is null; groupBy is string | null).
Example request
Example response
[
{
"id": 1,
"name": "Top Rated Pictures",
"query": "kind = image AND rating >= 4",
"sort": null,
"icon": "star",
"groupBy": "year:added",
"parentId": null,
"sortOrder": 1,
"count": null
}
]
Events and errors
- Events emitted: None (read-only). Subscribe to
smartFolders.changedto detect changes. - Errors:
unauthorized,not_allowed(missingmetadata.read),unknown_library,library_offline. - Related:
smartFolder.get,smartFolder.create.
smartFolder.get¶
Returns a single smart folder with its live evaluated count populated. Because Curio evaluates the smart folder's full ancestor chain (or subfolder union when its query is blank), count reflects the exact number of items smartFolder.items returns.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
number |
Yes | — | Integer smart folder ID. |
library |
string |
No | Active window's library | Library ID from library.list, folder path or library name. |
Returns
SmartFolder — smart folder record with count populated as a number (or null if the stored query failed to compile).
Example request
Example response
{
"id": 1,
"name": "Top Rated Pictures",
"query": "kind = image AND rating >= 4",
"sort": null,
"icon": "star",
"groupBy": "year:added",
"parentId": null,
"sortOrder": 1,
"count": 124
}
Events and errors
- Events emitted: None (read-only).
- Errors:
not_found(There is no smart folder <id>),bad_request(missing or non-integerid),not_allowed(missingmetadata.read). - Related:
smartFolder.list,smartFolder.items.
smartFolder.create¶
Creates a new smart folder from a query language expression. The query is compiled and validated against the library's field catalog before writing; an empty string "" is valid and acts as a group container that unions its child smart folders (or matches nothing if it has no children).
When parentId is provided, the new smart folder is nested inside that parent and narrows the parent's query with logical AND. When groupBy is set, Curio displays up to 200 live virtual subfolders beneath the smart folder in the sidebar, grouped by the chosen property or custom field:
- Date buckets:
year:added,month:added,year:created,month:created,year:modified,month:modified - Built-in properties:
rating,kind,ext,tag - Custom fields:
field:<key>(for examplefield:genreorfield:model)
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string |
Yes | — | Smart folder name; trimmed, must not be blank. |
query |
string |
Yes | — | Query language expression (may be "" for a grouping container); validated before saving. |
parentId |
number |
No | null |
Parent smart folder ID to narrow; omit or pass null for top level. |
groupBy |
string |
No | null |
Virtual subfolder grouping key (year:added, month:added, year:created, month:created, year:modified, month:modified, rating, kind, ext, tag or field:<key>). Blank strings are stored as null. |
library |
string |
No | Active window's library | Library ID from library.list, folder path or library name. |
Returns
{ success: true; id: number }
| Field | Type | Description |
|---|---|---|
success |
true |
Confirms the smart folder was created. |
id |
number |
Integer ID of the newly created smart folder. |
Example request
Example response
Events and errors
- Events emitted:
smartFolders.changed. - Errors:
bad_request(invalid query syntax, unknown field in query or blankname),not_allowed(missingorganize),failed(nonexistentparentIdor database error). - Related:
query.validate,smartFolder.update.
smartFolder.update¶
Updates a smart folder's name, query, icon or groupBy. Omitted properties keep their existing values. If query is provided, it is validated against the field catalog before writing. Passing an empty string "" for icon or groupBy clears that property to null.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
number |
Yes | — | Smart folder ID to update. |
name |
string |
No | Unchanged | New name; trimmed, must not be blank when provided. |
query |
string |
No | Unchanged | New query expression; validated before saving. |
icon |
string |
No | Unchanged | Tabler icon name; pass "" to clear. |
groupBy |
string |
No | Unchanged | Virtual subfolder grouping key (see smartFolder.create); pass "" to clear. |
library |
string |
No | Active window's library | Library ID from library.list, folder path or library name. |
Returns
Done — { success: true }.
Example request
Example response
Events and errors
- Events emitted:
smartFolders.changed. - Errors:
bad_request(invalidqueryor blankname),failed(smart folderidnot found when updatingname,queryorgroupBy),not_allowed(missingorganize). - Related:
smartFolder.create,smartFolder.get.
smartFolder.delete¶
Deletes a smart folder and all of its descendant smart folders recursively. Because smart folders are saved queries rather than item containers, no items are modified or moved to Trash.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
number |
Yes | — | Smart folder ID to delete. |
library |
string |
No | Active window's library | Library ID from library.list, folder path or library name. |
Returns
Done — { success: true }.
Example request
Example response
Events and errors
- Events emitted:
smartFolders.changed. - Errors:
bad_request(missing or invalidid),not_allowed(missingorganize),failed(database error). - Related:
smartFolder.list,smartFolder.create.
smartFolder.items¶
Evaluates a smart folder's query (including any ancestor smart folders' queries, or the union of its child smart folders if its own query is empty) and returns a paginated slice of matching items in the library's default sort order (newest imported first). Items include their filesystem path only when the caller also holds files.read.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
number |
Yes | — | Smart folder ID to evaluate. |
offset |
number |
No | 0 |
Zero-based starting index into the matched items. |
limit |
number |
No | 50 |
Maximum items to return; clamped to 1000. |
library |
string |
No | Active window's library | Library ID from library.list, folder path or library name. |
Returns
Page<Item> — paginated list of Item objects.
Example request
Example response
{
"total": 124,
"offset": 0,
"items": [
{
"id": "8e1d7f4e-9b25-4c0f-a824-1b7e6b21a301",
"name": "Studio Key Light",
"fileName": "studio_key_light.png",
"ext": "png",
"kind": "image",
"size": 1842910,
"width": 2048,
"height": 1365,
"duration": null,
"rating": 5,
"favorite": false,
"explicit": false,
"annotation": "Warm bounce fill on left",
"url": "",
"tags": ["reference", "lighting"],
"folders": [{"id": 2, "name": "Lighting"}],
"status": "Available",
"imported": 1732401500000,
"modified": 1732399000000,
"parts": 0
}
]
}
Events and errors
- Events emitted: None (read-only).
- Errors:
bad_request(missingidor invalid stored query),not_allowed(missingmetadata.read),unknown_library,library_offline. - Related:
smartFolder.get,item.query,view.show.