> 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/api-sdk-and-cli.md).

# API, SDK & CLI

```mermaid
flowchart LR
  APP["Applications and workers"] --> SDK["Python SDK"]
  OPS["Shell, CI, and runbooks"] --> CLI["CLI"]
  EXT["Other runtimes"] --> HTTP["Authenticated HTTP API"]
  SDK --> PLATFORM["Unitlab platform API"]
  CLI --> PLATFORM
  HTTP --> PLATFORM
  PLATFORM --> RES["Projects · Data · Workflows · Queues · Releases"]
```

*Choose the integration surface by runtime and operating model. All three surfaces address the same authenticated Unitlab resources.*

{% hint style="info" %}
**Outcome:** Build production Unitlab automations with the Python SDK, CLI, and authenticated HTTP API.
{% endhint %}

This reference is generated from the current `unitlab-sdk-codebase` package at version **3.0.0**, its public source, executable command tree, and tests. It does not reuse previous documentation.

### Choose a surface

| Need                           | Recommended surface    |
| ------------------------------ | ---------------------- |
| Typed application integration  | Python SDK             |
| Shell, CI, or operator runbook | CLI with `--json`      |
| Non-Python runtime             | Authenticated HTTP API |

### Coverage

Projects, Data Units, Batch Queues, Assets, folders, cloud storage, grouping, datasets and versions, embedding spaces, ontologies, workflow stages and tasks, releases, errors, and production automation patterns.

{% hint style="warning" %}
The installed SDK and CLI help are authoritative for the pinned package version. Test upgrades against representative create, upload, attach, workflow, embedding, and release operations before changing production jobs.
{% endhint %}

### Operating contract

| Concern           | Required behavior                                                                |
| ----------------- | -------------------------------------------------------------------------------- |
| Execution surface | Pinned `unitlab==3.0.0` 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 %}
