> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ocpplab.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ocpplab.io/_mcp/server.

# ocpplab-cli

`ocpplab-cli` is a single binary generated from the OCPPLab API. Every operation in the [API Reference](/api-reference) is a command, grouped by domain:

```bash
ocpplab-cli <domain> <resource> <operation> [flags]
ocpplab-cli evcharger catalog list_brands --limit 5
```

## Install

Install it with npm. npm downloads only the binary for your platform: macOS and Linux on x64 or arm64, and Windows on x64.

```bash
npm i -g @ocpplab/cli
ocpplab-cli --version
```

Or run it once without installing:

```bash
npx @ocpplab/cli health live
```

## Sign in

**`Browser`**

```bash Browser
ocpplab-cli auth login
```

**`Token`**

```bash Token
export OCPPLAB_TOKEN="<token>"
```

`auth login` opens your browser: sign in, choose the organization, and select **Allow**. The CLI keeps the access and refresh tokens in your OS keyring and refreshes them on its own. On a machine without a browser, such as CI, set `OCPPLAB_TOKEN` to an SDK token instead. When both are set, `OCPPLAB_TOKEN` wins.

| Command                               | Does                                         |
| ------------------------------------- | -------------------------------------------- |
| `ocpplab-cli auth login`              | Signs in with your browser                   |
| `ocpplab-cli auth login --with-token` | Reads a token from stdin into the keyring    |
| `ocpplab-cli auth status`             | Shows which credential each request will use |
| `ocpplab-cli auth logout`             | Removes stored credentials                   |

## Your first commands

```bash
# Check the API is up
ocpplab-cli health live

# Browse the charger catalog
ocpplab-cli evcharger catalog list_brands --limit 5

# Plug a cable into a virtual charger, then read the command's status
ocpplab-cli evcharger commands plug_connector \
  --target.identity DEMO-CP-001 --payload.evse-id 1 --payload.connector-id 1
ocpplab-cli evcharger commands get_status --command-id <command-id>
```

Nested fields are flags with dots (`--target.identity`), or pass a whole object as JSON (`--target '{"identity": "DEMO-CP-001"}'`).

## Find a command

```bash
ocpplab-cli --help                      # domains
ocpplab-cli evcharger commands --help   # operations in a resource
ocpplab-cli evcharger commands start_session --help   # flags of one operation
```

## Use it from an AI agent

The CLI prints JSON when its output is piped, and describes itself as JSON:

```bash
ocpplab-cli --schema                # every operation and its parameters
ocpplab-cli generate-skills         # SKILL.md files for coding agents
```

To give an agent the API as tools instead, see [MCP](/mcp/overview).