[Yandex Cloud documentation](../../../index.md) > [Yandex Identity and Access Management](../../index.md) > [Step-by-step guides](../index.md) > Authentication > IAM tokens > Revoking an IAM token

# Revoking an IAM token

You can revoke an [IAM token](../../concepts/authorization/iam-token.md) you got earlier. You may need to do this, for example, if the token is [compromised](../compromised-credentials.md) or if you are getting a new one.

To revoke an IAM token:

{% list tabs group=instructions %}

- 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. Check out the description of the IAM token revocation command:

      ```bash
      yc iam revoke-token --help
      ```

  1. Revoke the IAM token by specifying it in this command:

      ```bash
      yc iam revoke-token \
        --iam-token "<IAM_token>"
      ```

      Result:

      ```text
      subject_id: ajei280a73vc********
      ```

- API {#api}

  Run an http request specifying the IAM token to revoke:

  ```bash
  curl \
    --request POST \
    --header 'Content-Type: application/json' \
    --header "Authorization: Bearer <IAM_token>" \
    --data '{
        "iamToken": "<IAM_token>"
    }' \
    https://iam.api.cloud.yandex.net/iam/v1/tokens:revoke
  ```

  Result:

  ```json
  {
    "subjectId": "ajei280a73vc********"
  }

{% endlist %}

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

* [Getting an IAM token for a Yandex account](create.md)
* [Getting an IAM token for a federated account](create-for-federation.md)
* [Getting an IAM token for a service account](create-for-sa.md)