---
title: "Metrics"
description: "<p>Query time series metrics for segments, streams, experiences, and other Lytics resources.</p>"
url: "https://www.contentstack.com/docs/developers/apis/lytics-api/metrics"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-20"
---

# Metrics

Query time series metrics for segments, streams, experiences, and other Lytics resources.

## Query metrics (GET)

### Query metrics (GET)

**GET** `/v2/metric`

Query one or more metrics via query parameters. The Metric API provides access to time series data for segments, streams, experiences, and other Lytics resources.

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **name** (optional)
  Friendly name to identify this metric request
- **dimension** (required)
  The dimension to query
- **dimension_id** (required)
  The ID of the specific resource within the dimension (e.g. segment ID)
- **dimension_type** (required)
  The metric type to retrieve (e.g. size, converted, conversionrate)
- **aggregation** (required)
  Comma-separated aggregation methods to apply
- **start_date** (optional)
  Start of the query range. Supports friendly times (e.g. now-7d). Required if end\_date is set; cannot be used with range.
- **end_date** (optional)
  End of the query range. Supports friendly times (e.g. now). Required if start\_date is set.
- **range** (optional)
  Time range from now (e.g. 7d for last 7 days). Cannot be used with start\_date or end\_date.
- **interval** (optional)
  Bucket size for time series grouping (e.g. 1d, 2h). Defaults to 2h.
- **smooth** (optional)
  Apply smoothing to the resulting metrics
- **round_dates** (optional)
  Round start and end dates down to the nearest day
- **include_empty_rows** (optional)
  Include zero-value buckets in the response
- **include_sum_of_buckets** (optional)
  Include a sum of all bucket values in the response
- **refresh_cache** (optional)
  Bypass the cache and read fresh from the time-series store

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "aggregation": "string",
      "create_time": "2019-08-24T14:15:22Z",
      "dimension": "string",
      "dimension_id": "string",
      "dimension_type": "string",
      "end_date": "string",
      "errors": [
        "string"
      ],
      "include_empty_rows": true,
      "include_sum_of_buckets": true,
      "interval": "string",
      "is_cached": true,
      "name": "string",
      "range": "string",
      "refresh_cache": true,
      "round_dates": true,
      "smooth": true,
      "start_date": "string",
      "sum": 0,
      "values": [
        {
          "ts": "1285891200000",
          "value": 0
        }
      ]
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Query metrics (POST)

### Query metrics (POST)

**POST** `/v2/metric`

Query one or more metrics by posting a JSON array of metric requests. The Metric API provides access to time series data for segments, streams, experiences, and other Lytics resources.

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "aggregation": "string",
      "create_time": "2019-08-24T14:15:22Z",
      "dimension": "string",
      "dimension_id": "string",
      "dimension_type": "string",
      "end_date": "string",
      "errors": [
        "string"
      ],
      "include_empty_rows": true,
      "include_sum_of_buckets": true,
      "interval": "string",
      "is_cached": true,
      "name": "string",
      "range": "string",
      "refresh_cache": true,
      "round_dates": true,
      "smooth": true,
      "start_date": "string",
      "sum": 0,
      "values": [
        {
          "ts": "1285891200000",
          "value": 0
        }
      ]
    }
  ],
  "request_id": "string",
  "status": 0
}
```