# Install & Authenticate

Install the ByteKit CLI, authenticate, and learn the global flags shared by every command.

The `bytekit` CLI wraps the ByteKit API as shell subcommands — scrape, screenshot,
search, monitor, and more, straight from your terminal.

## Install

Install globally from npm:

```bash
npm install -g @hunt-labs/bytekit-cli
```

This puts the `bytekit` binary on your `PATH`. Verify the install:

```bash
bytekit --version
```

## Authenticate

Every command needs an API key. You can provide it two ways:

**1. Environment variable (recommended)**

Set `BYTEKIT_API_KEY` once and every command picks it up automatically:

```bash
export BYTEKIT_API_KEY="sk_live_your_api_key_here"
bytekit scrape create --url https://example.com
```

**2. The `--key` flag**

Pass the key inline for a single command (overrides the env var):

```bash
bytekit scrape create --url https://example.com --key sk_live_your_api_key_here
```

The resolution order is: `--key` flag → `BYTEKIT_API_KEY` environment variable.
If neither is set, the command exits with `Error: API key required. Pass --key or set BYTEKIT_API_KEY.`

## Global flags

These flags are available on every command:

| Flag | Description |
| --- | --- |
| `--key <key>` | API key for this invocation. Overrides `BYTEKIT_API_KEY`. |
| `--base-url <url>` | Override the API base URL (or set `BYTEKIT_BASE_URL`). |
| `--json` | Print the raw JSON response instead of the formatted, human-readable output. |
| `-V, --version` | Print the CLI version and exit. |
| `-h, --help` | Show help for the program or a subcommand. |

For example, to get the raw JSON response instead of the formatted output:

```bash
bytekit scrape create --url https://example.com --json
```

## Next steps

- [Scrape](https://bytekit.com/docs/cli/scrape) — capture URL content as markdown, HTML, or structured data.
- [Screenshots](https://bytekit.com/docs/cli/screenshots) — render full-page or viewport screenshots.
- [Monitors](https://bytekit.com/docs/cli/monitors) — track page changes on a schedule.
- [API Reference](https://bytekit.com/docs/api) — the underlying REST endpoints.