# CLI

*Jump to:*

* [Client Keys](#client-keys)
* [Client Token](#client-token)
* [Clusters](#clusters)
* [Conf](#conf)
* [Events](#events)
* [Help](#help)
* [Login](#login)
* [Logout](#logout)
* [Nodes](#nodes)
* [Profile](#profile)
* [Status](#status)
* [Update-Password](#update-password)

Usage: `bcl <COMMAND>`

The following commands are available:

| Command           | Description                                     |
| ----------------- | ----------------------------------------------- |
| `client-keys`     | Manage Bloq client key(s)                       |
| `client-token`    | Generate new client token(s)                    |
| `clusters`        | Manage Bloq node clusters                       |
| `conf`            | Manage configuration                            |
| `events`          | Get Bloq Events                                 |
| `help`            | Display help for `bcl`                          |
| `login`           | Login to Bloq account                           |
| `logout`          | Clear local user data                           |
| `nodes`           | Manage Bloq nodes                               |
| `profile`         | Retrieve user profile                           |
| `signup`          | Setup a new Bloq account                        |
| `status`          | Get Bloq services status                        |
| `update-password` | Update user password                            |
| `verify`          | Verify Bloq account and complete signup process |

### Client Keys <a href="#client-keys" id="client-keys"></a>

Client Keys are required to access Bloq services and generate Access and Refresh tokens.

The following operations are supported within `bcl client-keys <OPERATION>`

| Operation      | Description             |
| -------------- | ----------------------- |
| create         | Create a new client-key |
| list (default) | Get list of client-keys |
| remove         | Remove a client-key     |

#### Create Client Keys <a href="#create-client-keys" id="create-client-keys"></a>

The `bcl client-keys create` operation enables users to create a *Client Key ID* and *Client Key Secret* pair.

A user must create a client-key in order to use Bloq services.

{% hint style="warning" %}
**WARNING**

Make sure to save your *Client Key Secret* in a secure location. Secrets are not viewable in the future. Upon *Client Key Secret* generation, the secret is automatically copied to the clipboard for easy storage.
{% endhint %}

#### List Client Keys <a href="#list-client-keys" id="list-client-keys"></a>

The `bcl client-keys list` operation enables users to list existing keys by *Client Key ID*. *Client Key Secret* are not viewable.

#### Remove Client Keys <a href="#remove-client-keys" id="remove-client-keys"></a>

The `bcl client-keys remove` operation enables users to remove a *Client Key ID* and *Client Key Secret* pair.

### Client Token <a href="#client-token" id="client-token"></a>

The `bcl client-token` command creates a *clientAccessToken* and *refreshToken* for use with Bloq services.

{% hint style="success" %}
**TIP**

A client-key pair must be created prior to creating a *clientAccessToken* or *refreshToken*. Use the `bcl client-keys` command if `client-keys` do not currently exist.
{% endhint %}

A *clientAccessToken* is a short-lived (1 hr) token that is required by applications to access Bloq services (Nodes, etc).

A *refreshToken* is a longer term (1 year) token that enables your application to request a new *clientAccessToken* to the authentication server. When the *clientAccessToken* expires, the *refreshToken* will let you obtain a new *clientAccessToken*. The *refreshToken* is renewed every time a new *clientAccessToken* is requested.

{% hint style="warning" %}
**WARNING**

Make sure to save your *clientAccessToken* and *refreshToken* in a secure location. Upon token generation, the they will no longer be possible to access again.
{% endhint %}

### Clusters <a href="#clusters" id="clusters"></a>

The `bcl clusters <METHOD> <OPTIONAL FLAGS>` command enables the user to interact with and manage their registered Bloq clusters. The `<METHOD>` is the clusters method that can be invoked.

Valid `<METHOD>` options are:

* chains
* info
* list
* remove
* services

#### Optional Flags <a href="#optional-flags" id="optional-flags"></a>

The following are the list of optional flags for the `bcl clusters` command:

| Optional Flag   | Description                                                                                 |
| --------------- | ------------------------------------------------------------------------------------------- |
| -a, --all       | List all clusters                                                                           |
| -c, --capacity  | Specify the node capacity for the cluster (default: 2)                                      |
| -i, --clusterId | Specify the cluster to interact with                                                        |
| -s, --serviceId | Specify a specific clusters service                                                         |
| -t, --authType  | Speciy the authentication type for clusters (default: basic) Options include `basic`, `jwt` |

{% hint style="success" %}
**TIP**

`bcl clusters` methods do not require any additional flags. If more input is required, the client will prompt you for that information upon command execution.
{% endhint %}

### Conf <a href="#conf" id="conf"></a>

#### Set Client Keys <a href="#set-client-keys" id="set-client-keys"></a>

In order to reload your previous Client Keys to the CLI, use the following commands:

`bcl conf --key clientId --value <Previous_clientId>`

`bcl conf --key clientSecret --value <Previous_clientSecret>`

#### Retrieve Account Access Token <a href="#retrieve-account-access-token" id="retrieve-account-access-token"></a>

To retrieve the `Account Access Token` that is generated upon `bcl login`, use the following command:

`bcl conf accessToken`

### Events <a href="#events" id="events"></a>

The `bcl events` command provides a history of the most recent events.

Use the `-s=<service>` flag to filter events by services.

Valid options for `<service>` are:

* accounts
* nodes

### Help <a href="#help" id="help"></a>

The `bcl help` command provides the help screen.

### Login <a href="#login" id="login"></a>

The `bcl login -u <Account ID>` command authenticates and logs the user into the CLI.

The *Account ID* is contained within the user signup confirmation email.

### Logout <a href="#logout" id="logout"></a>

The `bcl logout` command logs the user out of the CLI and removes any local user data from the CLI.

### Nodes <a href="#nodes" id="nodes"></a>

The `bcl nodes <METHOD> <OPTIONAL FLAGS>` command enables the user to access Bloq Nodes services and manage their registered Bloq Nodes. The `<METHOD>` is the Nodes service method that can be invoked.

Valid `<METHOD>` options are:

* chains
* info
* list
* remove
* services

#### Optional Flags <a href="#optional-flags-3" id="optional-flags-3"></a>

The following are the list of optional flags for the `bcl nodes` command:

| Optional Flag   | Description                                                                               |
| --------------- | ----------------------------------------------------------------------------------------- |
| -a, --all       | List all nodes                                                                            |
| -i, --nodeId    | Specify the node to interact with                                                         |
| -s, --serviceId | Specify an exact service encompassed by Bloq Nodes                                        |
| -t, --authType  | Speciy the authentication type for a node (default: basic) Options include `basic`, `jwt` |

{% hint style="success" %}
**TIP**

`bcl nodes` methods do not require any additional flags. If more input is required, the client will prompt you for that information upon command execution.
{% endhint %}

### Profile <a href="#profile" id="profile"></a>

The `bcl profile` command provides information about the user including:

* Account ID
* Display Name
* Email Address
* Verification Status

### Status <a href="#status" id="status"></a>

The `bcl status` command provides the online status of Bloq services.

### Update-Password <a href="#update-password" id="update-password"></a>

The `bcl update-password` command provides the ability for the user to change their existing password associated with their Bloq account.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bloq.com/advanced-documentation/technical-reference/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
