To get authenticated to use the Dynatrace API, you need a valid API token. Access to the API is fine-grained, meaning that you also need the proper permissions assigned to the token. See the description of each request to find out which permissions are required to use it.
Generate a token
To generate an API token:
- Select Settings in the navigation menu.
- Go to Integration > Dynatrace API.
- Click the Generate token button.
- Enter a name for your token.
- Select the required permissions for it.
- Click Generate.
You can assign multiple permissions to a single token, or you can generate several tokens, each with different access levels and use them accordingly—check with your organization's security policies for the best practice.
You can authenticate by attaching the token to the Authorization HTTP header preceding the Api-Token realm.
--header 'Authorization: Api-Token abcdefjhij1234567890'
The following example shows authentication via HTTP header.
curl --request GET \ --url https://mySampleEnv.live.dynatrace.com/api/v1/time \ --header 'Authorization: Api-Token abcdefjhij1234567890' \
You can authenticate by adding the token as the value of the
api-token query parameter.
curl --request GET \ --url 'https://mySampleEnv.live.dynatrace.com/api/v1/time?api-token=abcdefjhij1234567890' \