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

# CLI

> Official CLI for the OpenRegister API

The OpenRegister CLI is the official command-line interface for the OpenRegister REST API.

## Installation

Requires Go 1.22 or later.

```bash theme={"dark"}
go install 'github.com/oregister/openregister-cli/cmd/openregister@latest'
```

The binary is placed in your Go bin directory after installation:

* **Default location:** `$HOME/go/bin` (or `$GOPATH/bin` if `GOPATH` is set)
* **Check your path:** Run `go env GOPATH` to see the base directory

If the `openregister` command is not found after installation, add the Go bin directory to your `PATH`:

<Tabs>
  <Tab title=".zshrc">
    ```bash theme={"dark"}
    export PATH="$PATH:$(go env GOPATH)/bin"
    ```
  </Tab>

  <Tab title=".bashrc">
    ```bash theme={"dark"}
    export PATH="$PATH:$(go env GOPATH)/bin"
    ```
  </Tab>
</Tabs>

## Usage

The CLI follows a resource-based command structure:

```bash theme={"dark"}
openregister [resource] <command> [flags...]
```

Example — fetch company details:

```bash theme={"dark"}
openregister company get-details-v1 \
  --api-key 'My API Key' \
  --company-id DE-HRB-F1103-267645
```

For details about any command, use the `--help` flag:

```bash theme={"dark"}
openregister --help
openregister company --help
```

## Environment Variables

| Variable               | Description                                                        | Required |
| ---------------------- | ------------------------------------------------------------------ | -------- |
| `OPENREGISTER_API_KEY` | Your API key, sent as a Bearer token in the `Authorization` header | Yes      |

## Global Flags

| Flag                | Description                                                                           |
| ------------------- | ------------------------------------------------------------------------------------- |
| `--api-key`         | API key (can also be set with `OPENREGISTER_API_KEY`)                                 |
| `--help`            | Show command line usage                                                               |
| `--debug`           | Enable debug logging, including HTTP request/response details                         |
| `--version`, `-v`   | Show the CLI version                                                                  |
| `--base-url`        | Use a custom API backend URL                                                          |
| `--format`          | Output format: `auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`            |
| `--format-error`    | Output format for errors: `auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml` |
| `--transform`       | Transform output using [GJSON](https://github.com/tidwall/gjson) syntax               |
| `--transform-error` | Transform error output using GJSON syntax                                             |
