# Restrict settings API tokens based on policies

**URL:** <https://community.dynatrace.com/t/restrict-settings-api-tokens-based-on-policies/41824>\
**Category:** Open Q&A\
**Tags:** data-privacy-and-product-security, dynatrace-api\
**Created:** [September 28, 2023, 12:44pm UTC](https://community.dynatrace.com/t/restrict-settings-api-tokens-based-on-policies/41824 "2023-09-28T12:44:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bert\_VanderHeyd](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bert_vanderheyd/32/162_2.png) [@Bert\_VanderHeyd](https://community.dynatrace.com/u/Bert_VanderHeyd)\
**Post date:** [September 28, 2023, 12:44pm UTC](https://community.dynatrace.com/t/restrict-settings-api-tokens-based-on-policies/41824/1 "2023-09-28T12:44:24Z")

</div>

There is the option to use security policies to give users direct view or edit access on some specific schema’s.

```markup
ALLOW settings:objects:read, settings:objects:write, settings:schemas:read
WHERE settings:schemaId = "builtin:alerting.maintenance-window";

```

But how can I create an API token with only that permission? The API-token scopes are not fine grained I presume.

---

<div class="post-metadata">

**Author:** ![victor\_balbuena](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/victor_balbuena/32/9773_2.png) [@victor\_balbuena](https://community.dynatrace.com/u/victor_balbuena)\
**Post date:** [September 28, 2023, 12:59pm UTC](https://community.dynatrace.com/t/restrict-settings-api-tokens-based-on-policies/41824/2 "2023-09-28T12:59:12Z")

</div>

At the moment, tokens use their own scopes so you can’t use policies on them, that’s correct. I could see the benefit of being able to provide policies for API tokens as well.

The only workaround today is&nbsp;[personal access tokens](https://www.dynatrace.com/support/help/manage/access-control/access-tokens/personal-access-token)&nbsp;which inherit the permissions of the user that created the token, so this means also the policies attached to the customer.

---

<div class="post-metadata">

**Author:** ![Bert\_VanderHeyd](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bert_vanderheyd/32/162_2.png) [@Bert\_VanderHeyd](https://community.dynatrace.com/u/Bert_VanderHeyd)\
**Post date:** [September 28, 2023, 1:23pm UTC](https://community.dynatrace.com/t/restrict-settings-api-tokens-based-on-policies/41824/3 "2023-09-28T13:23:22Z")

</div>

Using personal access tokens is difficult because it would require some kind of technical user which we don’t have. It’s not the biggest deal off course since we treat tokens as secrets. But if one would leak, it would give access to all settings while it could be restricted.

---

<div class="post-metadata">

**Author:** ![nicolas\_nguyen](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/nicolas_nguyen/32/28450_2.png) [@nicolas\_nguyen](https://community.dynatrace.com/u/nicolas_nguyen)\
**Post date:** [February 2, 2024, 8:13pm UTC](https://community.dynatrace.com/t/restrict-settings-api-tokens-based-on-policies/41824/4 "2024-02-02T20:13:12Z")

</div>

We have the same need here, we would like token (not personal ones) with more granular security to be able to give teams the right to manage only what they are supposed to.  
it is a big show stopper for devops practices
