[Yandex Cloud documentation](../../index.md) > [Command line interface](../index.md) > [Step-by-step guides](index.md) > Working with CLI command versions

# Working with CLI command versions 

To quickly release new service functionality and provide broader coverage of public API calls, the Yandex Cloud CLI is gradually introducing a new approach to generating command trees directly from the public gRPC API [proto specifications](https://github.com/yandex-cloud/cloudapi/tree/master/yandex/cloud).

With the new approach in place, new commands and their parameters are not always the same as the previous ones. For backward compatibility, versioning of service command trees has been implemented. 

In each group of service commands, e.g., `yc compute`, the _main command branch_ remains as before: `yc compute [ instance | image | disk | ... ]`, but branches _with command version numbers_ are also added, e.g., `yc compute v0 [ instance | image | disk | ... ]`.

The main branch of commands must match one of the versions. If there is only one version, the main branch completely duplicates it.

The information on adding or removing a command version, as well as on switching the main branch to another version, is published in [CLI releases](../release-notes.md).

{% note tip %}

Use the current version of the CLI and the command tree the service has assigned as the main one. If CLI commands are called from scripts, CI/CD, or other automated processes, first check command compatibility when migrating to a new CLI version. While the legacy version of the commands is available, you can [explicitly state it in specific commands](command-versioning.md#use-version) or [set it as the default version](command-versioning.md#default-version).

{% endnote %}

## Getting info on available versions {#get-versions}

If the service supports multiple command versions, there is a separate branch with version number available for each one of them.

To learn about available versions and which one is used in the main branch, run this command:

```bash
yc <service_name> --help
```

Here is an example:

```bash
yc baremetal --help
```

Result:

```text
Command tree v1 (new CLI interface) is the default. Run `yc baremetal v1 <command>`.
Legacy command tree v0 is also available: `yc baremetal v0 <command>`.
Set `services.baremetal.version: v0` or `services.baremetal.version: v1` in your profile to change the default.
```

The same information is also provided on the overview page of the relevant service in the CLI reference, e.g., [yc baremetal](../cli-ref/baremetal/cli-ref/index.md) or [yc smartwebsecurity](../cli-ref/smartwebsecurity/cli-ref/index.md).

## Using a specific version {#use-version}

To use a specific version, specify it after the service name in the command:

```bash
yc <service_name> v<version_number> <command>
```

Here is an example:

```bash
yc baremetal v0 server list
```

## Changing the main branch version {#default-version}

To override the main branch version for a selected CLI profile, run this command:

```bash
yc config set services.<service_name>.version v<version_number>
```

Here is an example:

```bash
yc config set services.smartwebsecurity.version v0
```

#### Useful links

* [CLI reference](../cli-ref/index.md)
* [CLI releases](../release-notes.md)
* [Managing profile parameters](profile/manage-properties.md)