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

# CLI basics

> How the revcenter CLI reads its key, where it keeps it, what it prints, and how it exits.

> Agents: the full documentation index is at [/llms.txt](https://docs.revcenter.ai/llms.txt).

## Which key it uses

1. `REVCENTER_API_KEY` in the environment, if set.
2. Otherwise the key saved by `revcenter auth login`.

The environment always wins. `revcenter auth status` says which one is in use (`"source"`).

## Environment variables

| Variable | Meaning | Default |
| - | - | - |
| `REVCENTER_API_KEY` | The API key | the saved key |
| `REVCENTER_API_URL` | The API's address | the saved address, else `https://api.revcenter.ai` |
| `REVCENTER_CONFIG_DIR` | Where the saved key lives | `$XDG_CONFIG_HOME/revcenter`, else `~/.config/revcenter` |

## The saved key

`revcenter auth login` saves `credentials.json` in the config directory, readable by you only (file mode `600`,
directory `700`). It checks the key against the API first and saves nothing if the API refuses it.
`revcenter auth logout` deletes the file.

## Output

* Results are **JSON on standard output**, pretty-printed.
* Progress (from `--wait`) goes to **standard error**, one line per check, for example
  `  running · 0 read` then `  complete · 2 read`.
* Keys are never printed whole: `auth status` shows `rvc_live_xxxx…xxxx`.

## Exit status

| Exit | When |
| - | - |
| `0` | The command succeeded. |
| `1` | It failed. Standard error has one line. |

A failure the API reports prints `revcenter: <code>: <message>`, for example
`revcenter: project_not_found: No project with that id in this workspace.` The codes are the
[API's error codes](/guides/errors). The CLI adds a few of its own:

| Code | When |
| - | - |
| `missing_api_key` | No key in the environment or saved |
| `invalid_key` | `auth login` was given something that is not a Revcenter key |
| `invalid_argument` | A required argument is missing |
| `unknown_command` | The command doesn't exist |

A problem on your machine, such as a `--criteria` file that doesn't exist, prints the system's message instead,
for example `revcenter: ENOENT: no such file or directory, open 'criteria.json'`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.