Skip to main content

List

Retrieves the list of API keys for the specified service account.

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const ListApiKeysRequest = cloudApi.iam.api_key_service.ListApiKeysRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.ApiKeyServiceClient);

const result = await client.list(
ListApiKeysRequest.fromPartial({
// serviceAccountId: "serviceAccountId",
// pageSize: 0,
// pageToken: "pageToken"
})
);
console.log(result);
})();

ListApiKeysRequest

serviceAccountId : string

ID of the service account to list API keys for. To get the service account ID, use a yandex.cloud.iam.v1.ServiceAccountService.List request. If not specified, it defaults to the subject that made the request.

pageSize : int64

The maximum number of results per page to return. If the number of available results is larger than page_size, the service returns a ListApiKeysResponse.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100.

pageToken : string

Page token. To get the next page of results, set page_token to the ListApiKeysResponse.next_page_token returned by a previous list request.

ListApiKeysResponse

apiKeys : ApiKey

List of API keys.

nextPageToken : string

This token allows you to get the next page of results for list requests. If the number of results is larger than ListApiKeysRequest.page_size, use the next_page_token as the value for the ListApiKeysRequest.page_token query parameter in the next list request. Each subsequent list request will have its own next_page_token to continue paging through the results.

ApiKey

An ApiKey resource. For more information, see Api-Key.

id : string

ID of the API Key.

serviceAccountId : string

ID of the service account that the API key belongs to.

createdAt : google.protobuf.Timestamp

Creation timestamp.

description : string

Description of the API key. 0-256 characters long.

lastUsedAt : google.protobuf.Timestamp

Timestamp for the last authentication using this API key.

scope : string

Scope of the API key. 0-256 characters long.

expiresAt : google.protobuf.Timestamp

API key expiration timestamp.