---
title: "How to retrieve Metrics"
description: "Metrics are derived from events tracked by the Enterprise Stack. To explore the different types of events available, please click here. By utilizing the events/query endpoint, we can not only fetch the events that have…"
stack: "Enterprise Stack (commercial) — version 0.21.0"
stack_version: "0.21.0"
stack_comparison: https://docs.walt.id/community-vs-enterprise.md
canonical_url: https://docs.walt.id/enterprise-stack/administration/events-and-metrics/retrieve-metrics
generated: 2026-07-20
---
# How to retrieve Metrics

**Metrics are derived from events** tracked by the Enterprise Stack. To explore the different types of events available,
please click [here](https://docs.walt.id/enterprise-stack/administration/events-and-metrics/event-types/event-types-overview.md). By utilizing the `events/query` endpoint, we can not only
fetch the events that have occurred, but we
can also **aggregate these events into metrics** through our group by function.

In the following section, we will see **how to retrieve the number all successful issuance events**

## Retrieve Metrics

We will use the `/events/query` endpoint to specify a filter. This filter will ensure that we only retrieve the events
we want to include in our metric. Also, we specify a group by function that should be applied to a specified field in our
filtered events.

**Option: CURL**

Endpoint: `/v1/events/query` | [API Reference](https://enterprise.sandbox.walt.id/swagger/index.html#/Events/post_v1_events_query)

  Ensure the organization is set to one your user has read access on when filtering for events.

**Example Request**

```bash
curl -X 'POST' \
  'https://{orgID}.enterprise-sandbox.waltid.dev/v1/events/query?organization={orgID}&groupBy={pathToField}' \
  -H 'accept: */*' \
  -H 'Authorization: Bearer {yourToken}' \
  -H 'Content-Type: application/json' \
  -d '{
  "target": [
    "waltid.mycustomer.issuer2"
  ]
}'
```

**Path Parameters**

- `orgID`: - When performing operations within an organization, it is essential to use the organization's Base URL or
  another valid host alias. For example, if your organization is named `test`, your default Base URL will
  be `test.enterprise-sandbox.walt.dev` when using the sandbox environment.
- `pathToField`: Specifies the field of the events we want to group by, in our example `status.type`.

**Body**

```json
{
  "target": [
    "waltid.mycustomer.issuer2"
  ]
}
```

Here we specify that we only want to receive events that happened in a specific target. Learn more about how to
craft your filter [here](https://docs.walt.id/enterprise-stack/administration/events-and-metrics/query-events.md#crafting-the-filter)

---

**Response**

- `200` - Events with group option retrieved successfully.

**Example Response**

```json
[
  {
    "_id": "Open",
    "count": 2
  },
  {
    "_id": "Success",
    "count": 2
  }
]

```

Now in the response we can see that we have issued two credentials successfully:

```json
{
  "_id": "Success",
  "count": 2
}
```
