# What are the scope or level to update anomaly detection setting?

**URL:** <https://community.dynatrace.com/t/what-are-the-scope-or-level-to-update-anomaly-detection-setting/39782>\
**Category:** Dynatrace API\
**Tags:** anomaly-detection, settings, dynatrace-api\
**Created:** [May 17, 2023, 11:25am UTC](https://community.dynatrace.com/t/what-are-the-scope-or-level-to-update-anomaly-detection-setting/39782 "2023-05-17T11:25:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naveen](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/naveen/32/2570_2.png) [@Naveen](https://community.dynatrace.com/u/Naveen)\
**Post date:** [May 17, 2023, 11:25am UTC](https://community.dynatrace.com/t/what-are-the-scope-or-level-to-update-anomaly-detection-setting/39782/1 "2023-05-17T11:25:54Z")

</div>

Hi,

I am trying to update the anomaly detection setting using&nbsp;_‘settings’_&nbsp;API but wondering what are the scopes or level on which I can update it.

**Question 1:** &nbsp;Can I update it on HOST\_GROUP or PROCESS\_GROUP or SERVICE level?

**Question 2:** &nbsp;Where to find the api documentation for request body?

---

<div class="post-metadata">

**Author:** ![Mohamed\_Hamdy](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Mohamed\_Hamdy](https://community.dynatrace.com/u/Mohamed_Hamdy)\
**Post date:** [May 17, 2023, 12:09pm UTC](https://community.dynatrace.com/t/what-are-the-scope-or-level-to-update-anomaly-detection-setting/39782/2 "2023-05-17T12:09:29Z")

</div>

Hi [@Naveen](https://community.dynatrace.com/user/51963),

it will be based on the type of anomaly detection and you can check the [available schemas](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/settings/schemas) including anomaly and related scope to apply it such as host, host group, environment, … etc.

now after getting the required schema Id, it’s time to [post it as an object](https://www.dynatrace.com/support/help/shortlink/api-v2-settings-post-object)

and there is an easy approach you can use, you can go to the anomaly detection settings, whether on a certain service, host group, or globally and copy the API and adjust it

 ![Mohamed_Hamdy_0-1684325258558.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/c/4cbb305812e299ba4682004e4f18ff292a650e27.png)

in the below example, I’m using Anomaly detection for databases on a certain DB, and by changing the scope from service to environment it will be adjusted globally, (Note: I’ve removed the id of the service, you can add your service id, change the scope based on your requirements and remove the space between “requests PerMinute”)

builtin:anomaly-detection.databases

The scope will be one of the following:

SERVICE\_METHOD - Request  
SERVICE - Service  
HOST\_GROUP - Host Group  
environment

Token scope: settings.write

```auto
[
{"schemaId":"builtin:anomaly-detection.databases",
"scope":"SERVICE-",
"value":
{
"responseTime":
{
"enabled":true,
"detectionMode":"auto",
"autoDetection":
{
"responseTimeAll":
{
"degradationMilliseconds":500,
"degradationPercent":1000
},
"responseTimeSlowest":
{
"slowestDegradationMilliseconds":200,
"slowestDegradationPercent":1000
},
"overAlertingProtection":
{
"requests PerMinute":100,
"minutesAbnormalState":2
}
}
},
"failureRate":
{
"enabled":true,
"detectionMode":"auto",
"autoDetection":
{
"absoluteIncrease":0,
"relativeIncrease":50,
"overAlertingProtection":
{
"requests PerMinute":10,
"minutesAbnormalState":1
}
}
},
"loadDrops":
{
"enabled":false
},
"loadSpikes":
{
"enabled":false
},
"databaseConnections":
{
"enabled":true,
"maxFailedConnects":100,
"timePeriod":10
}
}
}
]

```

also, you can use API v1 as well but I think the recommendation is to use API v2 such as Settings API

> **[Anomaly detection API](https://docs.dynatrace.com/docs/dynatrace-api/configuration-api/anomaly-detection-api)**
>
> Learn what the Dynatrace anomaly detection API offers.

---

<div class="post-metadata">

**Author:** ![Naveen](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/naveen/32/2570_2.png) [@Naveen](https://community.dynatrace.com/u/Naveen)\
**Post date:** [May 18, 2023, 4:49am UTC](https://community.dynatrace.com/t/what-are-the-scope-or-level-to-update-anomaly-detection-setting/39782/3 "2023-05-18T04:49:18Z")

</div>

Hi&nbsp;[@Mohamed\_Hamdy](https://community.dynatrace.com/user/4007)

Thanks is it possible to update it on process group level so that it can apply to all the services underneath. I can understand we can update it on host group and this will apply to all the hosts and services under that.

---

<div class="post-metadata">

**Author:** ![Mohamed\_Hamdy](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Mohamed\_Hamdy](https://community.dynatrace.com/u/Mohamed_Hamdy)\
**Post date:** [May 18, 2023, 8:46am UTC](https://community.dynatrace.com/t/what-are-the-scope-or-level-to-update-anomaly-detection-setting/39782/4 "2023-05-18T08:46:26Z")

</div>

Hi&nbsp;[@Naveen](https://community.dynatrace.com/user/51963),

it will not be applied on a process group level, also, based on which anomaly detection the scope is different, for instance, for service anomaly detection, it will be applied on the environment level (Globally), Host Group level, Service, Requests, as for Application anomaly detection, it will be applied&nbsp;on the environment level (Globally), Application, User Action.

so it’s the same as you configure the anomaly detection using UI, so process group is not an option
