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

Use the Dynatrace API to export different types of data into your 3rd party reporting and analysis tools. You can create multiple user generated secure access API tokens to authenticate access to your Dynatrace monitoring, logging, query language, and other data via our REST-based API.

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}"

Note: Using the above can potentially return a very long response. To avoid this long response, you can also achieve authentication by using the HTTP GET request to fetch a cluster version