Skip to main content

Update data masking rules

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/i/data-manager/mask-data

Overview

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

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

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
}
]

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}]

Response

Success Response

"Success"

Response Fields

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

Error Responses

  • 500
500

Behavior

  • 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.

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.
Implementation details

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.

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.