# Dynatrace API key management.

**URL:** <https://community.dynatrace.com/t/dynatrace-api-key-management/33847>\
**Category:** Open Q&A\
**Created:** [January 24, 2022, 10:35am UTC](https://community.dynatrace.com/t/dynatrace-api-key-management/33847 "2022-01-24T10:35:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Skeats](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Mark\_Skeats](https://community.dynatrace.com/u/Mark_Skeats)\
**Post date:** [January 24, 2022, 10:35am UTC](https://community.dynatrace.com/t/dynatrace-api-key-management/33847/1 "2022-01-24T10:35:13Z")

</div>

Would be interested if anyone has come across&nbsp; &nbsp;best practices for Dynatrace API key management, or if they have used a third party application that can be integrated with Dynatrace to provide this capability - ideally it would be automation friendly (ie can be integrated into other pipelines)

_Background behind the question…_

_The Dynatrace API provides opportunities for automation with both infrastructure and application deployment_  
_For various reasons the demand for such automation can come from many teams, each require one or more API keys_  
_This presents the team who are responsible for Dynatrace in an organisation the challenge of how to manage the issue of keys_

_These are some of the areas of consideration, this is to give an idea of scope._  
_1. Audit the issuing of keys_  
_2. Ensuring keys are only issued to legitimate parties_  
_3. Ensuring old keys are removed when no longer required._

---

<div class="post-metadata">

**Author:** ![pahofmann](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pahofmann/32/17076_2.png) [@pahofmann](https://community.dynatrace.com/u/pahofmann)\
**Post date:** [January 24, 2022, 11:30am UTC](https://community.dynatrace.com/t/dynatrace-api-key-management/33847/2 "2022-01-24T11:30:35Z")

</div>

If you want to integrate automatic Dynatrace API Key Managment into existing workflows you could just use the&nbsp;[Token API Endpoint.](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/tokens-v2)

You can create tokens with specific scopes and delete them once they are no longer needed.

---

<div class="post-metadata">

**Author:** ![Mark\_Skeats](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Mark\_Skeats](https://community.dynatrace.com/u/Mark_Skeats)\
**Post date:** [January 25, 2022, 11:49am UTC](https://community.dynatrace.com/t/dynatrace-api-key-management/33847/3 "2022-01-25T11:49:35Z")

</div>

Thank you for the advice, the API call works well. One feature of interest is the ability&nbsp;to set an expiry date on the token to force applications to renew keys if still in use (that is like an expire password function and used for the same reason). I do not know if Dynatrace would work well with&nbsp;a system that is&nbsp;regularly regenerating keys. It would be interesting to know if&nbsp;anyone has&nbsp;taken this approach.

---

<div class="post-metadata">

**Author:** ![r\_weber](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/r_weber/32/24884_2.png) [@r\_weber](https://community.dynatrace.com/u/r_weber)\
**Post date:** [February 21, 2022, 8:42pm UTC](https://community.dynatrace.com/t/dynatrace-api-key-management/33847/4 "2022-02-21T20:42:29Z")

</div>

Hi&nbsp;[@Mark\_Skeats](https://community.dynatrace.com/user/1364)&nbsp;,

actually I have implemented exactly what you describe at large scale. Managing and rotating API keys across several thousand Dynatrace Tenants across multiple managed clusters.

You can generate API keys with an expiry date and thus automatically rotate them upon expiry.

It’s part of one of my [blog posts](https://www.dynatrace.com/news/blog/managing-the-dynatrace-api-across-multiple-thousand-environments/).

Reinhard

---

<div class="post-metadata">

**Author:** ![Mark\_Skeats](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Mark\_Skeats](https://community.dynatrace.com/u/Mark_Skeats)\
**Post date:** [February 22, 2022, 10:06am UTC](https://community.dynatrace.com/t/dynatrace-api-key-management/33847/5 "2022-02-22T10:06:24Z")

</div>

Thanks&nbsp;Reinhard, the blog was very helpful.
