Skip to main content

Get

Returns the specified API key.

To get the list of available API keys, make a List request.

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

const GetApiKeyRequest = cloudApi.iam.api_key_service.GetApiKeyRequest;

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

const result = await client.get(
GetApiKeyRequest.fromPartial({
apiKeyId: "apiKeyId",
})
);
console.log(result);
})();

GetApiKeyRequest

apiKeyId : string

ID of the API key to return. To get the API key ID, use a ApiKeyService.List request.

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.