If any of your Dynatrace API authentication tokens is compromised (becomes exposed to the public) for any reason, immediately stop using it, remove it as soon as possible, and issue a replacement token as needed. The token API comes in handy for this task.
Get the ID of an exposed token
Delete the exposed token
Create a new token to replace the compromised token
To delete a token, you need to obtain its ID. To do so, execute the POST token lookup request with the token to be deleted as a payload.
The request will return the metadata of the token. From the metadata, you will need:
Send a POST request to this URL:
Send it with an application/json
payload like this, where 0987654321jihgfedcba
is the token:
{"token": "0987654321jihgfedcba"}
The request returns the metadata of the token in the application/json
payload:
{"id": "a6e91657-1fa7-4742-af40-39469b92bd65","name": "John's token","userId": "john@mysampleenv.com","created": "2019-03-06T09:15:49Z","expires": "2019-04-05T09:15:49Z","scopes": ["DataExport","ExternalSyntheticIntegration"]}
From this data, you need to retrieve the id, which you need to delete this token.
Now delete the compromised token. To do so, execute DELETE an existing token. You will need the id value you obtained in step 1.
In our example, the ID of the token to be deleted is a6e91657-1fa7-4742-af40-39469b92bd65.
Send the DELETE request to this URL:
A successful request is indicated by the 204 response code. It doesn't return any content.
To create a new token to replace the exposed one, execute the POST a new token request. Be sure to assign the same scope to it.
When the new token is created, give it to the user in accordance with the security policy of your organization.
Send the POST request to this URL:
Include this application/json
payload:
{"name": "John's token","scopes": ["DataExport","ExternalSyntheticIntegration"],"expiresIn": {"value": 30,"unit": "DAYS"}}
The request returns the new token in the application/json
payload:
{"token": "jihgfedcba0987654321"}