[Yandex Cloud documentation](../../index.md) > [Yandex Lockbox](../index.md) > [Step-by-step guides](index.md) > Deactivating and activating a secret

# Deactivating and activating a secret

A secret can be either active or deactivated. When a secret is active, it enables access to both its metadata and content (key-value pairs). When deactivated, it allows access only to its metadata, with the secret content being inaccessible.

## Deactivating a secret {#secret-deactivate}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder the secret belongs to.
    1. Navigate to **Lockbox**.
    1. Next to the secret you need, click ![image](../../_assets/console-icons/ellipsis.svg) and select ![image](../../_assets/console-icons/toggle-off.svg) **Deactivate**.
    1. Confirm its deactivation.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the CLI command for getting secret deactivation info:

      ```bash
      yc lockbox secret deactivate --help
      ```
  1. Deactivate a secret by specifying its ID or name:

      ```bash
      yc lockbox secret deactivate <secret_name>
      ```
      Result:

      ```text
      id: e6qkkp3k29jf********
      folder_id: b1go3el0d8fs********
      created_at: "2023-11-08T13:14:34.676Z"
      name: first-secret
      status: INACTIVE
      current_version:
        id: e6qor8pe3ju7********
        secret_id: e6qkkp3k29jf********
        created_at: "2023-11-08T13:14:34.676Z"
        status: ACTIVE
        payload_entry_keys:
          - secret-key
      ```

- API {#api}

  To deactivate a secret, use the [deactivate](../api-ref/Secret/deactivate.md) REST API method for the [Secret](../api-ref/Secret/index.md) resource or the [SecretService/Deactivate](../api-ref/grpc/Secret/deactivate.md) gRPC API call.

{% endlist %}

## Activating a secret {#secret-activate}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder the secret belongs to.
    1. Navigate to **Lockbox**.
    1. Next to the secret you need, click ![image](../../_assets/console-icons/ellipsis.svg) and select ![image](../../_assets/console-icons/toggle-on.svg) **Activate secret**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the CLI command for getting secret activation info:

      ```bash
      yc lockbox secret activate --help
      ```
  1. Activate a secret by specifying its ID or name:

      ```bash
      yc lockbox secret activate <secret_name>
      ```
      Result:

      ```text
      id: e6qkkp3k29jf********
      folder_id: b1go3el0d8fs********
      created_at: "2023-11-08T13:14:34.676Z"
      name: first-secret
      status: ACTIVE
      current_version:
        id: e6qor8pe3ju7********
        secret_id: e6qkkp3k29jf********
        created_at: "2023-11-08T13:14:34.676Z"
        status: ACTIVE
        payload_entry_keys:
          - secret-key
      ```

- API {#api}

  To activate a secret, use the [activate](../api-ref/Secret/activate.md) REST API method for the [Secret](../api-ref/Secret/index.md) resource or the [SecretService/Activate](../api-ref/grpc/Secret/activate.md) gRPC API call.

{% endlist %}

#### Useful links {#see-also}

[Secrets in Yandex Lockbox](../concepts/secret.md)