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, an internal application ID or a combination of them. If you specify multiple criteria, OR logic applies.
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 clusterRequestIds in case of Premium High-Availability clusters and the requestId of the anonymization job, which you can use to check the job status.
| PUT | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v1/anonymize/anonymizationJobs |
| PUT | Environment ActiveGate | https://{your-activegate-domain}/e/{your-environment-id}/api/v1/anonymize/anonymizationJobs |
To execute this request, you need an access token with UserSessionAnonymization scope.
To learn how to obtain and use it, see Personal access tokens.
| 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: | 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: | query | Optional |
| internalApplicationId | string | The internal application ID used to identify sessions that should be anonymized. All user sessions that contain at least one user action, event or error with the given application ID will be anonymized. If you specify additional fields to be anonymized on user actions or events, only those user actions and events with the corresponding application ID will be anonymized. | query | Optional |
| additionalField | string[] | A list of fields to be anonymized. You can specify several fields, in the following format: The element can hold these values
| query | Optional |
| Code | Type | Description |
|---|---|---|
| 200 | Anonymization | 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 | Error | Client side error. |
| 5XX | Error | Server side error. |
AnonymizationIdResult object| Element | Type | Description |
|---|---|---|
| clusterRequestIds | Anonymization | 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 |
AnonymizationClusterRequestID objectA list of tuples of request ID and cluster name
| Element | Type | Description |
|---|---|---|
| dcName | string | - |
| id | integer | - |
{"clusterRequestIds": [{"dcName": "string","id": 1}],"requestId": "-4013759873546847071|7354684707140137598"}
Anonymization jobs are processed one after another, and each job processes all user sessions in the specified timeframe. A job can therefore take a long time, and every additional request delays the jobs that are enqueued after it.
If you need to anonymize several users, submit one request that contains all of their user IDs and IP addresses instead of one request per user ID or IP address. Repeat the userIds and ips query parameters for each value:
PUT /api/v1/anonymize/anonymizationJobs?userIds=john.smith&userIds=mary.smith&ips=192.0.2.15&ips=198.51.100.7
If your list is too long for a single request URL, split it into a few large requests rather than many small ones.
The startTimestamp and endTimestamp parameters accept Unix epoch timestamps in milliseconds, in UTC. Common mistakes:
1535760000 is interpreted as a date in January 1970, so the job doesn't cover the intended timeframe. If endTimestamp is in seconds, no user sessions are anonymized. Make sure your timestamps have 13 digits, for example, 1535760000000.2018-09-01 or 2018-09-01T00:00:00Z aren't supported, and the request fails.To convert a UTC date to a timestamp in milliseconds, you can use, for example:
# Linux (GNU date)date -u -d '2018-09-01T00:00:00Z' +%s000# macOS (BSD date)date -u -j -f '%Y-%m-%dT%H:%M:%S' '2018-09-01T00:00:00' +%s000
If you're not sure in which timeframe the user sessions occurred, omit startTimestamp. The job then covers all stored user session data up to endTimestamp (or the current time, if endTimestamp isn't set).
A job that is waiting for execution reports progress of -1. This is expected when other jobs are queued before it. Don't submit the same request again; use the returned requestId to check the job status instead.
The request is rejected with response code 400 if:
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:00 September 1, 2018 and 23:59:59 September 10, 2018 UTC (corresponding to the 1535760000000 and 1536623999000 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 -X PUT \'https://mySampleEnv.live.dynatrace.com/api/v1/anonymize/anonymizationJobs?startTimestamp=1535760000000&endTimestamp=1536623999000&userIds=john.smith&userIds=mary.smith' \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
https://mySampleEnv.live.dynatrace.com/api/v1/anonymize/anonymizationJobs?startTimestamp=1535760000000&endTimestamp=1536623999000&userIds=john.smith&userIds=mary.smith
{"clusterRequestIds": [{"id": -7520440752290577000,"dcName": ""}],"requestId": "-7520440752290577781"}
200