---
title: "POST /#X-Amz-Target=TrentService.ListGrants"
method: POST
path: "/#X-Amz-Target=TrentService.ListGrants"
---

# POST /#X-Amz-Target=TrentService.ListGrants

`POST /#X-Amz-Target=TrentService.ListGrants`

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

You must specify the KMS key in all requests. You can filter the grant list by grant ID or grantee principal.

For detailed information about grants, including grant terminology, see [Grants in KMS](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) in the __Key Management Service Developer Guide__ . For examples of working with grants in several programming languages, see [Programming grants](https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html).

The `GranteePrincipal` field in the `ListGrants` response usually contains the user or role designated as the grantee principal in the grant. However, when the grantee principal in the grant is an Amazon Web Services service, the `GranteePrincipal` field contains the [service principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services), which might represent several different grantee principals.

**Cross-account use**: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key ARN in the value of the `KeyId` parameter.

**Required permissions**: [kms:ListGrants](https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

**Related operations:**

*   CreateGrant
    
*   ListRetirableGrants
    
*   RetireGrant
    
*   RevokeGrant

## Query parameters

- `Limit` string
- `Marker` string

## Headers

- `X-Amz-Target` 'TrentService.ListGrants', required

## Request body

- ListGrantsRequest
  - `Limit` integer — <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p> <p>This value is optional. If you include a value, it must be between 1 and 100, inclusive. If you do not include a value, it defaults to 50.</p>
  - `Marker` string — Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.
  - `KeyId` string, required — <p>Returns only grants for the specified KMS key. This parameter is required.</p> <p>Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN.</p> <p>For example:</p> <ul> <li> <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code> </p> </li> <li> <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code> </p> </li> </ul> <p>To get the key ID and key ARN for a KMS key, use <a>ListKeys</a> or <a>DescribeKey</a>.</p>
  - `GrantId` string — Returns only the grant with the specified grant ID. The grant ID uniquely identifies the grant.
  - `GranteePrincipal` string — Returns only grants where the specified principal is the grantee principal for the grant.

## Response `200`

Success

- ListGrantsResponse
  - `Grants` GrantListEntry[] — A list of grants.
    - `KeyId` string — The unique identifier for the KMS key to which the grant applies.
    - `GrantId` string — The unique identifier for the grant.
    - `Name` string — The friendly name that identifies the grant. If a name was provided in the <a>CreateGrant</a> request, that name is returned. Otherwise this value is null.
    - `CreationDate` string, date-time — The date and time when the grant was created.
    - `GranteePrincipal` string — <p>The identity that gets the permissions in the grant.</p> <p>The <code>GranteePrincipal</code> field in the <code>ListGrants</code> response usually contains the user or role designated as the grantee principal in the grant. However, when the grantee principal in the grant is an Amazon Web Services service, the <code>GranteePrincipal</code> field contains the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services">service principal</a>, which might represent several different grantee principals.</p>
    - `RetiringPrincipal` string — The principal that can retire the grant.
    - `IssuingAccount` string — The Amazon Web Services account under which the grant was issued.
    - `Operations` GrantOperation[] — The list of operations permitted by the grant.
    - `Constraints` object — A list of key-value pairs that must be present in the encryption context of certain subsequent operations that the grant allows.
      - `EncryptionContextSubset` object — A list of key-value pairs that must be included in the encryption context of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operation</a> request. The grant allows the cryptographic operation only when the encryption context in the request includes the key-value pairs specified in this constraint, although it can include additional key-value pairs.
      - `EncryptionContextEquals` object — A list of key-value pairs that must match the encryption context in the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operation</a> request. The grant allows the operation only when the encryption context in the request is the same as the encryption context specified in this constraint.
  - `NextMarker` string — When <code>Truncated</code> is true, this element is present and contains the value to use for the <code>Marker</code> parameter in a subsequent request.
  - `Truncated` boolean — A 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 <code>NextMarker</code> element in thisresponse to the <code>Marker</code> parameter in a subsequent request.

## Other responses

- `480` — NotFoundException
- `481` — DependencyTimeoutException
- `482` — InvalidMarkerException
- `483` — InvalidGrantIdException
- `484` — InvalidArnException
- `485` — KMSInternalException
- `486` — KMSInvalidStateException

---

[API](https://skmtc.net/aws/apis/kms.md) · [All operations](https://skmtc.net/aws/apis/kms/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/kms/versions/f92d678d2025/schema)
