> ## Documentation Index
> Fetch the complete documentation index at: https://docs.safefetch.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Install

> Install and configure the SafeFetch CLI.

## Run with npx

```bash theme={null}
SAFEFETCH_API_KEY=sf_live_... npx @safefetch/cli --help
```

## Install globally

```bash theme={null}
npm install -g @safefetch/cli
safefetch --help
```

## Monorepo local development

If you are working in this repository:

```bash theme={null}
git clone https://github.com/jayhickey/SafeFetch.git
cd SafeFetch/packages/cli
npm install
npm run build
node dist/index.js --help
```

## Environment setup

The CLI reads these values:

* `SAFEFETCH_API_KEY` (required)
* `SAFEFETCH_API_URL` (optional, defaults to `https://api.safefetch.dev`)

```bash theme={null}
export SAFEFETCH_API_KEY=sf_live_...
export SAFEFETCH_API_URL=https://api.safefetch.dev
```

## `.safefetch` config file

You can store config in a `.safefetch` file in your home directory or current project directory.

```bash theme={null}
SAFEFETCH_API_KEY=sf_live_...
SAFEFETCH_API_URL=https://api.safefetch.dev
```

## Override with flags

CLI flags override environment/config values:

```bash theme={null}
safefetch --api-key sf_live_... --api-url https://api.safefetch.dev list
```
