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

# CLI overview

> Manage agents, calls, numbers and caller context from your terminal

The `nixflex` command lets you do from a terminal what you would otherwise do in the dashboard or with the API: create an agent, place a call, load a customer list, check your balance. It ships inside the [`nixflex`](https://www.npmjs.com/package/nixflex) npm package - the same package as the Node SDK - and every command is a call into that SDK, so the CLI can never say something the API does not do.

```bash theme={null}
npx nixflex --help
```

## Install

Run it without installing (`npx nixflex ...`), or install once:

```bash theme={null}
npm install -g nixflex
nixflex --version
```

Requires Node.js 18 or newer. No other dependencies are installed.

## Authenticate

The CLI needs your full API key - both halves, `nxf_xxx:nxfs_xxx`. It looks in three places, in this order:

| Order | Where                                   | Use it for                                    |
| ----- | --------------------------------------- | --------------------------------------------- |
| 1     | `--key nxf_xxx:nxfs_xxx` on the command | One-off commands against another account      |
| 2     | `NIXFLEX_API_KEY` environment variable  | CI, scripts, servers                          |
| 3     | `~/.nixflex/config.json`                | Your own machine - written by `nixflex login` |

```bash theme={null}
nixflex login          # prompts for the key (not echoed) and verifies it against the API
nixflex whoami         # which key is in use, plus your usage and balance
nixflex logout         # removes the stored key
```

<Note>
  `login` stores the key in `~/.nixflex/config.json` with owner-only permissions. Never paste a key into a command in a shared shell history - use `login` or the environment variable.
</Note>

## Output

Every command prints a table for humans. Add `--json` for scripts - the output is then exactly what the API returned, and errors come back as JSON on stdout too:

```bash theme={null}
nixflex agents list --json | jq '.[].agent_id'
```

## Safety rails

* **Deletes need `--confirm`.** Without it the command shows what *would* be deleted and stops.
* **Nothing is retried or batched silently.** `callers import` sends your file in chunks of 1,000 and reports the total; a bad row stops the chunk before anything in it is written.
* **Prompts from files.** Anywhere a prompt is accepted, `@path/to/file.txt` reads it from disk instead of the command line.

## Exit codes

| Code | Meaning                                             |
| ---- | --------------------------------------------------- |
| `0`  | Success                                             |
| `1`  | The API returned an error, or the command was wrong |
| `2`  | No API key found (run `nixflex login`)              |

## Next

<CardGroup cols={2}>
  <Card title="Quickstart" icon="bolt" href="/cli/quickstart">
    An agent, a call and a caller record in two minutes.
  </Card>

  <Card title="Commands" icon="list" href="/cli/commands">
    Every command with a real example.
  </Card>
</CardGroup>
