> For the complete documentation index, see [llms.txt](https://docs.scaleconnect.com.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scaleconnect.com.au/api/cli/broker-cli.md).

# Broker CLI

{% @scale-docs-page-title/page-title title="Broker CLI" %}

{% hint style="warning" %}
**Confirm before publishing:** supported binary and command names, install method, broker login versus API key, scope mapping, exact output fields, pagination, write approvals and released commands. The examples below are the proposed Broker CLI design and are not commands to run against a current package.
{% endhint %}

Broker CLI gives an authorized ScaleConnect user repeatable access to their permitted brokerage book. The CLI calls the versioned API; it cannot use a service credential to bypass broker membership.

## Sign in and select a workspace

```bash
scale broker login
scale broker workspace list
scale broker workspace use <workspace-id>
scale broker whoami
```

`whoami` should show the signed-in identity, active brokerage and granted scopes. A command that names a client in another book must fail even if the client ID is valid.

## Read the book

```bash
scale broker clients list --updated-since 2026-10-01T00:00:00Z --json
scale broker clients get <client-id> --json
scale broker clients portfolio <client-id> --json
scale broker clients loans <client-id> --json
```

List output should include pagination metadata or a documented `--cursor` option; it must not silently truncate the book. The JSON output should match the public API response schema, with a stable wrapper for command metadata.

## Run a controlled write

```bash
scale broker sync client --file client.json --dry-run
scale broker sync client --file client.json
scale broker imports get <import-id>
```

A dry run should validate locally where possible and identify the workspace and intended changes. The real sync returns an import ID; use the status command to see validation errors and partial success. Do not print raw credentials or sensitive field values in error logs.

## Automation

For unattended jobs, use a broker-scoped credential with only the required scopes and rotate it through the [API key](/api/authentication/api-keys.md) lifecycle. Use `--json` and documented exit codes; never parse the human-readable table. The CLI version and public API version should be reported by `scale version`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.scaleconnect.com.au/api/cli/broker-cli.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
