Skip to main content
This document explains the detailed usage of a specific policy. If you are using Apinizer policy structure for the first time or want to learn the general working principles of policies, we recommend reading the What is Policy? page first.

Overview

What is its Purpose?

  • Conditionally modifies or deletes header, parameter, or body fields or values in messages returned from backend API.
  • Eliminates the need to create separate APIs for each user type by providing response customization according to different user types.
  • Ensures data privacy by masking or removing sensitive information in message content.
  • Performs flexible data manipulation with condition-based actions, using various operators for numeric, text, and time data types.

Working Principle

  1. Response Reception: Message returned from backend API reaches the API Gateway.
  2. Policy Check: If the Data Redaction policy is active, the system checks in the following order:
    • Is a Condition defined? If so, is the condition met?
    • Is the policy active (active=true)?
    • Are rule sets defined?
  3. Rule Evaluation: For each rule set:
    • Variable existence or variable value check is performed.
    • If the condition is met, defined actions are applied in order.
  4. Action Application:
    • Modify: The value of the selected field is modified using an operator according to the data type.
    • Delete: The selected field or value is removed from the message.
  5. Result: Customized response is transmitted to the client.

Differences from Business Rule Policy

Since data transformation is performed within the message, it can be confused with the Business Rule policy. The differences between these two policies;
  • While Business Rule policy is added to both request and response pipelines, Data Redaction policy is only added to the response pipeline.
  • While direct actions (Add, Modify, Delete, Stop Flow) can be defined in Business Rule policy, actions (Modify, Delete) are defined in Data Redaction policy when a specific field or field value is encountered.

Features and Capabilities

Basic Features

  • Conditional Data Manipulation: Dynamically modifies or deletes message content based on variable existence or variable value.
  • Multiple Data Type Support: Performs operations with various operators on numeric, text, and time data types.
  • Flexible Action Definition: Multiple actions can be added to a rule, actions are applied in order.
  • Variable-Based Access: Provides access to header, parameter, or body fields of the message with variables.
  • Active/Passive Status Control: Easily change the active or passive status of the policy (active/passive toggle). In passive state, the policy is not applied but its configuration is preserved.
  • Condition-Based Application: Determine when the policy will be applied by creating complex conditions with Query Builder (e.g., only for specific endpoints or header values).

Advanced Features

  • Advanced Text Operations: Text manipulation operators such as Base64 encode/decode, mask, format, substring, replace, transform.
  • Mathematical Operations: Addition, subtraction, multiplication, division, modulo, exponentiation operations on numeric values.
  • Time Manipulation: Addition or subtraction operations on time values.
  • XSLT and JOLT Transformations: Can perform XML and JSON transformations with Transform operator.
  • Export/Import Feature: Export policy configuration as a ZIP file. Import to different environments (Development, Test, Production). Version control and backup capability.
  • Policy Group and Proxy Group Support: Manage multiple policies within Policy Group. Bulk policy assignment to Proxy Groups. Centralized update and deployment operations.
  • Deploy and Versioning: Deploy policy changes to live environment. See which API Proxies use it (Policy Usage). Proxy Group and Policy Group usage reports.

Usage Scenarios

Configuring Policy Parameters

At this step, users can create a new policy or configure existing policy parameters to define data manipulation rules. The defined parameters directly affect how the policy works (e.g., which fields will be modified, under which conditions actions will be performed, conditional activations, etc.). This way, the policy can be customized according to organization-specific requirements and managed centrally.

Creating a New Data Redaction Policy

Configuration Steps

Rule and Action Details

Creating a Rule

A rule is a criterion that specifies what the response will be redacted by. An action is the editing operation to be performed on the message when this criterion is encountered. Multiple actions can be added to a rule. Message customization is performed according to the given action order. Additionally, there can be multiple rules in the policy. The fields used for rule configuration are shown in the table below.

Creating an Action

2 types of actions can be selected:
  • Modify: The value of an existing field in the header, parameter, or body of the request/response is modified.
  • Delete: The value of an existing field or the entire field in the header, parameter, or body of the request/response is deleted.

Modify Action

Used to modify the value in the header, parameter, or body of the message. When this action is selected, it is assumed that the value to be added exists in the message, and if it is not found, the policy errors. This should be considered in the condition part of the rule. The fields used for modify action configuration are shown in the table below.
Data Type and Operators
The data type (Variable Data Type) and operations (Operator) for these data types can be:

Delete Action

Used to delete the value in the header, parameter, or body of the message. When this action is selected, it is assumed that the value to be deleted exists in the message, and if it is not found, the policy does not error, continues with other operations. Where in the message will be deleted is specified with a variable. For the description of Conditions and Error Message Customization panels, you can review the Conditions and Error Message Customization sections on the What is Policy? page. For a complete guide on all layers, priority order and scenario examples of the error message configuration system, see the Error Message Configuration Guide page.

Deleting the Policy

For the deletion steps of this policy and the operations to be applied when it is in use, you can refer to the Removing Policy from Flow section on the Policy Management page.

Exporting/Importing the Policy

For the export and import steps of this policy, you can refer to the Export/Import page.

Linking the Policy to API

For the process of how this policy will be linked to APIs, you can refer to the Linking Policy to API section on the Policy Management page.

Advanced Features

Best Practices

Things to Do and Best Practices

Security Best Practices

Things to Avoid

Performance Tips

Frequently Asked Questions (FAQ)