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

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

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

Gets a key policy attached to the specified KMS key.

**Cross-account use**: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

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

**Related operations**: PutKeyPolicy

## Headers

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

## Request body

- GetKeyPolicyRequest
  - `KeyId` string, required — <p>Gets the key policy for the specified KMS key.</p> <p>Specify the key ID or key ARN of the KMS key.</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>
  - `PolicyName` string, required — Specifies the name of the key policy. The only valid name is <code>default</code>. To get the names of key policies, use <a>ListKeyPolicies</a>.

## Response `200`

Success

- GetKeyPolicyResponse
  - `Policy` string — A key policy document in JSON format.

## Other responses

- `480` — NotFoundException
- `481` — InvalidArnException
- `482` — DependencyTimeoutException
- `483` — KMSInternalException
- `484` — 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)
