# Configure the CLI

Store non-secret defaults with `appbarn config`; keep the bearer token only in the environment.

```sh
appbarn config set api https://api.app-barn.com
appbarn config set app <app-uuid>
appbarn config set environment <environment-uuid>
appbarn config show
export APPBARN_TOKEN='<automation-token>'
```

The API URL must be an HTTPS origin for remote hosts. App and Environment values are canonical UUIDv4 IDs, not names.

## Expected result

Commands use configured defaults unless an explicit command option overrides the App/Environment.

::: details AI prompt — Configure the CLI (Copilot, Codex, Cursor)

```text
Inspect this repository and its AppBarn settings. Set the API to https://api.app-barn.com and configure the actual App and Environment UUIDs with appbarn config set. Ask me for UUIDs if not known; never invent them. Keep the Automation Token only in APPBARN_TOKEN in the shell or CI secret store, not config, command arguments or logs. Verify settings using appbarn config show, then report the non-secret target.
```

:::

## Common failures

- `Configure api first`: set `api`.
- missing token: set `APPBARN_TOKEN` in the process/CI secret store.
- authorization failure: verify the token is active and scoped to the selected App.

## Related

- [Automation Tokens](/reference/automation-tokens)
- [Environment variables](/reference/environment-variables)
