Traffic Log Settings
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/ | List all environments' settings |
| GET | /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/ | Get specific environment settings |
| PUT | /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/ | Update environment settings |
| PUT | /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName} | Update method-level override |
| DELETE | /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName} | Delete method-level override |
Update Method-Level Connector Override
See Update Method-Level Override.
PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}
Delete Method-Level Connector Override
See Delete Method-Level Override.
DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}
List All Environments' Settings
Endpoint
GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| methodName | string | Conditional | API method name (only for method-level endpoints) |
| connectorType | string | Conditional | Connector type (only for method-level endpoints). Values: ELASTICSEARCH_INDEX, DB_INSERT_UPDATE_DELETE, SYSLOG_SEND, WEBHOOK_SEND, RABBITMQ_SEND, ACTIVEMQ_SEND, KAFKA_SEND, GRAYLOG_SEND, LOGBACK_APPEND |
GET: List All Environments' Settings
Returns traffic log settings for all environments of the specified API Proxy. Connector keys are returned as connection names (not internal UUIDs).
cURL Example
curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/" \
-H "Authorization: Bearer YOUR_TOKEN"
GET: Specific Environment Settings
Returns traffic log settings for a single environment.
cURL Example
curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/" \
-H "Authorization: Bearer YOUR_TOKEN"
PUT: Update Environment Settings
Updates traffic log settings for a specific environment and deploys the changes.
Request Body Example
{
"logParamRequestFromClient": true,
"logHeaderRequestFromClient": true,
"logBodyRequestFromClient": true,
"logParamRequestToTarget": true,
"logHeaderRequestToTarget": true,
"logBodyRequestToTarget": true,
"logHeaderResponseFromTarget": true,
"logBodyResponseFromTarget": true,
"logHeaderResponseToClient": true,
"logBodyResponseToClient": true,
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true,
"logHeaderRequestFromClient": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true,
"enableMetadataIdentification": true,
"enableMetadataApiProxy": true,
"enableMetadataRequest": true,
"enableMetrics": true,
"enableMetadataResponse": true,
"enableSentAddress": true,
"enableBodyFromClientSize": true,
"sizeBodyFromClient": 2048,
"enableBodyToTargetSize": true,
"sizeBodyToTarget": 2048,
"enableBodyFromTargetSize": true,
"sizeBodyFromTarget": 2048,
"enableBodyToClientSize": true,
"sizeBodyToClient": 2048,
"enablePrivacy": false,
"privacyDefinitionList": []
},
"my-kafka-connection": {
"enabled": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true
}
}
}
Request Body Fields (Top-Level)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| logParamRequestFromClient | boolean | No | true | Log query parameters from client request |
| logHeaderRequestFromClient | boolean | No | true | Log headers from client request |
| logBodyRequestFromClient | boolean | No | true | Log body from client request |
| logParamRequestToTarget | boolean | No | true | Log query parameters sent to target |
| logHeaderRequestToTarget | boolean | No | true | Log headers sent to target |
| logBodyRequestToTarget | boolean | No | true | Log body sent to target |
| logHeaderResponseFromTarget | boolean | No | true | Log headers from target response |
| logBodyResponseFromTarget | boolean | No | true | Log body from target response |
| logHeaderResponseToClient | boolean | No | true | Log headers sent to client response |
| logBodyResponseToClient | boolean | No | true | Log body sent to client response |
| connectorSettingsMap | object | No | Per-connector settings. Key = connection name (as defined in Connections). See below. | |
| methodOverrideList | array | No | [] | Method-level connector overrides. See below. |
connectorSettingsMap
The connectorSettingsMap is an object where each key is the connection name and each value contains the connector-specific log settings.
Important: The connection must already exist and be configured as a connector (recipient) in the target environment. Use the Connections API to create connections first.
Connector Log Settings Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| enabled | boolean | No | false | Enable/disable this connector |
| logParamRequestFromClient | boolean | No | null | Override: log query params from client |
| logHeaderRequestFromClient | boolean | No | null | Override: log headers from client |
| logBodyRequestFromClient | boolean | No | null | Override: log body from client |
| logParamRequestToTarget | boolean | No | null | Override: log query params to target |
| logHeaderRequestToTarget | boolean | No | null | Override: log headers to target |
| logBodyRequestToTarget | boolean | No | null | Override: log body to target |
| logHeaderResponseFromTarget | boolean | No | null | Override: log headers from target |
| logBodyResponseFromTarget | boolean | No | null | Override: log body from target |
| logHeaderResponseToClient | boolean | No | null | Override: log headers to client |
| logBodyResponseToClient | boolean | No | null | Override: log body to client |
| enableMetadataIdentification | boolean | No | null | Log identification metadata |
| enableMetadataApiProxy | boolean | No | null | Log API proxy metadata |
| enableMetadataRequest | boolean | No | null | Log request metadata (IP, method, path, etc.) |
| enableMetrics | boolean | No | null | Log performance metrics (timing, size, retry) |
| enableMetadataResponse | boolean | No | null | Log response metadata (status code, error type) |
| enableSentAddress | boolean | No | null | Log routing address |
| enableBodyFromClientSize | boolean | No | null | Enable size limit for client request body |
| sizeBodyFromClient | integer | No | null | Max character count for client request body |
| enableBodyToTargetSize | boolean | No | null | Enable size limit for target request body |
| sizeBodyToTarget | integer | No | null | Max character count for target request body |
| enableBodyFromTargetSize | boolean | No | null | Enable size limit for target response body |
| sizeBodyFromTarget | integer | No | null | Max character count for target response body |
| enableBodyToClientSize | boolean | No | null | Enable size limit for client response body |
| sizeBodyToClient | integer | No | null | Max character count for client response body |
| enablePrivacy | boolean | No | false | Enable privacy masking |
| privacyDefinitionList | array | No | [] | Privacy masking rules. Each item is a Privacy Definition object |
Note: Fields set to null inherit from the parent (proxy-level defaults).
Privacy Definition Object
Each entry in privacyDefinitionList describes what to find (patternType and its companion
field) and what to do with it (operation). Rules are applied to the four logged bodies
(client request, target request, target response, client response) as well as to logged headers and
parameters for element-name rules.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| enabled | boolean | No | true | Set to false to keep the rule but stop applying it |
| operation | string | Yes | - | MASK, DELETE, ENCRYPT, HASH or DETECT |
| patternType | string | No | ELEMENT_NAME | ELEMENT_NAME, REGEX or BUILTIN |
| elementName | string | Conditional | - | Required for ELEMENT_NAME. JSON/XML field name, header name or form parameter name |
| regexPattern | string | Conditional | - | Required for REGEX. Java regular expression matched against the body text |
| builtInPiiType | string | Conditional | - | Required for BUILTIN. One of TCKN, IBAN_TR, PHONE_TR, EMAIL, CREDIT_CARD |
| maskMode | string | No | FIXED | Mask shape when operation = MASK: FIXED, KEEP_FIRST, KEEP_LAST, MASK_FIRST |
| maskPattern | string | No | *** | With FIXED, the full replacement text. With the partial shapes, its first character is used as the mask character (default *). |
| maskVisibleCharCount | integer | No | 4 | Characters kept (or masked, with MASK_FIRST) in the partial shapes |
Choosing a pattern type
ELEMENT_NAME— matches by field name, regardless of the value. Use it when the sensitive data always lives in a known field (password,cardNumber). This is the only type that also covers logged headers and query parameters.REGEX— matches by value anywhere in the body. Use it for formats specific to your APIs (order codes, internal identifiers). Patterns are compiled once and guarded against catastrophic backtracking; a pattern that fails the guard is skipped rather than allowed to stall the gateway.BUILTIN— matches by value using an Apinizer-maintained pattern for a known PII type. Use it when the data can appear in any field, or in free text such as an AI prompt.
Built-in types are checksum-validated. TCKN, IBAN_TR and CREDIT_CARD are verified after
the pattern matches (TCKN check digits, IBAN mod-97, Luhn). A value that looks right but fails
validation is deliberately left unmasked — this keeps ordinary 11-digit numbers, order totals
and reference codes from being destroyed in your logs. If a real value is not being masked, check
that it is a valid number first.
DETECT does not modify content. It reports that PII was present without changing the logged
body. The other four operations rewrite the matched value: MASK replaces it according to the mask
shape below, DELETE removes it, HASH stores a one-way hash, ENCRYPT stores a reversible
encrypted value.
Mask shape. maskMode decides how a MASK match is rewritten, and applies the same way to all
three pattern types:
maskMode | Input | Output |
|---|---|---|
FIXED (default) | 05321234567 | *** |
KEEP_FIRST, count 4 | 05321234567 | 0532******* |
KEEP_LAST, count 4 | 05321234567 | *******4567 |
MASK_FIRST, count 4 | 05321234567 | ****1234567 |
The default replaces the whole value and leaks nothing. The partial shapes preserve the output
length and deliberately leave part of the value visible — since the remaining fragment can identify
a person on its own, choose one on purpose. If maskVisibleCharCount is greater than or equal to
the value length nothing would be masked at all; in that case it falls back to replacing the whole
value.
{
"enablePrivacy": true,
"privacyDefinitionList": [
{
"enabled": true,
"patternType": "BUILTIN",
"builtInPiiType": "TCKN",
"operation": "MASK"
},
{
"enabled": true,
"patternType": "ELEMENT_NAME",
"elementName": "password",
"operation": "DELETE"
},
{
"enabled": true,
"patternType": "REGEX",
"regexPattern": "ORD-\\d{6}",
"operation": "HASH"
}
]
}
Privacy rules on this endpoint apply to traffic logs only — they change what is written to Elasticsearch, Kafka and the other log connectors, not what the gateway sends to the client or the backend. To mask data in the request or response itself, use the AI PII Mask policy or a transformation policy.
cURL Example: Enable Elasticsearch and Kafka Logging
curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"logHeaderRequestFromClient": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true,
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true,
"enableBodyFromClientSize": true,
"sizeBodyFromClient": 1024
},
"my-kafka-connection": {
"enabled": true,
"logBodyRequestFromClient": true
}
}
}'
cURL Example: Minimal — Enable Only Elasticsearch
curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/tester/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true
}
}
}'
PUT response keys: The PUT response's connectorSettingsMap keys are connector UUIDs (or legacy EnumExecutableType names), not resolved to connection names. GET responses resolve UUID keys to connection names.
PUT: Method-Level Connector Override
Adds or updates a method-level connector override. This allows different log settings for specific API methods. methodName is a query parameter (not a path segment), so method names that contain / work correctly.
Full reference: Update Method-Level Override.
Path
PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}
Request Body
Same as Connector Log Settings Fields above.
cURL Example
curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/connectors/ELASTICSEARCH_INDEX/methodOverride/?methodName=/pets" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"logBodyRequestFromClient": false,
"logBodyResponseFromTarget": true,
"enableBodyFromTargetSize": true,
"sizeBodyFromTarget": 512
}'
DELETE: Method-Level Connector Override
Removes a method-level connector override, reverting to proxy-level settings.
Full reference: Delete Method-Level Override.
Path
DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}
cURL Example
curl -X DELETE \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/connectors/ELASTICSEARCH_INDEX/methodOverride/?methodName=/pets" \
-H "Authorization: Bearer YOUR_TOKEN"
Response
Success Response (200 OK)
{
"status": "SUCCESS",
"resultList": [
{
"environmentId": "env-123",
"apiProxyId": "proxy-456",
"logParamRequestFromClient": true,
"logBodyRequestFromClient": true,
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true,
"logBodyRequestFromClient": true
}
}
}
]
}
Error Response (400 Bad Request)
{
"status": "FAILURE",
"resultMessage": "Connection with name 'non-existent-connection' not found in the environment!"
}
Common Error Messages
| Message | Cause |
|---|---|
Connection with name 'X' not found in the environment! | Connection name is not present in the target environment's recipient list (no matching connector configured for that environment) |
environmentName value can not be empty! | Missing environment name |
Environment (X) is not found! | Environment does not exist |
Method (X) is not found in ApiProxy! | Method name does not exist in the API proxy |
Invalid connectorType: X | Invalid EnumExecutableType value |
Notes and Warnings
- Connection Names: Use the connection name as the key in
connectorSettingsMap, not the connection type or ID. The API resolves names to internal IDs automatically. - Environment Recipient: The connection must be added as a connector (recipient) in the target environment before it can be used here.
- Inheritance:
nullfields in connector settings inherit from proxy-level defaults. Method-level overrides inherit from proxy-level connector settings. - Trailing Slash: All URLs must end with
/. Without it, you will get a 404 error. - Deploy: PUT operations automatically deploy the changes to the environment.
Permissions
User must have API_MANAGEMENT + VIEW permission for GET endpoints and API_MANAGEMENT + MANAGE permission for PUT/DELETE endpoints.
Related Documentation
- Connections API - Create and manage connections
- Get API Proxy - Get API proxy details