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

# 9squid CLI

> Install, authenticate, and script against the 9Squid API from the command line.

The 9squid CLI is a command-line interface for the 9Squid securitization platform, covering the same Originator and Investor workflows as the API — loan tapes, selection criteria, pools, deals, subscriptions, webhooks, and alerts. Release binaries are published in [9Squid/cli-releases](https://github.com/9Squid/cli-releases); source, issues, and development docs live in [9Squid/cli](https://github.com/9Squid/cli).

```
9squid login                          # store your API key (Clerk API key, same as the backend)
9squid health                         # platform health
9squid loans list                     # originator: list loan tapes
9squid loans review d_123 --reason ok # approve a deal (add --status REJECTED to reject)
9squid pools stratification p_9       # stratification report
9squid deals list --status open       # investor: browse deals
9squid deals subscribe d_123 --amount 1000000
9squid webhooks deliveries --status failed
9squid alerts list --json | jq .
```

***

## Install

```sh theme={null}
curl -fsSL https://raw.githubusercontent.com/9Squid/cli/main/install.sh | sh
```

Or download a binary directly from the [latest release](https://github.com/9Squid/cli-releases/releases/latest): macOS (x64/arm64), Linux (x64/arm64), Windows (x64). Each release also includes a `checksums.txt` for verifying the download.

***

## Auth

Auth uses the same bearer credential as the 9Squid backend — a Clerk API key sent as `Authorization: Bearer <key>`. There is no separate CLI auth scheme.

Resolution order (first match wins):

1. `--api-key` flag
2. `NINESQUID_API_KEY` env var (use this in CI)
3. OS keychain (stored by `9squid login`, per environment)
4. `~/.9squid/config.yaml` `api_key` (file fallback, `0600`)

***

## Environments

`prod` (`https://api.9squid.com`) and `staging` (`https://stg-api.9squid.com`).

```sh theme={null}
9squid config set environment staging   # persist the default
9squid --env staging loans list         # or per invocation
NINESQUID_ENV=staging 9squid whoami     # or via env
```

`--base-url` / `NINESQUID_BASE_URL` / `9squid config set base-url.staging <url>` override the URL itself.

***

## Output & scripting

* **Table on a TTY, JSON when piped** — `--json` / `--table` force either.
* Data goes to **stdout**, everything else to **stderr**, so pipes stay clean.
* `--non-interactive` disables all prompts (or set `NINESQUID_NON_INTERACTIVE=1`); `--yes` skips a confirmation. Destructive commands (`webhooks delete`, `alerts delete`, `loans review`, `deals subscribe`) confirm before executing.
* Complex request bodies: every write command accepts `--data '<json>'` or `--data @file.json`; individual flags override fields inside `--data`.

Stable exit codes: `0` ok · `1` generic · `2` validation · `3` auth · `4` not found · `5` rate-limited · `6` upstream error.

***

## Command groups

| Group                                                | Role       | Covers                                     |
| ---------------------------------------------------- | ---------- | ------------------------------------------ |
| `health`, `alerts`, `webhooks`, `documents`          | both       | shared platform tools                      |
| `loans`, `loans bulk`, `sc`, `pools`, `alm`          | originator | loan tapes, selection criteria, pools, ALM |
| `deals`, `originators`, `portfolio`, `subscriptions` | investor   | deal browsing, IOI/subscribe, portfolio    |

Run `9squid <group> --help` for the full command list.

***

## Releases

Each release on [9Squid/cli-releases](https://github.com/9Squid/cli-releases/releases) ships prebuilt binaries for macOS (x64/arm64), Linux (x64/arm64), and Windows (x64), plus a `checksums.txt` for verifying the download. Update by re-running the install script or downloading the latest binary — the CLI checks for and warns about newer releases on startup.

***

## Support

Found a bug or have a feature request? Open an issue on [9Squid/cli-releases](https://github.com/9Squid/cli-releases/issues). For API access or token issues, contact [support@9squid.com](mailto:support@9squid.com).
