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

# Create Consume Policy for Virtual Cluster

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

## Request

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

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

## Query parameters

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

## Request body

- EventGatewayConsumeSchemaValidationPolicy: A policy that validates consume 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 consume schema validation policy.
    - EventGatewayConsumeSchemaValidationPolicySchemaRegistryConfig: The configuration of the consume schema validation policy when using a schema registry.
      - `schema_registry` SchemaRegistryReference
        - `id` string, uuid, required: The unique identifier of the schema registry.
      - `failure_mode` 'error' | 'skip' | 'passthrough' | 'mark': Describes how to handle a failure in a policy applied to consumed records. * `error` - the batch is not delivered to the client. Use sparingly: erroring on a batch causes clients to get stuck on the problematic offset and requires manual intervention to skip it. * `skip` - the record is not delivered to the client. * `passthrough` - passes the record to the client even though policy execution failed. * `mark` - passes the record to the client 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` 'mark' | 'skip': Deprecated. Use `failure_mode`. Defines a behavior when record key is not valid. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema. * skip - skips delivering a record.
      - `value_validation_action` 'mark' | 'skip': Deprecated. Use `failure_mode`. Defines a behavior when record value is not valid. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema. * skip - skips delivering a record.
      - `type` 'confluent_schema_registry', required
    - EventGatewayConsumeSchemaValidationPolicyJsonConfig: The configuration of the consume schema validation policy when using JSON parsing without schema.
      - `schema_registry` SchemaRegistryReference
        - `id` string, uuid, required: The unique identifier of the schema registry.
      - `failure_mode` 'error' | 'skip' | 'passthrough' | 'mark': Describes how to handle a failure in a policy applied to consumed records. * `error` - the batch is not delivered to the client. Use sparingly: erroring on a batch causes clients to get stuck on the problematic offset and requires manual intervention to skip it. * `skip` - the record is not delivered to the client. * `passthrough` - passes the record to the client even though policy execution failed. * `mark` - passes the record to the client 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` 'mark' | 'skip': Deprecated. Use `failure_mode`. Defines a behavior when record key is not valid. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema. * skip - skips delivering a record.
      - `value_validation_action` 'mark' | 'skip': Deprecated. Use `failure_mode`. Defines a behavior when record value is not valid. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema. * skip - skips delivering a record.
      - `type` 'json', required
    - EventGatewayConsumeSchemaValidationPolicyInlineSchemaConfig: The configuration of the consume schema validation policy when using an inline schema. **Requires a minimum runtime version of `1.3`**.
      - `failure_mode` 'error' | 'skip' | 'passthrough' | 'mark': Describes how to handle a failure in a policy applied to consumed records. * `error` - the batch is not delivered to the client. Use sparingly: erroring on a batch causes clients to get stuck on the problematic offset and requires manual intervention to skip it. * `skip` - the record is not delivered to the client. * `passthrough` - passes the record to the client even though policy execution failed. * `mark` - passes the record to the client 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` 'mark' | 'skip': Deprecated. Use `failure_mode`. Defines a behavior when record key is not valid. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema. * skip - skips delivering a record.
      - `value_validation_action` 'mark' | 'skip': Deprecated. Use `failure_mode`. Defines a behavior when record value is not valid. * mark - marks a record with kong/server header and client ID value to help to identify the clients violating schema. * skip - skips delivering a record.
      - `type` 'inline_schema', required
      - `key` union: Defines the schema for a record key or value, inline. **Requires a minimum runtime version of `1.3`**.
        - object: The configuration of an inline schema when using JSON. **Requires a minimum runtime version of `1.3`**.
          - `schema` string, required: A schema that applies according to `schema_type`.
          - `schema_type` 'json', required
        - object: The configuration of an inline schema when using Avro. **Requires a minimum runtime version of `1.3`**.
          - `schema` string, required: A schema that applies according to `schema_type`.
          - `schema_type` 'avro', required
      - `value` union: Defines the schema for a record key or value, inline. **Requires a minimum runtime version of `1.3`**.
        - object: The configuration of an inline schema when using JSON. **Requires a minimum runtime version of `1.3`**.
          - `schema` string, required: A schema that applies according to `schema_type`.
          - `schema_type` 'json', required
        - object: The configuration of an inline schema when using Avro. **Requires a minimum runtime version of `1.3`**.
          - `schema` string, required: A schema that applies according to `schema_type`.
          - `schema_type` 'avro', required
  - `condition` string: A string containing the boolean expression that determines whether the policy is applied.

## Response `201`

Created

- EventGatewayConsumePolicySchemaValidationTFOnly: 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-11-05** `f018071a4515`: 2 info
  - added the new optional request property `config/oneOf[#/components/schemas/EventGatewayConsumeSchemaValidationPolicyInlineSchemaConfig]/key`
  - added the new optional request property `config/oneOf[#/components/schemas/EventGatewayConsumeSchemaValidationPolicyInlineSchemaConfig]/value`
- **2026-10-23** `30af8b28f6ef`: 1 breaking, 3 warning
  - added `#/components/schemas/InvalidParameterMinimumTime, #/components/schemas/InvalidParameterMaximumTime` to the `invalid_parameters/items/` response property `oneOf` list for the response status `400`
  - removed the request property `config/oneOf[#/components/schemas/EventGatewayConsumeSchemaValidationPolicyInlineSchemaConfig]/schema_registry`
  - added the new `key_invalid` enum value to the `invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule` response property for the response status `400`
  - added the new `unique` enum value to the `invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule` response property for the response status `400`
- **2026-09-30** `f530bf400198`: 2 warning
  - added the new `400.00` enum value to the `status` response property for the response status `400`
  - added the new `403.00` enum value to the `status` response property for the response status `403`
- …earlier changes not shown

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

---

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