---
title: "Create Produce Policy for Virtual Cluster"
method: POST
path: "/v1/event-gateways/{gatewayId}/virtual-clusters/{virtualClusterId}/produce-policies#Encrypt"
tags: ["Event Gateway Virtual Cluster Produce Policies"]
---

# Create Produce Policy for Virtual Cluster

`POST /v1/event-gateways/{gatewayId}/virtual-clusters/{virtualClusterId}/produce-policies#Encrypt`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v1/event-gateways/{gatewayId}/virtual-clusters/{virtualClusterId}/produce-policies#Encrypt`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Creates a new produce policy associated with the specified Event Gateway virtual cluster.

## Query parameters

- `before` string, uuid
- `after` string, uuid

## Request body

- EventGatewayEncryptPolicy: Encrypts Kafka records or keys using AES_256_GCM. Keys are therefore 256 bits long.
  - `type` 'encrypt', required: The type name of the policy.
  - `name` string: A unique user-defined name of the policy.
  - `description` string: A human-readable description of the policy.
  - `enabled` boolean: Whether the policy is enabled.
  - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
  - `config` EventGatewayEncryptConfig, required: The configuration of the encrypt policy.
    - `failure_mode` 'error' | 'passthrough', required: Describes how to handle failing encryption or decryption. Use `error` if the record should be rejected if encryption or decryption fails. Use `passthrough` to ignore encryption or decryption failure and continue proxying the record.
    - `part_of_record` EncryptionRecordPart[], required: Describes the parts of a record to encrypt.
    - `encryption_key` union, required: The key to use for encryption.
      - EncryptionKeyAWS: The AWS KMS key to use for encryption.
        - `type` 'aws', required
        - `arn` string, required: The AWS KMS key ARN.
      - EncryptionKeyStatic: A static encryption key.
        - `type` 'static', required
        - `key` EncryptionKeyStaticReference, required: A static encryption key reference by ID.
          - `id` string, uuid, required: The ID of the static key defined in the key source.
  - `condition` string: A string containing the boolean expression that determines whether the policy is applied.

## Response `201`

Created

- EventGatewayPolicy: A policy associated with an Event Gateway.
  - `type` string, required: The type name of the policy.
  - `name` string: A unique user-defined name of the policy.
  - `description` string: A human-readable description of the policy.
  - `enabled` boolean: Whether the policy is enabled.
  - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
  - `id` string, uuid, required: The unique identifier of the policy.
  - `config` object, nullable: The configuration of the policy.
  - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
  - `parent_policy_id` string, uuid, nullable: The unique identifier of the parent policy, if any.
  - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.
  - `condition` string: A string containing the boolean expression that determines whether the policy is applied.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden

## Changes

- **2026-03-04** `e425d5193d3e`: 2 breaking
  - removed `#/components/schemas/EncryptionKeyStaticReferenceById, #/components/schemas/EncryptionKeyStaticReferenceByName` from the `config/encryption_key/oneOf[#/components/schemas/EncryptionKeyStatic]/key` request property `anyOf` list
  - the request property `name` became not nullable
- **2026-02-16** `106b373707f3`: 4 breaking, 8 info
  - the response property `config` became nullable for the status `201`
  - the response property `config` became optional for the status `201`
  - the `condition` response property's minLength was decreased from `1` to `0` for the response status `201`
  - the `name` response property's minLength was decreased from `1` to `0` for the response status `201`
  - …8 more
- **2025-12-19** `0325d14dfc53`: 4 breaking, 1 warning, 17 info
  - added the new required request property `config`
  - added the new required request property `type`
  - the request's body type changed from no type to `object`
  - the response's body type changed from no type to `object` for status `201`
  - …18 more
- **2025-11-06** `5d2b35832e3f`: 3 breaking, 4 warning
  - added the new required request property `allOf[subschema #2]/config/encryption_key`
  - added the new required request property `allOf[subschema #2]/config/part_of_record`
  - the request property `allOf[subschema #2]/config` became not nullable
  - deleted the `query` request parameter `parent_policy_id`
  - …3 more
- …earlier changes not shown

[Operation history](https://skmtc.dev/kong/apis/konnect-api-beta/changes/v1/event-gateways/:gatewayId/virtual-clusters/:virtualClusterId/produce-policies%23Encrypt/post.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api-beta.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api-beta/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api-beta/revisions/cef0f947e9c9?raw)
