Policy Type
Description
Log policy captures a snapshot of the current message state at any point in the message processing pipeline and sends it to designated connectors. It supports HTTP, WebSocket, and gRPC protocols with synchronous and asynchronous execution modes.
Endpoints
List Policies
GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/
Add Policy
POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
Update Policy
PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
Delete Policy
DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
List Policies
Endpoint
GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/
Request
| 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)
{
"success": true,
"resultList": [
{
"apiProxy": {
"name": "MyAPI",
"requestPolicyList": [
{
"type": "policy-log",
"name": "request-snapshot",
"description": "Log request snapshot before transformation",
"active": true,
"executionType": "ASYNC",
"connectorRefs": [
{
"connectionName": "Production Elasticsearch"
}
],
"logCorrelationId": true,
"logEnvironmentInfo": true,
"logApiProxyInfo": true,
"logUserInfo": true,
"logHttpContext": true,
"logHeaders": true,
"logParameters": true,
"logBody": true,
"logResultInfo": true,
"bodyLogMode": "FULL",
"enablePrivacy": false
}
],
"responsePolicyList": [],
"errorPolicyList": []
}
}
],
"resultCount": 1
}
cURL Example
curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/" \
-H "Authorization: Bearer YOUR_TOKEN"
Add Policy
Endpoint
POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
Request
| 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
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-log",
"description": "Capture request snapshot before transformation",
"active": true,
"executionType": "ASYNC",
"connectorRefs": [
{
"connectionName": "Production Elasticsearch"
},
{
"connectionName": "Backup Kafka"
}
],
"logCorrelationId": true,
"logEnvironmentInfo": true,
"logApiProxyInfo": true,
"logUserInfo": true,
"logHttpContext": true,
"logHeaders": true,
"logParameters": true,
"logBody": true,
"logResultInfo": true,
"bodyLogMode": "FULL",
"bodyMaxBytes": 0,
"enablePrivacy": false,
"privacyDefinitionList": []
}
}
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) |
policy
| Field | Type | Required | Default | Description |
|---|
| type | string | Yes | - | Policy type: policy-log |
| description | string | No | - | Policy description |
| active | boolean | No | true | Whether policy is active |
| executionType | string | No | SYNC | Execution type: SYNC or ASYNC |
| connectorRefs | array | Yes | - | List of connector references by connection name |
| logCorrelationId | boolean | No | true | Log correlation ID |
| logEnvironmentInfo | boolean | No | true | Log environment information (environment ID, project ID) |
| logApiProxyInfo | boolean | No | true | Log API proxy information (proxy name, method, endpoint) |
| logUserInfo | boolean | No | true | Log user information (username, credential) |
| logHttpContext | boolean | No | true | Log HTTP context (IP address, method, URI, port, status code) |
| logHeaders | boolean | No | true | Log request/response headers |
| logParameters | boolean | No | true | Log request parameters |
| logBody | boolean | No | true | Log request/response body |
| logResultInfo | boolean | No | true | Log result information (result type, error details) |
| bodyLogMode | string | No | FULL | Body logging mode: FULL or PARTIAL |
| bodyMaxBytes | integer | No | 0 | Maximum body size in bytes (only for PARTIAL mode) |
| enablePrivacy | boolean | No | false | Enable policy-level privacy processing |
| privacyDefinitionList | array | No | [] | List of privacy definitions (element name + operation) |
connectorRefs[]
| Field | Type | Required | Description |
|---|
| connectionName | string | Yes | Name of a connection configuration defined in the project or admin project |
Connectors are referenced by their connection name, not by ID. The system resolves the connection name to the appropriate connector at runtime. This allows policies to work across all environments where the connection is configured.
EnumExecutionType (executionType)
SYNC - Synchronous execution (blocks pipeline until delivery completes; errors break the pipeline)
ASYNC - Asynchronous execution (non-blocking; errors are logged but suppressed)
EnumBodyLogMode (bodyLogMode)
FULL - Log complete body content
PARTIAL - Log body content up to bodyMaxBytes limit
Response
Success Response (200 OK)
{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}
cURL Example
curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/request-snapshot/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-log",
"description": "Capture request snapshot",
"active": true,
"executionType": "ASYNC",
"connectorRefs": [
{ "connectionName": "Production Elasticsearch" }
],
"logCorrelationId": true,
"logEnvironmentInfo": true,
"logApiProxyInfo": true,
"logUserInfo": true,
"logHttpContext": true,
"logHeaders": true,
"logParameters": true,
"logBody": true,
"logResultInfo": true,
"bodyLogMode": "FULL",
"enablePrivacy": false
}
}'
Update Policy
Endpoint
PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
Request
| 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
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-log",
"description": "Updated - Log with partial body and privacy",
"active": true,
"executionType": "ASYNC",
"connectorRefs": [
{ "connectionName": "Production Elasticsearch" }
],
"logCorrelationId": true,
"logEnvironmentInfo": true,
"logApiProxyInfo": true,
"logBody": true,
"bodyLogMode": "PARTIAL",
"bodyMaxBytes": 2048,
"enablePrivacy": true,
"privacyDefinitionList": [
{
"elementName": "creditCardNumber",
"operation": "MASK"
}
]
}
}
Note: Request body structure is the same as Add Policy. All fields should be provided for update.
Response
Success Response (200 OK)
{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}
cURL Example
curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/request-snapshot/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-log",
"description": "Updated - Log with partial body",
"active": true,
"executionType": "ASYNC",
"connectorRefs": [
{ "connectionName": "Production Elasticsearch" }
],
"logBody": true,
"bodyLogMode": "PARTIAL",
"bodyMaxBytes": 2048,
"enablePrivacy": false
}
}'
Delete Policy
Endpoint
DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
Request
| 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
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": false
}
}
Response
Success Response (200 OK)
{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": []
}
}
cURL Example
curl -X DELETE \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/request-snapshot/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": false
}
}'
Notes and Warnings
-
Execution Types:
SYNC - Synchronous execution blocks the pipeline until all connectors are delivered to. If a connector fails, the pipeline breaks and an error is returned to the client.
ASYNC - Asynchronous execution runs delivery in the background. Connector failures are logged but do not affect the client request.
-
Connector References: Connectors are referenced by their connection name. The system resolves the name to the corresponding connection configuration and matches it to the appropriate connector in the current environment at runtime. This allows global policies to work across all environments.
-
Privacy: Privacy settings can be applied at two levels: policy-level and connector-level. Both are applied in sequence when enabled.
-
Protocol Support: HTTP supports headers, parameters, and body. WebSocket supports headers and body. gRPC supports body only.
-
Deployment: Policy changes require deployment to take effect. Set
deploy: true or deploy manually.