AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the BatchGetSecretValue operation. Retrieves the contents of the encrypted fields SecretString or SecretBinary for up to 20 secrets. To retrieve a single secret, call GetSecretValue.

To choose which secrets to retrieve, you can specify a list of secrets by name or ARN, or you can use filters. If Secrets Manager encounters errors such as AccessDeniedException while attempting to retrieve any of the secrets, you can see the errors in Errors in the response.

Secrets Manager generates CloudTrail GetSecretValue log entries for each secret you request when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see Logging Secrets Manager events with CloudTrail.

Required permissions: secretsmanager:BatchGetSecretValue, and you must have secretsmanager:GetSecretValue for each secret. If you use filters, you must also have secretsmanager:ListSecrets. If the secrets are encrypted using customer-managed keys instead of the Amazon Web Services managed key aws/secretsmanager, then you also need kms:Decrypt permissions for the keys. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.

Inheritance Hierarchy


Namespace: Amazon.SecretsManager.Model
Assembly: AWSSDK.SecretsManager.dll
Version: 3.x.y.z


public class BatchGetSecretValueRequest : AmazonSecretsManagerRequest

The BatchGetSecretValueRequest type exposes the following members



Public Property Filters System.Collections.Generic.List<Amazon.SecretsManager.Model.Filter>

Gets and sets the property Filters.

The filters to choose which secrets to retrieve. You must include Filters or SecretIdList, but not both.

Public Property MaxResults System.Int32

Gets and sets the property MaxResults.

The number of results to include in the response.

If there are more results available, in the response, Secrets Manager includes NextToken. To get the next results, call BatchGetSecretValue again with the value from NextToken. To use this parameter, you must also use the Filters parameter.

Public Property NextToken System.String

Gets and sets the property NextToken.

A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call BatchGetSecretValue again with this value.

Public Property SecretIdList System.Collections.Generic.List<System.String>

Gets and sets the property SecretIdList.

The ARN or names of the secrets to retrieve. You must include Filters or SecretIdList, but not both.


The following example gets the values for three secrets.

To retrieve the secret values for a group of secrets listed by name

var client = new AmazonSecretsManagerClient();
var response = client.BatchGetSecretValue(new BatchGetSecretValueRequest 
    SecretIdList = new List<string> {

List<APIErrorType> errors = response.Errors;
List<SecretValueEntry> secretValues = response.SecretValues;


Version Information

Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5