> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/sdks/folders.md).

# Folders

Create, traverse, and inspect local or cloud-backed folder resources.

{% hint style="info" %}
**Outcome:** Create, traverse, and inspect local or cloud-backed folder resources.
{% endhint %}

```python
root = client.assets.create_folder("Raw data")
child = root.create_subfolder("2026-07")

for folder in client.assets.folders(parent=root):
    print(folder.id, folder.name)

for folder in client.assets.all_folders():
    print(folder.id, folder.name)

items = child.list_items()
```

`folders(parent=...)` scopes one level; `all_folders()` walks the complete hierarchy. `folder(id)` retrieves one handle. A cloud folder also supports `sync_cloud()`; treat synchronization as a state-changing discovery operation and inspect the result.

`sync_cloud()` reads one level of the bucket and returns counts: `registered` (new files), `folders` (new sub-folders), `skipped` (files with an unsupported extension), `skipped_in_trash` (files and sub-folders in library Trash, which are not added again), and `missing` (files of this folder that the bucket no longer lists). `busy: True` with zero counts means another sync of this folder is running.

### Operating contract

| Concern           | Required behavior                                                                |
| ----------------- | -------------------------------------------------------------------------------- |
| Execution surface | Pinned `unitlab==3.1.6` application environment on Python 3.10+.                 |
| Identity          | Least-privilege API key supplied through approved configuration.                 |
| Target resolution | Stable resource IDs and an explicitly bounded target set.                        |
| Success evidence  | Typed return fields, server-side state, and downstream acceptance of the result. |

### Failure and recovery boundary

| Condition                                       | Response                                                                                                     |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Authentication or authorization fails           | Stop, correct the service identity or access model, rotate exposed credentials, and rerun a read-only check. |
| Validation or entitlement rejects the operation | Correct the input or entitlement; do not retry an unchanged request.                                         |
| A request times out                             | Inspect remote state before repeating a mutation because the server may have accepted it.                    |
| Asynchronous processing exceeds its deadline    | Preserve the Batch Queue or release ID, continue bounded monitoring, and inspect item-level failures.        |
| Only part of a batch succeeds                   | Keep successful identifiers, isolate failed rows, and retry only the corrected subset.                       |

{% hint style="warning" %}
Pin and test the production SDK version. Use stable IDs, keep secrets out of logs and command history, and record the correlation ID, target IDs, counts, final state, and redacted error details for material state changes.
{% endhint %}

***

> **Related Unitlab capability guides:** [training-data curation workflows](https://unitlab.ai/en/data-curation)
