How do I set up authentication to use the Dynatrace API?

Authentication is achieved via a user-generated access key (available in your Dynatrace environment settings). Log into your Dynatrace environment and go to Settings > Integration > Dynatrace API. Generate a new access token by typing a unique string into the Key label field, then click the Generate key button.

Passing your API token within an authorization header

To authorize your API request using an HTTP header, use the previously generated Dynatrace token along with an 'Api-Token' realm.

Authorization: Api-Token abcdefjhij1234567890

The following example authenticates you with the Dynatrace API using the HTTP authorization header field.

curl -L -H "Authorization: Api-Token abcdefjhij1234567890" "https://{id}"

Passing your API token within a query parameter

Authentication can optionally be achieved via a query parameter using your generated access key.

curl -L "https://{id}"