---
name: azion-run-graphql-queries-in-postman
description: >-
  Send a GraphQL API query from Postman with the endpoint, the token header, and a GraphQL body, and read the rows the API returns.
---

# Run GraphQL queries in Postman

You can send [GraphQL API](/en/documentation/devtools/graphql/overview/) queries from Postman and read the response next to the request. Postman sends the query as a `POST` request with your personal token in the `Authorization` header. To run a query from the browser or with `curl` instead, refer to the [GraphQL API quickstart](/en/documentation/devtools/graphql/first-steps/).

---

## Prerequisites

- A personal token. To create one, refer to [How to manage a personal token](/en/documentation/guides/platform/account-and-billing/personal-tokens/).
- Postman installed on your machine.
- A [workload](/en/documentation/platform/workloads/) that received requests during the time window you query. The sample query reads its request data.

---

## Send a query

The sample query reads `workloadMetrics`, an aggregated dataset of the metrics endpoint. It sums the bytes sent to clients per time bucket over seven days, oldest first, and returns at most 10 rows.

To send the query from Postman:

1. **Create a request**

   In Postman, select **+** to open a request.

2. **Set the method to POST**

   Select **GET** to open the method list, then select *POST*.

3. **Enter the endpoint**

   In the **Enter URL or paste text** field, enter the metrics endpoint:

   ```text
   https://api.azion.com/v4/metrics/graphql
   ```

   For raw data, such as `workloadEvents`, enter `https://api.azion.com/v4/events/graphql` instead. The endpoint of each dataset is on [Queries](/en/documentation/devtools/graphql/queries/).

4. **Add the authorization header**

   In the **Headers** tab, select **Bulk Edit** and enter the line below. Replace `[TOKEN VALUE]` with your personal token:

   ```text
   Authorization: Token [TOKEN VALUE]
   ```

   Keep the `Token` prefix. With `Bearer`, the API returns `401` with `Authentication credentials were not provided.`

5. **Select GraphQL as the body type**

   In the **Body** tab, select *GraphQL*.

6. **Enter the query**

   In the query box, enter the query. Set `tsRange` to a window in which your workload received requests:

   ```graphql
   query HttpQuery {
     workloadMetrics(
       limit: 10,
       filter: {
         tsRange: {begin:"2026-09-26T14:00:00", end:"2026-10-03T14:00:00"}
       }
       aggregate: {sum: bytesSent}
       groupBy: [ts]
       orderBy: [ts_ASC]
     )
     {
       ts
       sum
     }
   }
   ```

   The dataset name `httpMetrics` is deprecated; use `workloadMetrics`, which returns the same rows.

7. **Send the request**

   Select **Send**.

Postman shows the API's answer, `200` with the rows in JSON. The query returns up to 10 rows. The response is cut after the third:

```json
{
  "data": {
    "workloadMetrics": [
      {
        "ts": "2026-09-26T16:00:00Z",
        "sum": 104492
      },
      {
        "ts": "2026-09-27T18:00:00Z",
        "sum": 1100
      },
      {
        "ts": "2026-09-27T22:00:00Z",
        "sum": 14088
      },
      …
    ]
  }
}
```

---

## Read the response

The `data` key holds one array named after the dataset, with one object per row and only the fields the query selected:

| Field | Value                                                                                                             |
| ----- | ----------------------------------------------------------------------------------------------------------------- |
| `ts`  | The start of the time bucket, in UTC, marked by the `Z` suffix. Over a seven-day window, each bucket is one hour. |
| `sum` | The output of `aggregate: {sum: bytesSent}`: the bytes sent to clients during the bucket.                         |

A bucket with no requests returns no row, so the rows skip the hours without traffic. The bucket size follows the length of the window, as [How the GraphQL API works](/en/documentation/devtools/graphql/overview/) describes.

A refused query returns a JSON object with a single `detail` key that holds the message. For each message and its cause, refer to [Error responses](/en/documentation/devtools/graphql/error-responses/).

For more queries to run the same way, refer to [aziontech/azion-queries](https://github.com/aziontech/azion-queries), the Azion repository of GraphQL API query examples.

---

## Next steps

- [Query aggregated data with GraphQL](/en/documentation/guides/platform/observability/graphql-aggregated-data.md): Group and sum metrics with the aggregate functions.
- [Queries](/en/documentation/devtools/graphql/queries.md): Look up the query shape and endpoint for each kind of data.
- [Real-Time Metrics fields](/en/documentation/devtools/graphql/gql-real-time-metrics-fields.md): Find the fields you can select and aggregate.
- [Find the top values with GraphQL](/en/documentation/guides/platform/observability/graphql-top-x-query.md): Rank the most frequent values of a field.
