[Yandex Cloud documentation](../../../index.md) > [Yandex Identity and Access Management](../../index.md) > [Step-by-step guides](../index.md) > Service accounts > Viewing the folder's service accounts

# Getting a list of the folder's service accounts

You can get a list of all [service accounts](../../concepts/users/service-accounts.md) available in the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder).

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), click ![image](../../../_assets/console-icons/layout-side-content-left.svg) or ![image](../../../_assets/console-icons/chevron-down.svg) in the top panel and select the folder whose service accounts you want listed.
  1. In the list of services, select **Identity and Access Management**.
  1. In the left-hand panel, select ![FaceRobot](../../../_assets/console-icons/face-robot.svg) **Service accounts**.
  1. The **Service accounts** page will display a list of all the folder's service accounts.

   ![List of service accounts](../../../_assets/iam/sa-list-get.png)

- 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.

  Get a list of service accounts in the default folder:

  ```bash
  yc iam service-account list
  ```

  Result:

  ```
  +----------------------+--------------+--------+---------------------+-----------------------+
  |          ID          |     NAME     | LABELS |     CREATED AT      | LAST AUTHENTICATED AT |
  +----------------------+--------------+--------+---------------------+-----------------------+
  | ajeg2b2et02f******** | my-robot     |        | 2024-09-08 18:59:45 | 2025-02-18 10:10:00   |
  | ajegtlf2q28a******** | account-name |        | 2023-06-27 16:18:18 | 2025-02-18 10:20:00   |
  +----------------------+--------------+--------+---------------------+-----------------------+
  ```

  Where:

  * `ID`: Service account ID.
  * `NAME`: Service account name.
  * `LABELS`: Service account description.
  * `CREATED AT`: Service account creation date and time.
  * `LAST AUTHENTICATED AT`: Last authentication date and time.

- API {#api}

  1. [Find out the ID of the folder](../../../resource-manager/operations/folder/get-id.md) whose list of service accounts you want to view.
  1. Get a list of service accounts in the folder using the [list](../../api-ref/ServiceAccount/list.md) REST API method for the [ServiceAccount](../../api-ref/ServiceAccount/index.md) resource:

      ```bash
      export FOLDER_ID=b1gvmob95yys********
      export IAM_TOKEN=CggaATEVAgA...
      curl \
        --header "Authorization: Bearer ${IAM_TOKEN}" \
        "https://iam.api.cloud.yandex.net/iam/v1/serviceAccounts?folderId=${FOLDER_ID}"
      ```

      Result:

      ```text
      {
       "serviceAccounts": [
        {
         "id": "ajeg2b2et02f********",
         "folderId": "b1gvmob95yys********",
         "createdAt": "2024-09-08T18:59:45Z",
         "name": "my-robot",
         "lastAuthenticatedAt": "2025-02-18T10:10:00Z"
        },
        {
         "id": "ajegtlf2q28a********",
         "folderId": "b1gvmob95yys********",
         "createdAt": "2023-06-27T16:18:18Z",
         "name": "account-name",
         "lastAuthenticatedAt": "2025-02-18T10:20:00Z"
        }
       ]
      }
      ```

     You can also get a list of service accounts in a folder using the [ServiceAccountService/List](../../api-ref/grpc/ServiceAccount/list.md) gRPC API call.

{% endlist %}