---
title: "POST /#X-Amz-Target=PaymentCryptographyControlPlane.PutResourcePolicy"
method: POST
path: "/#X-Amz-Target=PaymentCryptographyControlPlane.PutResourcePolicy"
---

# POST /#X-Amz-Target=PaymentCryptographyControlPlane.PutResourcePolicy

`POST /#X-Amz-Target=PaymentCryptographyControlPlane.PutResourcePolicy`

Attaches or replaces a resource-based policy on an Amazon Web Services Payment Cryptography key. A resource-based policy can grant cross-account access to your key.

If the policy would grant public access, the request fails with a `PublicPolicyException`.

To remove a resource-based policy from a key, use [DeleteResourcePolicy](https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DeleteResourcePolicy.html).

**Cross-account use:** This operation can't be used across different Amazon Web Services accounts.

**Related operations:**

*   [GetResourcePolicy](https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetResourcePolicy.html)
    
*   [DeleteResourcePolicy](https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DeleteResourcePolicy.html)

## Headers

- `X-Amz-Target` 'PaymentCryptographyControlPlane.PutResourcePolicy', required

## Request body

- PutResourcePolicyInput
  - `ResourceArn` string, required — The <code>KeyARN</code> of the key to attach the resource-based policy to.
  - `Policy` string, required — The resource-based policy to attach to the key, in JSON format.

## Response `200`

Success

- PutResourcePolicyOutput
  - `ResourceArn` string, required — The <code>KeyARN</code> of the key that the resource-based policy was attached to.
  - `Policy` string, required — The resource-based policy that was attached to the key.

## Other responses

- `480` — ServiceQuotaExceededException
- `481` — ServiceUnavailableException
- `482` — ValidationException
- `483` — ConflictException
- `484` — AccessDeniedException
- `485` — ResourceNotFoundException
- `486` — ThrottlingException
- `487` — InternalServerException
- `488` — PublicPolicyException

---

[API](https://skmtc.net/aws/apis/payment-cryptography.md) · [All operations](https://skmtc.net/aws/apis/payment-cryptography/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/payment-cryptography/revisions/1b0b83160e8d/schema)
