Skip to main content

Update data masking rules

Enterprise Only
This API is available exclusively in Countly Enterprise.

Endpoint

/i/data-manager/mask-data

Overview

Adds, updates, or removes masking rules for event segments and user properties.

Authentication

Countly API supports three authentication methods:

  1. API key query parameter: api_key=YOUR_API_KEY
  2. Auth token query parameter: auth_token=YOUR_AUTH_TOKEN
  3. Auth token header: countly-token: YOUR_AUTH_TOKEN

Permissions

Requires data_manager_redaction Update permission.

Request Parameters

ParameterTypeRequiredDescription
app_idStringYesTarget app ID.
opsJSON String (Array)YesMask operations. Each item includes target group/event, segment, and mask value.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

ops Array Structure

FieldTypeRequiredDescription
isUserPropertyBooleanYestrue for user-property masking, false for event-segment masking.
eventStringYesEvent key for event masking, or custom/up for user properties.
segmentStringYesSegment/property key to mask or unmask.
maskBooleanYestrue adds masking rule, false removes masking rule.

Decoded example:

[
{
"isUserProperty": false,
"event": "purchase",
"segment": "email",
"mask": true
}
]

Configuration Impact

SettingDefaultAffectsUser-visible impact
data-manager.enableDataMaskingfalseGlobal masking mode after rule updatesThis endpoint recalculates whether any masking rules remain and updates this setting automatically. If no rules remain, masking is disabled; if any rule remains, masking is enabled.

Response

Success Response

"Success"

Response Fields

FieldTypeDescription
(root value)StringSuccess when masking updates are applied.

Error Responses

  • 500
500

Behavior/Processing

  • Applies rules to countly.apps.masking (masking.events or masking.prop).
  • Removes rules when mask: false is provided.
  • Refreshes masking config and may toggle data-manager.enableDataMasking globally.
  • Logs changes with dm-dt-mask and config-change system log entries.

Audit & System Logs

ActionTriggerPayload
dm-dt-maskEach masking rule add/remove operation{ query }
change_configsWhen resulting masking state toggles data-manager.enableDataMasking{ "data-manager": { "enableDataMasking": boolean } }

Database Collections

CollectionUsed forData touched by this endpoint
countly.appsStores app-level masking configurationReads the target app and updates masking.events.* / masking.prop.* paths for each operation.
countly.systemlogsAudit trailWrites dm-dt-mask for each operation and change_configs when effective masking state changes.

Examples

Mask one event segment

/i/data-manager/mask-data?
app_id=64f5c0d8f4f7ac0012ab3456&
ops=[{"isUserProperty":false,"event":"purchase","segment":"email","mask":true}]

Remove a user-property mask rule

/i/data-manager/mask-data?
app_id=64f5c0d8f4f7ac0012ab3456&
ops=[{"isUserProperty":true,"event":"custom","segment":"phone","mask":false}]

Operational Considerations

  • Each request can update multiple masking rules in one call (ops array).
  • When effective masking state changes, the endpoint also updates global config (data-manager.enableDataMasking) and reloads configs.

Limitations

  • On runtime exceptions, this endpoint can return HTTP 200 with raw JSON body 500.


Last Updated

2026-02-16