# Command Line Interface (CLI)

### Using the CLI

If you have already completed the steps for [Create Account](https://storage.titannet.io/login) and [Set API Key](https://github.com/utopiosphe/titan-storage-sdk/blob/main/doc/access_key.jpg), your CLI and Titan Storage are already configured. To use the CLI, you can follow the steps below:

#### 1. Compile the Command-Line File Using the Go Build Tool

First, ensure that Go is installed in your environment. Use the following command to compile the CLI file:

```
go build -o cli main.go
```

This will generate an executable file named cli, which you can use to interact with the API.

#### 2. Initialize Environment Variables

Before using the CLI, you need to set up environment variables using the API key you registered in the browser:

```
export TITAN_URL=<your_titan_url>
export API_KEY=<your_api_key>
```

* TITAN\_URL: The URL of the Titan service.
* API\_KEY: The API key you obtained from the Titan platform.

#### 3. Execute CLI Methods

Once the environment variables are set, you can use the CLI to execute API methods. The basic format to execute a command is:

```
./cli <api_method> <arguments>
```

#### Methods

* [completion](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_completion.md) - Generate the autocompletion script for the specified shell
* [delete](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_delete.md) - delete file
* [folder](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_folder.md) - Manage folders
* [gendoc](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_gendoc.md) - Generate markdown documentation
* [get](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_get.md) - get file
* [list](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_list.md) - list files
* [upload](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_upload.md) - upload file
* [url](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_url.md) - get file url by cid
* [version](https://github.com/utopiosphe/titan-storage-sdk/blob/main/cli/_version.md) - Print the version number


---

# 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://titannet.gitbook.io/titan-network-en/tws/titan-storage/developer-guides/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.
