# How to get Dynatrace Managed Cluster Token Automatically after installation?

**URL:** <https://community.dynatrace.com/t/how-to-get-dynatrace-managed-cluster-token-automatically-after-installation/39521>\
**Category:** Dynatrace API\
**Tags:** dynatrace-managed, dynatrace-api, tokens\
**Created:** [April 28, 2023, 2:57pm UTC](https://community.dynatrace.com/t/how-to-get-dynatrace-managed-cluster-token-automatically-after-installation/39521 "2023-04-28T14:57:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ta12345](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@ta12345](https://community.dynatrace.com/u/ta12345)\
**Post date:** [April 28, 2023, 2:57pm UTC](https://community.dynatrace.com/t/how-to-get-dynatrace-managed-cluster-token-automatically-after-installation/39521/1 "2023-04-28T14:57:10Z")

</div>

I am trying to automate my deployment of Dynatrace Managed, and the Cluster API seems useful for most of the setup, but I’m having trouble automating getting a token to access the Cluster API.

The Cluster API has an endpoint to create new Tokens, but I need a Token to authorize and use that endpoint, so it’s a circular dependency.

I noticed an “afterInstallation” token in the Cluster Management Console (CMC), is there any way I might be able to retrieve that token? My idea was to somehow grab the “afterInstallation” token right after installing dynatrace managed, but I don’t know how.

I have ssh access to the nodes in the cluster and the admin username/password. The manual way would be to login to the CMC and go to Settings \> API Tokens \> Cluster tokens \> Generate token.

Is there a way to generate or obtain a token via CLI that doesn’t depend on already having a token?

(Question originally posted on:&nbsp;[How to get Dynatrace Managed Cluster Token Automatically after installation? - Stack Overflow](https://stackoverflow.com/questions/76121091/how-to-get-dynatrace-managed-cluster-token-automatically-after-installation))

---

<div class="post-metadata">

**Author:** ![Islam\_Zedan](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/islam_zedan/32/31999_2.png) [@Islam\_Zedan](https://community.dynatrace.com/u/Islam_Zedan)\
**Post date:** [May 1, 2023, 7:43am UTC](https://community.dynatrace.com/t/how-to-get-dynatrace-managed-cluster-token-automatically-after-installation/39521/2 "2023-05-01T07:43:19Z")

</div>

Hello,

You can use this endpoint to create a new cluster token

[https://www.dynatrace.com/support/help/shortlink/api-cluster-tokens-create-new](https://www.dynatrace.com/support/help/shortlink/api-cluster-tokens-create-new)

For that, you need to generate an API token with&nbsp; **ClusterTokenManagement** permission, please check the below document.

> **[Dynatrace API - Tokens and authentication](https://docs.dynatrace.com/docs/dynatrace-api/basics/dynatrace-api-authentication)**
>
> Find out how to get authenticated to use the Dynatrace API.

BR,

Islam
