Anonymization API - PUT anonymization job

Creates a user session anonymization job. The job anonymizes all user sessions in the specified timeframe by masking the user ID (userIds) and IP address (ips).

The IP address is masked by replacing its last octet with 0.

To identify user sessions to be anonymized, you can specify either the user ID, IP address, or both. If you specify both, OR logic applies—every session of the specified user ID(s) gets anonymized, regardless of the IP address it came from; every session from the specified IP address gets anonymized, even if it belongs to a user ID that has not been specified. You can specify multiple user IDs and IP addresses.

Regardless of how you identify user sessions, both the user ID and IP address are masked. You can't undo anonymization.

The request produces an application/json payload. The response body contains the ID of the anonymization job, which you can use to check the job status.

PUTSaaShttps://{your-environment-id}.live.dynatrace.com/api/v1/anonymize/anonymizationJobs
Environment ActiveGatehttps://{your-activegate-domain}:9999/e/{your-environment-id}/api/v1/anonymize/anonymizationJobs

Authentication

To execute this request, you need an access token with UserSessionAnonymization scope.

To learn how to obtain and use it, see Tokens and authentication.

Parameters

Parameter
Type
Description
In
Required
startTimestamp
integer

The start timestamp of the user session to anonymize, in UTC milliseconds.

If not set the earliest available time is used.

query
optional
endTimestamp
integer

The end timestamp of the user session to anonymize, in UTC milliseconds.

If not set the current time is used.

query
optional
userIds
string[]

The UserID of the user to anonymize.

You can specify several IDs, in the following format: userIds=user1&userIds=user2.

query
optional
ips
string[]

The IP address of the user to anonymize. All user sessions from this IP will be anonymized.

You can specify several IPs, in the following format: ips=ip1&ips=ip2.

query
optional
additionalField
string[]

A list of fields to be anonymized.

You can specify several fields, in the following format: additionalField=field1&additionalField=field2.

  • ip
  • content
  • country
  • region
  • city
  • userId
  • isp
  • stringProperties
  • longProperties
  • doubleProperties
  • dateProperties
  • carrier
  • userActions.name
  • userActions.domain
  • userActions.targetUrl
  • userActions.syntheticEvent
  • userActions.stringProperties
  • userActions.longProperties
  • userActions.doubleProperties
  • userActions.dateProperties
  • events.name
  • events.domain
  • events.page
  • events.pageGroup
  • events.pageReferrer
  • events.pageReferrerGroup
query
optional

Response

Response codes

Code
Type
Description
200

Success. The response body contains the ID of the anonymization job. You can use the ID to check the job status.

400
-

Failed. The input is invalid. See the response body for details.

4XX

Client side error.

5XX

Server side error.

Response body objects

The AnonymizationIdResult object

Element
Type
Description
clusterRequestIds

A list of tuples of request ID and cluster name

requestId
string

The ID of the newly created anonymization job. If multiple datacenters are involved a list separated by "|" will be returned

The AnonymizationClusterRequestID object

A list of tuples of request ID and cluster name

Element
Type
Description
dcName
string
-
id
integer
-

Response body JSON model

{
"clusterRequestIds": [
{
"dcName": "string",
"id": 1
}
],
"requestId": "-4013759873546847071|7354684707140137598"
}

Example

In this example, the request starts a job to anonymize all sessions of users john.smith and mary.smith in the time frame between 00:00 September 1, 2018 and 23:59 September 10, 2018 (corresponding to the 1535752800000 and 1536616799000 timestamps, respectively).

The API token is passed in the Authorization header.

The response contains the ID of the anonymization job, which can be used to check its status.

Curl

curl -X PUT \
'https://mySampleEnv.live.dynatrace.com/api/v1/anonymize/anonymizationJobs?startTimestamp=1535752800000&endTimestamp=1536616799000&userIds=john.smith&userIds=mary.smith' \
-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'

Request URL

https://mySampleEnv.live.dynatrace.com/api/v1/anonymize/anonymizationJobs?startTimestamp=1535752800000&endTimestamp=1536616799000&userIds=john.smith&userIds=mary.smith

Response content

{
"requestId": "7810238295331327902"
}

Response code

200