> 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/get-started/cli-quickstart.md).

# CLI quickstart

Create a project, upload a folder and check processing from the terminal with the unitlab CLI.

Create a project, upload a folder of images and confirm every file was processed, all from the terminal. The examples use a macOS or Linux shell and [`jq`](https://jqlang.github.io/jq/) to read JSON.

## Before you begin

* [Install the CLI](https://docs.unitlab.ai/api-sdk-cli/get-started/install-the-python-sdk-and-cli.md) and [set `UNITLAB_API_KEY`](https://docs.unitlab.ai/api-sdk-cli/get-started/authentication-and-api-keys.md). The key needs **Manage projects** and **Manage data**.
* Open a terminal in a folder that holds an `images/` folder with a few JPG or PNG files.

## Upload and check

{% stepper %}
{% step %}

### Create a project

```bash
PROJECT_ID=$(unitlab project create "Warehouse picks" --json | jq -r .id)
echo "$PROJECT_ID"
```

The command prints the new project's ID. To use an existing project, find its ID with `unitlab project list`.
{% endstep %}

{% step %}

### Upload the folder

```bash
unitlab project upload "$PROJECT_ID" --source ./images --json | tee upload.json
BATCH_QUEUE_ID=$(jq -r .batch_queue_id upload.json)
```

```json
{
  "total": 2,
  "uploaded": 2,
  "failed": 0,
  "batch_queue_id": "0b6c5f3e-6a0b-4b8e-9f43-2f1f0f8f5a10"
}
```

The command exits with code `1` if any file failed to upload. The others are still uploaded.
{% endstep %}

{% step %}

### Wait for processing

```bash
unitlab batch-queue wait "$PROJECT_ID" "$BATCH_QUEUE_ID" --timeout 1800
```

```json
{
  "status": "completed",
  "total": 2,
  "completed": 2,
  "processing": 0,
  "failed": 0,
  "error": null,
  "frame_count": null
}
```

The wait ends when nothing is processing. `status` is then `completed`, `partial_failure` or `failed`; `failed` counts the files the server could not process.
{% endstep %}

{% step %}

### List the items

```bash
unitlab project data-units "$PROJECT_ID" --batch-queue "$BATCH_QUEUE_ID"
```

```
id=5f0e...  name=bin-001.jpg  kind=datasource  status=annotate  data_type=image
id=a41c...  name=bin-002.jpg  kind=datasource  status=annotate  data_type=image
```

{% endstep %}
{% endstepper %}

{% hint style="success" %}
Open the project in the app. Both images are in **Data**, ready to label once the project has an ontology.
{% endhint %}

## Output for scripts

Every command prints short `key=value` lines for people. Add `--json` when a script reads the output. Errors go to standard error with exit code `1`, so a script with errexit on stops at the first error.

```bash
set -euo pipefail
unitlab release list --json | jq -r '.[] | [.id, .name, .version] | @tsv'
```

## Next steps

* [Upload, label and export](https://docs.unitlab.ai/api-sdk-cli/get-started/upload-label-and-export.md): the full flow, including a release download.
* [CLI command reference](https://docs.unitlab.ai/api-sdk-cli/clis/cli-command-reference.md): every command and option.
* [CLI: projects and Data Units](https://docs.unitlab.ai/api-sdk-cli/clis/cli-projects-and-data-units.md): video frame rates, lidar scenes and benchmarks.

## Related

[Python SDK quickstart](https://docs.unitlab.ai/api-sdk-cli/get-started/python-sdk-quickstart.md) · [CLI overview and output modes](https://docs.unitlab.ai/api-sdk-cli/clis/cli-overview-and-output-modes.md) · [CLI automation and exit behavior](https://docs.unitlab.ai/api-sdk-cli/clis/cli-automation-and-exit-behavior.md)
