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

# Bridgly CLI

> Use Bridgly from your terminal with API-key login, generated commands, and JSON, CSV, or table output.

Install the CLI with Node.js 22.13 or newer:

```bash theme={"dark"}
npm install -g @bridgly/cli
```

Or use `npx @bridgly/cli` to use without installing.

## Log in

```bash theme={"dark"}
bridgly auth login
```

Paste your [dashboard API key](https://bridgly.app/dashboard/api-keys) into the
hidden prompt. The CLI verifies it with a balance read, then saves it locally
in your OS user-config directory. The login persists across terminals and
restarts; it does not edit your shell profile. The key is stored as plaintext
with owner-only file permissions on Unix systems.

For scripts, use `BRIDGLY_API_KEY` or override it for one invocation:

```bash theme={"dark"}
bridgly reddit get-user --username spez --api-key bgly_YOUR_KEY
```

The key priority is `--api-key` flag, then `BRIDGLY_API_KEY` environment variable, and finally saved login.
Prefer the hidden prompt or an environment secret over inline keys that can appear in
shell history and process arguments.

```bash theme={"dark"}
bridgly auth logout
```

Logout removes the saved credential. Revoke the key separately in the dashboard
if needed, and unset `BRIDGLY_API_KEY` separately if your shell still exports it.

## Find commands

```bash theme={"dark"}
bridgly list
bridgly list jobs --platform linkedin
bridgly list --search profile --format=json
bridgly help reddit get-user
bridgly github search-repositories --help
```

`list` needs no key and makes no API calls. It includes published scraping
endpoints and read-only account endpoints. Commands and flags are generated from
the shared API registry, so new published endpoints appear in the next CLI
release automatically.

## Call an endpoint

Use `bridgly <platform> <action> [--field value ...]`:

```bash theme={"dark"}
bridgly reddit get-user --username spez
bridgly reddit list-user-posts --username spez --count 5
bridgly github search-repositories --language TypeScript --stars.gte 100 --archived false
```

Flags use kebab-case; original camelCase field names are also accepted. Defaults
and validation come from the API schemas. Arrays accept multiple values, repeated
flags, or JSON. Objects accept JSON or dotted nested flags. A bare boolean flag
means `true`, and explicit `true` or `false` values are accepted.

```bash theme={"dark"}
bridgly github search-repositories --owners openai microsoft
bridgly github search-repositories --stars '{"gte":100}' --stars.lte 1000
```

Each scraping command makes one request with normal credit costs. The CLI does
not automatically retry or fetch additional pages.

## Check credits

```bash theme={"dark"}
bridgly balance
bridgly billing get-info --format table
```

These read credits and billing settings without spending scraping credits.
Payment operations and billing updates are not exposed.

## Format and save results

```bash theme={"dark"}
bridgly reddit get-user --username spez --format=json
bridgly reddit list-user-posts --username spez --format csv
bridgly reddit get-user --username spez --format table
bridgly reddit get-user --username spez --output ./data.json
bridgly reddit list-user-posts --username spez --output ./data.csv
```

API commands default to full JSON responses including `timeMs`, `creditsCost`,
and `data`. `list` defaults to a table. CSV and tables render `data`, flatten
nested objects with dotted column names, and keep nested arrays as JSON cells.
Arrays become rows; when `data` contains exactly one array field, that array is
used as the rows. Use JSON to retain all pagination and response metadata.

`--output` writes to a file, creates parent directories, and replaces existing
file contents. `.json` and `.csv` infer the format unless `--format` overrides it.
Progress and errors go to stderr so stdout can be piped into other tools.

Set `BRIDGLY_API_BASE_URL` or `--base-url` to use another API origin for local
development.
