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

# Output and scripting

> Human-readable output by default, raw JSON with --json, and exit codes for scripting the gcai CLI.

## Two output modes

By default the CLI prints human-readable output: lists render as tables, single resources as aligned key/value lines. Pass `--json` to get the raw API response as pretty-printed JSON instead.

```bash theme={null}
# Human-readable (default)
gcai projects list

# Raw JSON, ready to pipe
gcai projects list --json | jq '.projects[].name'
```

Use `--json` in scripts. It is the stable, structured shape; the human layout is meant for reading, not parsing.

## Exit codes

Every command exits `0` on success and `1` on any error (an API error or a local failure). API errors print a clean `Error: <message>` to stderr with no stack trace; with `--json`, the error envelope is also written to stderr.

`gcai auth status` exits `1` when you are not authenticated or the key is invalid, so you can gate a script on it:

```bash theme={null}
gcai auth status >/dev/null 2>&1 || { echo "Run gcai auth login first"; exit 1; }
```

A command that returns no content (for example a delete) prints nothing and exits `0`.
