General Information
Policy Type
Endpoints
List Policies
Add Policy
Update Policy
Delete Policy
List Policies
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
Response
Success Response (200 OK)
cURL Example
Add Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Full JSON Body Example - Validate Against OpenAPI Spec
Request Body Fields
operationMetadata
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| targetScope | string | Yes | - | Policy scope: ALL or ENDPOINT |
| targetEndpoint | string | No* | - | Endpoint path (required if targetScope=ENDPOINT) |
| targetEndpointHTTPMethod | string | No* | - | HTTP method (required if targetScope=ENDPOINT) |
| targetPipeline | string | Yes | - | Pipeline: REQUEST, RESPONSE, or ERROR |
| deploy | boolean | No | true | Whether to deploy after adding policy |
| deployTargetEnvironmentNameList | array | No | [] | List of environment names to deploy to |
| order | integer | No | null | Policy execution order (starts from 1) |
ALL- Policy applies to all endpointsENDPOINT- Policy applies only to specified endpoint
REQUEST- Executes in request pipeline (validates request body)RESPONSE- Executes in response pipeline (validates response body)ERROR- Executes in error pipeline
GET,POST,PUT,DELETE,PATCH,OPTIONS,HEAD
policy
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | Yes | - | Policy type: policy-json-schema-validation |
| description | string | No | - | Policy description |
| active | boolean | No | true | Whether policy is active |
| pathForBody | string | No | - | JSONPath expression to locate JSON body to validate |
| showFirstErrorOnly | boolean | No | true | When true, only the first validation error is returned. When false, all validation errors are returned. |
| validateAgainstSpec | boolean | No | false | When true, validates against the API Proxy’s OpenAPI specification instead of manual schema definitions. schemaDefinitionList is not required when this is enabled. |
| openApiValidationMode | string | No* | - | OpenAPI validation mode (required if validateAgainstSpec=true): METHOD_BASED or ALL_SCHEMAS |
| schemaDefinitionList | array | No* | - | List of JSON schema definitions (required if validateAgainstSpec=false) |
JSONPath Examples
$- Root of JSON document$.data- Data property at root$.users[0]- First element in users array$.request.body- Nested path
EnumOpenApiValidationMode
METHOD_BASED- Validates against the schema matching the request’s HTTP method and path. Each endpoint/method combination is validated against its own schema definition from the OpenAPI spec.ALL_SCHEMAS- Validates against all schema definitions in the OpenAPI spec. The request body must conform to at least one of the defined schemas.
Note
- Either
schemaDefinitionList(manual schemas) orvalidateAgainstSpec: true(OpenAPI spec) must be provided. - If
validateAgainstSpec: true,openApiValidationModeis required andschemaDefinitionListis ignored. - If
validateAgainstSpec: falseor not set,schemaDefinitionListmust contain at least one schema definition. pathForBodyis optional. When set, it specifies which part of the JSON body to validate.
schemaDefinitionList
Each schema definition is an object with the following fields:| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| schemaNo | integer | No | 0 | Schema number (for ordering multiple schemas) |
| schemaBody | string | Yes | - | JSON Schema definition (JSON string) |
| systemId | string | No | null | System ID for schema reference |
| targetNamespace | string | No | null | Target namespace (for XML compatibility) |
| rootSchema | boolean | No | false | Whether this is the root schema |
JSON Schema Format
TheschemaBody must be a valid JSON Schema (draft-07 or compatible). Example:
Response
Success Response (200 OK)
cURL Example
Update Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Response
Success Response (200 OK)
cURL Example
Delete Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Request Body Fields
operationMetadata
| Field | Type | Required | Description | |
|---|---|---|---|---|
| targetScope | string | Yes | Policy scope: ALL or ENDPOINT | |
| targetPipeline | string | Yes | Pipeline: REQUEST, RESPONSE, or ERROR | |
| deploy | boolean | No | false | Whether to deploy after deletion |
Response
Success Response (200 OK)
cURL Example
Notes and Warnings
-
Validation Modes: Two validation approaches are available:
- Manual Schema: Provide your own JSON Schema definitions in
schemaDefinitionList(default) - OpenAPI Spec: Set
validateAgainstSpec: trueto validate against the API Proxy’s OpenAPI specification. RequiresopenApiValidationMode:METHOD_BASED- Validates against the schema for the specific HTTP method and pathALL_SCHEMAS- Validates against all schemas in the spec
- Manual Schema: Provide your own JSON Schema definitions in
-
Error Reporting:
showFirstErrorOnlycontrols whether only the first error (default) or all validation errors are returned. Set tofalsefor detailed error reports during development. -
JSONPath:
pathForBodyis optional. When set, it specifies which part of the JSON body to validate using a JSONPath expression. -
Schema Definition: When not using OpenAPI spec validation,
schemaDefinitionListmust contain at least one schema definition. -
JSON Schema:
schemaBodymust be a valid JSON Schema (draft-07 or compatible) -
Schema Number:
schemaNois used for ordering when multiple schemas are defined -
Root Schema: Set
rootSchema: truefor the primary schema - Validation Failure: When validation fails, the request/response is rejected with an error
- Performance: Schema validation adds processing overhead. Use for critical validation only.
-
Pipeline:
REQUESTpipeline validates request body before processingRESPONSEpipeline validates response body before sending to client
- Error Messages: Configure error messages in the policy to customize validation error responses
-
Deployment: Policy changes require deployment to take effect. Set
deploy: trueor deploy manually.
Related Documentation
- List Policies - List all policies
- Add Policy - General policy addition guide
- Update Policy - General policy update guide
- Delete Policy - General policy deletion guide

