# Install and Set Up the CLI

You will need `Python >=3.10` to use the Roboflow Python package.

After you have Python installed, run the following command to install:

```bash
pip install roboflow
```

After installing, test that the CLI works:

```bash
roboflow --help
```

## Authentication

There are three ways to authenticate:

### Option 1: Environment variable (recommended for scripts and agents)

```bash
export ROBOFLOW_API_KEY=rf_xxxxx
```

This is the recommended approach for CI/CD, automation, and AI coding agents. No interactive prompts required.

### Option 2: API key flag

```bash
roboflow --api-key rf_xxxxx project list
```

Pass the key directly to any command. Useful for one-off commands.

### Option 3: Interactive login

```bash
roboflow login
```

Open the link in your browser, get the token, and paste it in the terminal. Credentials are saved to `~/.config/roboflow/config.json` so you only need to do this once.

You can also log in non-interactively with:

```bash
roboflow auth login --api-key rf_xxxxx
```

## Verify Authentication

```bash
roboflow auth status
```

This shows your current workspace and a masked API key.

## Set Default Workspace

If you have access to multiple workspaces, set which one is used by default:

```bash
roboflow auth set-workspace my-workspace-id
```

## Shell Completion (Optional)

Enable tab completion for commands, options, and arguments:

```bash
# Zsh
eval "$(roboflow completion zsh)"

# Bash (requires bash >= 4.4)
eval "$(roboflow completion bash)"

# Fish
roboflow completion fish | source
```

To make it permanent, add the `eval` line to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.).


---

# 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.roboflow.com/developer/command-line-interface/install-and-set-up-the-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.
