Get
Returns the specified API key.
To get the list of available API keys, make a List request.
- TypeScript
- Python
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);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.iam.v1.api_key_service_pb2_grpc import ApiKeyServiceStub
from yandex.cloud.iam.v1.api_key_service_pb2 import GetApiKeyRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(ApiKeyServiceStub)
response = service.Get(GetApiKeyRequest(api_key_id="apiKeyId"))
print(response)
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.