---
name: azion-export-a-chart-s-data-and-query
description: >-
  Download the points of a Real-Time Metrics chart as a CSV file, or copy its GraphQL query and run it in the GraphiQL Playground or with curl.
---

# Export a chart's data and query

You can export the points of a [Real-Time Metrics](/en/documentation/platform/real-time-metrics/) chart, or copy its GraphQL query, from the chart menu in Azion Console. A copied query runs in the GraphiQL Playground or with `curl`. To narrow the data before you export it, refer to [Filter a Real-Time Metrics dashboard](/en/documentation/guides/platform/observability/add-filters-metrics/).

The examples on this page use the **Edge Cache** chart of the **Data Transferred** dashboard, under **Build** › **Applications**.

---

## Prerequisites

- Access to Azion Console. To sign in, refer to [How to access Azion Console](/en/documentation/guides/platform/account-and-billing/how-to-access-azion-console/).
- A chart with data in the selected time range. To read your first numbers, refer to [Real-Time Metrics quickstart](/en/documentation/platform/real-time-metrics/quickstart/).
- A personal token and `curl`, to send a copied query from a terminal. To create a token, refer to [How to manage a personal token](/en/documentation/guides/platform/account-and-billing/personal-tokens/).

---

## Export a chart's points as CSV

**Export CSV** downloads the points of one chart as a comma-separated values (CSV) file. The file covers the time range and the filters set in the filter row.

To export a chart in Azion Console:

1. **Open Real-Time Metrics**

   Access [Azion Console](https://console.azion.com/) > **Real-Time Metrics**.

2. **Open the dashboard that holds the chart**

   Select the category, the product tab, and the dashboard. For example, select **Build**, **Applications**, and **Data Transferred**.

3. **(Optional) Set the time range and the filters**

   The file holds only the points that the range and the filters select. For each control, refer to [Filters and time range](/en/documentation/platform/real-time-metrics/filters-and-time-range/).

4. **Open the chart menu**

   In the chart card, select the menu button, labeled **More options**.

5. **Select Export CSV**

The browser downloads a file named after the chart, such as `Edge Cache.csv`.

On a time chart, the file holds one line per point that the chart plots. The first line names the columns: `ts`, then one column per series, named after its field. For **Edge Cache**, the first line reads `ts;dataTransferredTotal;dataTransferredOut;dataTransferredIn`.

Each following line holds the time of one point, such as `10/02/2026, 11:15:00 AM`, then the value of each series. The values carry no unit: the **Edge Cache** columns are in bytes. For the separator and date rules, refer to [Export CSV](/en/documentation/platform/real-time-metrics/filters-and-time-range/#export-csv).

---

## Copy a chart's query

**Copy query** puts the GraphQL query of one chart and its variables on the clipboard. The menu item opens nothing, so you paste the text where you want to run it.

To copy the query in Azion Console:

1. **Open Real-Time Metrics**

   Access [Azion Console](https://console.azion.com/) > **Real-Time Metrics**.

2. **Open the dashboard that holds the chart**

   Select the category, the product tab, and the dashboard. For example, select **Build**, **Applications**, and **Data Transferred**.

3. **Open the chart menu**

   In the chart card, select the menu button, labeled **More options**.

4. **Select Copy query**

The clipboard holds the chart's query for the time range and the filters of the dashboard. For the **Edge Cache** chart over 24 hours, the text reads:

```text
# QUERY

query ($tsRange_begin:DateTime!, $tsRange_end:DateTime!) {
  httpMetrics (
    limit: 5000
    groupBy: [ts]
    orderBy: [ts_ASC]
    filter: {
      tsRange: {
        begin: $tsRange_begin
        end: $tsRange_end
      }
    }
  ) {
    dataTransferredTotal
    dataTransferredOut
    dataTransferredIn
    ts
  }
}


# VARIABLES
{
  "tsRange_begin": "2026-01-01T12:00:00",
  "tsRange_end": "2026-01-02T12:00:00"
}
```

The text is in two parts. Under `# QUERY`, the query reads the range from the variables `$tsRange_begin` and `$tsRange_end`. Under `# VARIABLES`, a JSON object holds their values. Each filter applied on the dashboard adds variables of its own. The query does not run without its variables, so each part goes to its own place.

---

## Run the copied query

A copied query calls the API that the chart reads, `https://api.azion.com/v4/metrics/graphql`. You can run it in the GraphiQL Playground or send it with `curl`.

### Run the query in the GraphiQL Playground

The GraphiQL Playground takes the query and its variables in two separate panes.

To run the copied query in the GraphiQL Playground:

1. **Open the GraphiQL Playground**

   To reach it, refer to [GraphiQL Playground](/en/documentation/devtools/graphql/graphql-playground/).

2. **Paste the query**

   In the query editor, paste the copied text from `# QUERY` up to the line before `# VARIABLES`.

3. **Paste the variables**

   In the variables pane, paste the JSON object that follows `# VARIABLES`.

4. **Run the query**

The playground sends the query with its variables and returns the rows of the chart as JSON.

### Send the query with curl

To send a copied query with `curl`, put the query on one line in the `query` key of the body. Put the JSON object that follows `# VARIABLES` in the `variables` key. To read another period, change `tsRange_begin` and `tsRange_end`.

Replace `[TOKEN VALUE]` with your personal token, and send the request:

```bash
curl -X POST 'https://api.azion.com/v4/metrics/graphql' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token [TOKEN VALUE]' \
  -d '{"query":"query ($tsRange_begin:DateTime!, $tsRange_end:DateTime!) { httpMetrics (limit: 5000 groupBy: [ts] orderBy: [ts_ASC] filter: { tsRange: { begin: $tsRange_begin end: $tsRange_end } }) { dataTransferredTotal dataTransferredOut dataTransferredIn ts } }","variables":{"tsRange_begin":"2026-01-01T12:00:00","tsRange_end":"2026-01-02T12:00:00"}}'
```

The API answers `200` with one row per minute that has traffic, oldest first:

```json
{
  "data": {
    "httpMetrics": [
      {
        "dataTransferredTotal": 2662983.0,
        "dataTransferredOut": 2649889.0,
        "dataTransferredIn": 13094.0,
        "ts": "2026-01-01T13:04:00Z"
      },
      {
        "dataTransferredTotal": 994021.0,
        "dataTransferredOut": 986551.0,
        "dataTransferredIn": 7470.0,
        "ts": "2026-01-01T13:06:00Z"
      },
      …
    ]
  }
}
```

The `dataTransferredTotal` values of the rows add up to the same 24-hour total that the [Real-Time Metrics quickstart](/en/documentation/platform/real-time-metrics/quickstart/) reads for the range. The API leaves out the minutes with no traffic, such as 13:05, which the chart plots as zero.

For every field of the `httpMetrics` dataset, refer to [Real-Time Metrics GraphQL fields](/en/documentation/devtools/graphql/gql-real-time-metrics-fields/#workloadmetrics).

---

## Next steps

- [Filters and time range](/en/documentation/platform/real-time-metrics/filters-and-time-range.md): Every item of the chart menu, and the controls that set what a chart shows.
- [Query the httpBreakdownMetrics dataset](/en/documentation/guides/platform/observability/query-httpbreakdownmetrics-data-with-graphql.md): Write a GraphQL query of your own for the request breakdown dataset.
- [Build a custom Grafana dashboard](/en/documentation/guides/platform/observability/azion-plugin-grafana-custom-dash.md): Plot Real-Time Metrics queries in Grafana with the Azion plugin.
- [How the GraphQL API works](/en/documentation/devtools/graphql/overview.md): The Azion GraphQL APIs, and the questions a Real-Time Metrics query can answer.
