# Command Line Interface (CLI)

The CLI is a command-line interface tool designed to interact with the DAM API. It enables server-side use and provides a convenient way to perform various operations on digital assets, such as uploading, downloading, deleting, moving and renaming files. Additionally, it allows users to list and query asset information, including tags and metadata.

The DAM CLI provides all the functionality of DAM and its APIs. It can be used from the terminal or in a script to access the features of Scaleflex DAM in a convenient way. Using the tool, all media assets can be managed via simple commands on macOS or Linux.&#x20;

For example, you can perform Admin and Upload API operations by typing commands directly into a terminal. This saves you time as you do not need to set up a development environment. You can also build scripts with multiple CLI commands to implement more complex processes and workflows.

Complete documentation of the tool is available on its GitHub page:

{% embed url="<https://github.com/scaleflex/filerobot-cli>" %}

What follows is a brief introduction and a quick-start guide to get you up to speed in no time.

## Use cases and features

The DAM CLI provides a range of use cases that demonstrate its versatility:

* **Bulk upload -** Upload a large number of assets to the DAM in a single command, saving time and effort;
* **Automated workflows** - Incorporate the CLI application into server-side scripts or workflows to perform scheduled asset management tasks;
* **Asset manipulation -** Rename, move or delete assets based on specific criteria;
* **Metadata management** - Query and update asset metadata;
* **Backup and recovery -** Download assets from the DAM for backup or recovery purposes;
* **Integration with other systems** - Integrate the CLI into third-party tools or systems for seamless asset management.

The features of DAM CLI include:

* Uploading/Downloading multiple assets;
* Batch asset deletion;
* Listing assets;
* Querying asset information such as metadata, tags, etc.;
* Moving assets between folders;
* Renaming assets.

The following DAM APIs are supported: *Delete*, *Download*, *Inspect*, *List*, *Move*, *Product*, *Rename* and *Upload*.

Complete information about the Filerobot API endpoints is available in an always up-to-date documentation, that can be accessed via the following link:

{% embed url="<https://developers.scaleflex.com/#96e0a1f1-65f5-46cf-92c7-154747601676>" %}

There, you can find details about the API endpoints, together with all required request parameters, so you know how to interact with them.

## Installation

Filerobot API can be installed by running one of the following commands depending on your operating system. They download the latest release of the tool from the GitHub page, move it to an appropriate directory and make it available for use.

### **MacOS**

```bash
sudo curl -L "https://github.com/scaleflex/filerobot-cli/releases/latest/download/filerobot-cli-darwin-x86_64" -o /usr/local/bin/filerobot && sudo chmod +x /usr/local/bin/filerobot
```

### **Linux**

```bash
sudo curl -L "https://github.com/scaleflex/filerobot-cli/releases/latest/download/filerobot-cli-linux-x86_64" -o /usr/local/bin/filerobot && sudo chmod +x /usr/local/bin/filerobot
```

You can confirm that the installation was successful by running:

```bash
filerobot version
```

The version of the tool should appear on the screen:

```bash
Filerobot CLI v. 1.5.0
```

## Configuration

Configuring the CLI requires a DAM Token (*mytoken*) and API Secret Key (*mysupersecretkey*) both of which are available from the Filerobot Asset Hub.

```bash
filerobot config --token=mytoken --key=mysupersecretkey
```

## Usage

The following commands are available:

<table><thead><tr><th width="177">Command</th><th>Description</th></tr></thead><tbody><tr><td><code>config</code></td><td>sets the token and key provided by Scaleflex, required to use the tool</td></tr><tr><td><code>delete</code></td><td>deletes a file by UUID</td></tr><tr><td><code>download</code></td><td>downloads a file by path or UUID</td></tr><tr><td><code>help</code></td><td>displays the help info for a command</td></tr><tr><td><code>inspect</code></td><td>gets file information by UUID</td></tr><tr><td><code>list</code></td><td>lists files and directories from your Filerobot store</td></tr><tr><td><code>move</code></td><td>moves files to a new folder. The folder is created if it doesn't exist</td></tr><tr><td><code>product</code></td><td>allows access to the Product API functionalities</td></tr><tr><td><code>rename</code></td><td>renames a file by UUID.</td></tr><tr><td><code>upload</code></td><td>uploads a file to a specific folder</td></tr><tr><td><code>version</code></td><td>prints the version number of Filerobot CLI</td></tr></tbody></table>

Additional info for any command can be accessed using `filerobot [command] --help`.

## Examples

Inspect the current token and key:

```bash
filerobot config -i
```

List the contents of a directory:

```bash
filerobot list /test
```

Inspect a specific resource:

```bash
filerobot inspect bb1ce06f-2677-581a-85e7-28c00ec50000
```

Download a file by UUID:

```bash
filerobot download bb1ce06f-2677-581a-85e7-28c00ec50000
```

Upload a file to a specific folder:

```bash
filerobot upload face.png --folder=/Marketing
```

Upload all .jpg images in the current directory:

```bash
for i in *.jpg; do filerobot upload $i -f /cli/upload; done
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scaleflex.com/developers-headless/headless-dam/command-line-interface-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
