{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-kms/json-schema/amazon-kms-create-grant-request-schema.json",
  "title": "CreateGrantRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-kms-grant-api-openapi.yml#/components/schemas/CreateGrantRequest",
  "type": "object",
  "properties": {
    "KeyId": {
      "type": "string",
      "description": "Identifies the KMS key for the grant. The grant gives principals permission to use this KMS key. 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. For example: Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey."
    },
    "GranteePrincipal": {
      "type": "string",
      "description": "The identity that gets the permissions specified in the grant. To specify the grantee principal, use the Amazon Resource Name (ARN) of an Amazon Web Services principal. Valid principals include Amazon Web Services accounts, IAM users, IAM roles, federated users, and assumed role users. For help with the ARN syntax for a principal, see IAM ARNs in the Identity and Access Management User Guide . You must specify either GranteePrincipal or GranteeServicePrincipal, but not both."
    },
    "RetiringPrincipal": {
      "type": "string",
      "description": "The principal that has permission to use the RetireGrant operation to retire the grant. To specify the principal, use the Amazon Resource Name (ARN) of an Amazon Web Services principal. Valid principals include Amazon Web Services accounts, IAM users, IAM roles, federated users, and assumed role users. For help with the ARN syntax for a principal, see IAM ARNs in the Identity and Access Management User Guide . The grant determines the retiring principal. Other principals might have permission to retire the grant or revoke the grant. For details, see RevokeGrant and Retiring and revoking grants"
    },
    "Operations": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "Decrypt",
          "Encrypt",
          "GenerateDataKey",
          "GenerateDataKeyWithoutPlaintext",
          "ReEncryptFrom",
          "ReEncryptTo",
          "Sign",
          "Verify",
          "GetPublicKey",
          "CreateGrant",
          "RetireGrant",
          "DescribeKey",
          "GenerateDataKeyPair",
          "GenerateDataKeyPairWithoutPlaintext",
          "GenerateMac",
          "VerifyMac",
          "DeriveSharedSecret",
          "Encapsulate",
          "Decapsulate"
        ]
      },
      "description": "A list of operations that the grant permits. This list must include only operations that are permitted in a grant. Also, the operation must be supported on the KMS key. For example, you cannot create a grant for a symmetric encryption KMS key that allows the Sign operation, or a grant for an asymmetric KMS key that allows the GenerateDataKey operation. If you try, KMS returns a ValidationError exception. For details, see Grant operations in the Key Management Service Developer Guide."
    },
    "Constraints": {
      "$ref": "#/$defs/GrantConstraints"
    },
    "GrantTokens": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of grant tokens. Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the Key Management Service Developer Guide."
    },
    "Name": {
      "type": "string",
      "description": "A friendly name for the grant. Use this value to prevent the unintended creation of duplicate grants when retrying this request. Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output. When this value is absent, all CreateGrant requests result in a new grant with a unique GrantId even if all the supplied parameters are identical. This can result in unintended duplicates when you retry the CreateGrant request. When this value is present, you can retry a CreateGrant request with identical parameters; if the"
    },
    "DryRun": {
      "type": "boolean",
      "description": "Checks if your request will succeed. DryRun is an optional parameter. To learn more about how to use this parameter, see Testing your permissions in the Key Management Service Developer Guide."
    },
    "GranteeServicePrincipal": {
      "type": "string",
      "description": "The Amazon Web Services service principal that gets the permissions specified in the grant. When you specify a GranteeServicePrincipal, you must also specify a SourceArn grant constraint. In addition, you must specify either a RetiringPrincipal or a RetiringServicePrincipal. You must specify either GranteePrincipal or GranteeServicePrincipal, but not both."
    },
    "RetiringServicePrincipal": {
      "type": "string",
      "description": "The Amazon Web Services service principal that has permission to use the RetireGrant operation to retire the grant. You can specify either RetiringPrincipal or RetiringServicePrincipal, but not both."
    }
  },
  "required": [
    "KeyId",
    "Operations"
  ],
  "$defs": {
    "GrantConstraints": {
      "type": "object",
      "properties": {
        "EncryptionContextSubset": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "A list of key-value pairs that must be included in the encryption context of the cryptographic operation 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": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "A list of key-value pairs that must match the encryption context in the cryptographic operation 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."
        },
        "SourceArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of an Amazon Web Services resource on behalf of which the request is made. This is effectively the same as having the aws:SourceArn global condition key in the grant. The SourceArn constraint ensures that the principal can use the KMS key only when the request is made on behalf of the specified resource."
        }
      }
    }
  }
}