Skip to main content

ListGrants

Gets a list of all grants for the specified KMS key.

Description

The ListGrants operation gets a list of all grants for the specified KMS key. A grant is a policy instrument that allows QKMS principals to use KMS keys in cryptographic operations. A grant also can allow QKMS principals to view a KMS key (DescribeKey) and create and manage grants.

note
  • You must specify the KMS key in all requests.
  • You can filter the grant list by grant ID or grantee principal.
  • The GranteePrincipal field in the grant does not contain the grantee principal's ARN until after the grant is used.

Request Syntax

Headers

NameDescriptionRequiredType
Content-TypeMust be "application/x-amz-json-1.1"Yesstring
X-Amz-TargetMust be "TrentService.ListGrants"Yesstring

Request Body

NameDescriptionRequiredType
KeyIdThe identifier of the KMS key. The value can be the ID or ARN of a KMS key.Yesstring
LimitUse this parameter to specify the maximum number of items to return. When this value is present, QKMS does not return more than the specified number of items, but it might return fewer.Nointeger
MarkerUse this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of NextMarker from the truncated response you just received.Nostring
GrantIdReturns only the grant with the specified grant ID.Nostring
GranteePrincipalReturns only grants where the specified principal is the grantee principal for the grant.Nostring
POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.ListGrants
{ "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "Limit": 20, "Marker": "eyJlbmNyeXB0ZWREYXRhIjpbMTIsMzQsNTYsNzgsOTBdfQ==" }
Values in italics indicate user input and should be replaced with actual values.

Response Elements

NameDescriptionRequiredType
GrantsA list of grants.NoString
NextMarkerWhen Truncated is true, this value is present and contains the value to use for the Marker parameter in a subsequent request.NoString
TruncatedA flag that indicates whether there are more items in the list. When this value is true, the list in this response is truncated. To get more items, pass the value of the NextMarker element in subsequent requests.NoString

Special Errors

Error CodeDescription
DependencyTimeoutExceptionThe system timed out while trying to fulfill the request.
InvalidArnExceptionThe request was rejected because a specified ARN was not valid.
InvalidGrantIdExceptionThe request was rejected because the specified grant ID is not valid.
InvalidMarkerExceptionThe request was rejected because the marker that specifies where pagination should next begin is not valid.
KMSInternalExceptionAn internal error occurred.
KMSInvalidStateExceptionThe request was rejected because the key state is not valid for this operation.
NotFoundExceptionThe request was rejected because the specified entity or resource could not be found.

Permissions

To use the ListGrants operation, you must have the following permissions:

  • kms:ListGrants on the KMS key (specified in the policy)

Try It Out

Test ListGrants

List grants for a KMS key.

Coming Soon

This feature is currently under development and will be available soon.