# How to use APIs to track the license usage of various system users?

**URL:** <https://community.dynatrace.com/t/how-to-use-apis-to-track-the-license-usage-of-various-system-users/49861>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [January 22, 2025, 10:08am UTC](https://community.dynatrace.com/t/how-to-use-apis-to-track-the-license-usage-of-various-system-users/49861 "2025-01-22T10:08:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ADbyCool](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@ADbyCool](https://community.dynatrace.com/u/ADbyCool)\
**Post date:** [January 22, 2025, 10:08am UTC](https://community.dynatrace.com/t/how-to-use-apis-to-track-the-license-usage-of-various-system-users/49861/1 "2025-01-22T10:08:46Z")

</div>

How to use APIs to track the license usage of various system users?

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [January 27, 2025, 9:11am UTC](https://community.dynatrace.com/t/how-to-use-apis-to-track-the-license-usage-of-various-system-users/49861/2 "2025-01-27T09:11:00Z")

</div>

You can leverage the DQL API:&nbsp;[Grail service | Dynatrace Developer](http://developer.dynatrace.com/platform-services/services/storage/)

Then using a query like following will give you the DQL query usage.

```markup
fetch dt.system.events
| filter event.kind == "BILLING_USAGE_EVENT" and matchesPhrase(event.type, "Query")
| filter isNotNull(user.email)
| fields query_start, event.type, user.email, billed_bytes
| fieldsAdd query_cost = billed_bytes/1024/1024/1024*toDouble(0.0035)

```

 ![mark_bley_0-1737968734517.png](https://global.discourse-cdn.com/dynatrace/original/2X/8/84ae533bf60f27417c25b61262b60361b17ace38.png)
