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

# Create Produce Policy for Virtual Cluster

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

## Request

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

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

## Path parameters

- `gatewayId` string, uuid, required
- `virtualClusterId` string, uuid, required

## Query parameters

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

## Request body

- EventGatewayProduceSchemaValidationPolicy: A policy that validates produce messages against a schema registry.
  - `type` 'schema_validation', 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` union, required: The configuration of the policy.
    - EventGatewayProduceSchemaValidationPolicySchemaRegistryConfig: The configuration of the produce schema validation policy when using a schema registry.
      - `schema_registry` SchemaRegistryReference: A reference to a schema Registry.
        - `id` string, uuid, required: The unique identifier of the schema registry.
      - `failure_mode` 'reject' | 'passthrough' | 'mark': Describes how to handle a failure in a policy applied to produced records. * `reject` - rejects the record batch. * `passthrough` - passes the record silently to the backend cluster even though policy execution failed. * `mark` - passes the record to the backend cluster but marks it with a `kong/policy-failure-<id>` header whose value is the reason for the policy failure (truncated to 512 characters). **Requires a minimum runtime version of `1.2`**.
      - `validate_key` boolean: If true, validate the record key. **Requires a minimum runtime version of `1.2`**.
      - `validate_value` boolean: If true, validate the record value. **Requires a minimum runtime version of `1.2`**.
      - `key_validation_action` 'reject' | 'mark': Defines a behavior when record key is not valid. * reject - rejects a batch for topic partition. Only available for produce. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema.
      - `value_validation_action` 'reject' | 'mark': Defines a behavior when record value is not valid. * reject - rejects a batch for topic partition. Only available for produce. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema.
      - `type` 'confluent_schema_registry', required
    - EventGatewayProduceSchemaValidationPolicyJsonConfig: The configuration of the produce schema validation policy when using JSON parsing without schema.
      - `schema_registry` SchemaRegistryReference: A reference to a schema Registry.
        - `id` string, uuid, required: The unique identifier of the schema registry.
      - `failure_mode` 'reject' | 'passthrough' | 'mark': Describes how to handle a failure in a policy applied to produced records. * `reject` - rejects the record batch. * `passthrough` - passes the record silently to the backend cluster even though policy execution failed. * `mark` - passes the record to the backend cluster but marks it with a `kong/policy-failure-<id>` header whose value is the reason for the policy failure (truncated to 512 characters). **Requires a minimum runtime version of `1.2`**.
      - `validate_key` boolean: If true, validate the record key. **Requires a minimum runtime version of `1.2`**.
      - `validate_value` boolean: If true, validate the record value. **Requires a minimum runtime version of `1.2`**.
      - `key_validation_action` 'reject' | 'mark': Defines a behavior when record key is not valid. * reject - rejects a batch for topic partition. Only available for produce. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema.
      - `value_validation_action` 'reject' | 'mark': Defines a behavior when record value is not valid. * reject - rejects a batch for topic partition. Only available for produce. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema.
      - `type` 'json', required
  - `condition` string: A string containing the boolean expression that determines whether the policy is applied.

## Response `201`

Created

- EventGatewayProducePolicySchemaValidationTFOnly: 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, required: 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-06-11** `be4c4e09af62`: 6 info
  - added the new optional request property `config/oneOf[#/components/schemas/EventGatewayProduceSchemaValidationPolicyJsonConfig]/failure_mode`
  - added the new optional request property `config/oneOf[#/components/schemas/EventGatewayProduceSchemaValidationPolicyJsonConfig]/validate_key`
  - added the new optional request property `config/oneOf[#/components/schemas/EventGatewayProduceSchemaValidationPolicyJsonConfig]/validate_value`
  - added the new optional request property `config/oneOf[#/components/schemas/EventGatewayProduceSchemaValidationPolicySchemaRegistryConfig]/failure_mode`
  - …2 more
- **2026-03-04** `e425d5193d3e`: 3 breaking
  - the request property `name` became not nullable
  - removed `#/components/schemas/SchemaRegistryReferenceById, #/components/schemas/SchemaRegistryReferenceByName` from the `config/oneOf[#/components/schemas/EventGatewayProduceSchemaValidationPolicyJsonConfig]/schema_registry` request property `oneOf` list
  - removed `#/components/schemas/SchemaRegistryReferenceById, #/components/schemas/SchemaRegistryReferenceByName` from the `config/oneOf[#/components/schemas/EventGatewayProduceSchemaValidationPolicySchemaRegistryConfig]/schema_registry` request property `oneOf` list
- …earlier changes not shown

[Operation history](https://skmtc.dev/kong/apis/konnect-api-beta/changes/v1/event-gateways/:gatewayId/virtual-clusters/:virtualClusterId/produce-policies%23SchemaValidation/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)
