> For the complete documentation index, see [llms.txt](https://doc-op.blurit.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc-op.blurit.io/2.15.0/blurit-on-premise/usage/command-line-interface.md).

# Command line interface

## Overview

The Blurit CLI lets you interact with Blurit On-Premise. It covers two distinct jobs:

* **Operating the stack on the server** — `requirements`, `install`, `start`, `stop`, `restart`, `status`, `uninstall`, `create-superadmin`. These commands drive Docker on the local machine and only work on the Linux server hosting Blurit.
* **Talking to a running instance** — `license`, `tasks`, `stats`, `doc`. These commands call the Blurit API over HTTP and can be run from any machine that can reach the instance.

The `blurit` binary is shipped in the archive you received; see [Linux dependencies](/2.15.0/blurit-on-premise/installation/linux-dependencies.md) for how to run it.

```bash
blurit [OPTIONS] COMMAND [ARGS]...
```

## Operating the stack

These commands must be run on the machine hosting Blurit.

### Start

Start the Blurit stack. The CLI waits until every service is running.

```bash
blurit start
```

### Restart

Restart the Blurit stack.

```bash
blurit restart
```

### Stop

Stop the Blurit stack.

```bash
blurit stop
```

### Status

Display the state of each service of the stack, with its number of running replicas.

```bash
blurit status
```

### Uninstall

Remove the Blurit stack from the machine.

```bash
blurit uninstall
```

## Talking to a running instance

Every command in this section accepts the same two options:

* `-h, --host TEXT` Host to contact. Defaults to `localhost`. Accepts a host and port (`127.0.0.1:80`) or a full URL for a remote instance (`https://blurit.example.com`).
* `-o [json]` Output the raw API response as JSON instead of a table.

When `--host` has no scheme, the CLI reads the local compose file to decide between `http` and `https`.

### License

Manage the Blurit license.

#### **info**

Display all Blurit license information.

```bash
blurit license info
```

Response:

```
+------------+--------------------------+
| Property   | Value                    |
+============+==========================+
| Start Date | 2023-07-31T22:00:00.000Z |
+------------+--------------------------+
| End Date   | 2023-12-31T21:59:59.000Z |
+------------+--------------------------+
| License    | LICENSE                  |
+------------+--------------------------+
```

#### **set**

Upload or update the Blurit On-Premise license. Pass the license file you received, or its content with `--content`. `blurit license add` is an alias of this command.

```bash
blurit license set [OPTIONS] [LICENSE_FILE]
```

options:

* `-c, --content TEXT` Pass the license content directly instead of reading it from `LICENSE_FILE`.

Example:

```bash
blurit license set license_client_name_20250101_20251231
```

Response:

```
+------------+--------------------------+
| Property   | Value                    |
+============+==========================+
| Start Date | 2023-06-27T22:00:00.000Z |
+------------+--------------------------+
| End Date   | 2023-09-30T21:59:59.000Z |
+------------+--------------------------+
| License    | LICENSE                  |
+------------+--------------------------+
```

### Tasks

Manage Blurit anonymization tasks.

#### **create**

Create a new Blurit task.

```bash
blurit tasks create [OPTIONS] INPUT [OUTPUT]
```

arguments:

* `INPUT` For the `file` and `zip` input types, the local path of the media. For the `directory` input type, a sub-directory of the input directory configured on the Blurit server.
* `OUTPUT` Optional. Sub-directory of the output directory configured on the Blurit server. It must already exist.

input and output options:

* `--input-type [file|zip|directory]` Local file, local zip archive, or a directory located on the Blurit server. Default: `file`.
* `--input-storage [local|s3]` `local` means on the Blurit server. `s3` requires the S3 configuration to have been done at install time, and only works with the `directory` input type. Default: `local`.
* `--output-storage [local|s3]` Same, for the output. Default: `local`.

anonymization options:

* `--face-blur / --no-face-blur` Activate face blur. Default: enabled.
* `--plate-blur / --no-plate-blur` Activate plate blur. Default: enabled.
* `--anonymization-type [blur|pixelate|opaque]` Anonymization to apply. Default: `blur`.
* `--shape [object|box]` Anonymize the detected object itself, or its wrapping box. Default: `object`.
* `--safe-margin FLOAT` Extension size around the detection area, between 0.1 and 1. Default: `0.5`.
* `--blur-strength FLOAT` Blur strength, between 0.1 and 1. `blur` type only. Default: `0.5`.
* `--edge-smoothing FLOAT` Smooth the edge of the detection area, between 0.1 and 0.2. `blur` type only. Default: `0.15`.
* `--num-pixels INTEGER` Number of pixels, between 1 and 10. `pixelate` type only. Default: `5`.
* `--hex-color TEXT` Color of the overlay, `#` may be omitted. `opaque` type only. Default: `000000`.
* `--keep-audio / --no-keep-audio` Keep the audio track in the output media. Default: enabled.

output options:

* `--output-detection-url / --no-output-detection-url` Generate a JSON file containing all detected areas. `file` and `zip` input types only. Default: enabled.
* `--add-output-suffix / --no-add-output-suffix` Add an `_anonymized` suffix to the output file name. `file` and `zip` input types only. Default: enabled.
* `--add-report / --no-add-report` Add a CSV report of all processed files to the output zip. `zip` input type only. Default: disabled.
* `--save-unknown-files / --no-save-unknown-files` Reintegrate unknown file types (text files, binaries, …) into the output zip. `zip` input type only. Default: disabled.
* `--auto-delete / --no-auto-delete` Delete the input media once processed. `directory` input type only. Default: disabled.

Example: anonymize a local video, blurring only the plates:

```bash
blurit tasks create --no-face-blur my_video.mp4
```

Example: process a directory located on the Blurit server:

```bash
blurit tasks create --input-type directory incoming processed
```

Response:

```
job id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```

#### **status**

Get the status of a task from its ID.

```bash
blurit tasks status TASK_ID
```

return:

* Succeeded
* Started
* Sent
* Failed

Example:

```bash
blurit tasks status 31bc8405-4a56-4cb2-a67e-689797ad9a1a
```

Response:

```bash
Succeeded
```

#### **list**

List the task history.

options:

* `--page TEXT` Page number.
* `--count TEXT` Number of results per page. Default: `10`.
* `--from TEXT` First date displayed, format `Y-m-d`.
* `--to TEXT` Last date displayed, format `Y-m-d`.
* `--filetype [picture|video|directory]` Filter on the file type.

```bash
blurit tasks list
```

Response:

```
+--------------------------+-------------------+-------------+--------------------------------------+---------------+-----------------------+---------------+
| Created At               | Processing Time   | File Type   | Job ID                               | File Name     | Output Media URL      | Task Status   |
+==========================+===================+=============+======================================+===============+=======================+===============+
| 2023-08-24T09:18:42.625Z | 05:42:50.70       | directory   | 31bc8405-4a56-4cb2-a67e-689797ad9a1a | 629d57_part_1 | 629d57_part_2_process | Succeeded     |
+--------------------------+-------------------+-------------+--------------------------------------+---------------+-----------------------+---------------+

```

### Stats

Display total and period (month, day) statistics.

options:

* `--from TEXT` First date, format `Y-m-d`.
* `--to TEXT` Last date, format `Y-m-d`.
* `--granularity [day|month]` Display statistics by month or by day.

`--from` is required as soon as you ask for a period.

```bash
blurit stats
```

**Response:**

```
+------------------------------+-----------+
| Metric                       | Value     |
+==============================+===========+
| Total Videos API Calls       | 73        |
+------------------------------+-----------+
| Total Pictures API Calls     | 443       |
+------------------------------+-----------+
| Total Videos Consumption     | 3.33 GB   |
+------------------------------+-----------+
| Total Pictures Consumption   | 806.07 MB |
+------------------------------+-----------+
| Monthly Videos API Calls     | 4         |
+------------------------------+-----------+
| Monthly Pictures API Calls   | 8         |
+------------------------------+-----------+
| Monthly Videos Consumption   | 22.12 MB  |
+------------------------------+-----------+
| Monthly Pictures Consumption | 9.42 MB   |
+------------------------------+-----------+
```

### Doc

Display the links to the documentation.

options:

* `-h, --host TEXT` Specify the host.

```bash
blurit doc
```

response:

```
API Documentation:
Operation: https://doc-op.blurit.io
Local: http://127.0.0.1:8084/api/docs
```

## Miscellaneous

### Version

Display the version of the CLI itself. This is **not** the version of the Blurit application.

```bash
blurit version
```

### Help

Display the list of commands. `blurit --help` does the same, and `blurit COMMAND --help` details a single command.

```bash
blurit help
```

#### **Output Format**

The Blurit CLI supports two output formats: text (default) and JSON. Add `-o json` to any command of the "Talking to a running instance" section to get the raw API response.

Example:

```
blurit tasks status 31bc8405-4a56-4cb2-a67e-689797ad9a1a -o json
```

Response:

```
{'task_id': '31bc8405-4a56-4cb2-a67e-689797ad9a1a', 'status': 'Succeeded', 'result': {'input_directory': {'protocol': 'file', 'path': 'input/629d57_part_2', 'auto_delete': False}, 'output_directory': {'protocol': 'file', 'path': 'output/629d57_part_2_process'}, 'size': {'VIDEO': 4979394177}, 'nb_files': {'VIDEO': 252}}}
```

#### **Support and Contribution**

If you have any questions, issues, or would like to make a return of the Blurit CLI, please contact us at <support@blurit.io>. We hope this guide helps you effectively use the Blurit CLI to manage your media anonymization tasks.
