Is AI recommending you? Ask Contentstack Canoe for free
Is AI recommending your brand? Find out with Contentstack Canoe for free
Contentstack.comAcademyLogin
CS-log-dark.svgCS-log-dark.svg
  • Changelog
  • APIs
  • SDKs

Platform

  • Solution Center
  • Marketplace
  • Changelog
  • Developers & IT
  • Business users
  • Digital leaders
  • Developer Fast Track
  • Plans & Pricing

Solutions

  • Retail
  • Travel and tourism
  • Financial services
  • Technology
  • Manufacturing
  • E-commerce
  • Localization
  • Personalization
  • Portals and knowledge bases

Resources

  • Academy
  • Docs
  • Contentstack for Developers
  • Product updates
  • Contentstack on Contentstack
  • Blog
  • Insights and analyst reports
  • The Forrester Wave™: Digital Experience Platforms, Q4 2025
  • Webinars
  • Podcasts
  • Glossary
  • Content generative library
  • Community
  • Headless CMS
  • Composable AXP
  • Personalization
  • CDP

Customers

  • Case Studies
  • Customer Care
  • Contentstack Experience Awards
  • Customer support

Partners

  • Overview
  • Find a partner
  • Login

Company

  • About us
  • News
  • Customer support portal
  • Contact

Social

  • Facebook
  • LinkedIn
  • Instagram
  • GitHub
  • YouTube
  • Discord
  • X
LegalTermsPrivacyTrust Center

Cookie settings

Copyright © 2026 Contentstack Inc. All rights reserved.
/
  1. Home
  2. APIs
  3. Lytics API
  4. V1
  5. Metric

Metric

markdownView as Markdown

The Metric API provides access to a variety of metrics that are recorded

in the Lytics platform. With this API, you can access segment-size metrics,

events received per-hour, as well as many workflow specific metrics.

Metric

GEThttps://api.lytics.io/api/metric/

Fetch metrics by providing the arguments in the query-parameters

``sh

curl "$LIOAPI/api/metric?keyspace=segsize&metric=web&name=my-metric" -s -H "Authorization: $LIOKEY" | jq '.'

``

Sample Response
Status|200 OK
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
{
  "data": [
    {
      "name": "sample-request",
      "dimension": "segsize",
      "dimension_id": "abc123",
      "dimension_type": "size",
      "range": "2d",
      "aggregation": "max",
      "interval": "2h",
      "is_cached": true,
      "values": [
        {
          "value": 0,
          "ts": "1525231674371"
        },
        {
          "value": 100,
          "ts": "1525238874371"
        },
        {
          "value": 200,
          "ts": "1525246074371"
        },
        {
          "value": 300,
          "ts": "1525253274371"
        },
        {
          "value": 400,
          "ts": "1525260474371"
        },
        {
          "value": 500,
          "ts": "1525267674371"
        },
        {
          "value": 600,
          "ts": "1525274874371"
        },
        {
          "value": 700,
          "ts": "1525282074371"
        },
        {
          "value": 800,
          "ts": "1525289274371"
        },
        {
          "value": 900,
          "ts": "1525296474371"
        }
      ]
    }
  ],
  "message": "success",
  "status": 200
}

Metric

POSThttps://api.lytics.io/api/metric

Fetch metrics by providing the arguments in the request body

``sh

# Example of segment-size metrics

curl -s -XPOST "$LIOAPI/api/metric" \

-H 'Content-type: application/json' \

-H "Authorization: $LIOKEY" \

-d '{

"dimension": "segsize",

"dimension_id": "abc123",

"dimension_type": "size",

"interval": "2h",

"aggregation": "max",

"start_date": "now-5d",

"end_date": "now",

"smooth": true

}' | jq '.'

# Example request of data collected from the default and email stream

curl -s -XPOST "$LIOAPI/api/metric" \

-H "Content-type: application/json" \

-H "Authorization: $LIOKEY" \

-d '[{

"dimension": "stream",

"dimension_id": "default",

"dimension_type": "size",

"interval": "1h",

"aggregation": "sum",

"start_date": "now-1w",

"end_date": "now"

},

{

"dimension": "stream",

"dimension_id": "email",

"dimension_type": "size",

"interval": "1h",

"aggregation": "sum",

"start_date": "now-2w",

"end_date": "now"

}]' | jq '.'

``

Sample Request
123456789
{
  "dimension": "segsize",
  "dimension_id": "default",
  "dimension_type": "size",
  "interval": "2h",
  "aggregation": "max",
  "startdate": "now-5d",
  "enddate": "now"
}
Sample Response
Status|200 OK
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
{
  "data": [
    {
      "name": "sample-request",
      "dimension": "segsize",
      "dimension_id": "abc123",
      "dimension_type": "size",
      "range": "2d",
      "aggregation": "max",
      "interval": "2h",
      "is_cached": true,
      "values": [
        {
          "value": 0,
          "ts": "1525231674371"
        },
        {
          "value": 100,
          "ts": "1525238874371"
        },
        {
          "value": 200,
          "ts": "1525246074371"
        },
        {
          "value": 300,
          "ts": "1525253274371"
        },
        {
          "value": 400,
          "ts": "1525260474371"
        },
        {
          "value": 500,
          "ts": "1525267674371"
        },
        {
          "value": 600,
          "ts": "1525274874371"
        },
        {
          "value": 700,
          "ts": "1525282074371"
        },
        {
          "value": 800,
          "ts": "1525289274371"
        },
        {
          "value": 900,
          "ts": "1525296474371"
        }
      ]
    }
  ],
  "message": "success",
  "status": 200
}
Hide Parameters

Query Parameters

account_idoptionalstring

Your Lytics account ID.

nameoptionalstring

Name of the metric to return

Example:

my-metric
dimensionrequiredstring

Value of supported dimension (segment, experience, stream, etc)

Example:

segment
dimension_idrequiredstring

ID for the specific item within dimension such as a segment ID. Tip: If the type is a segment you can use all_segments as the dimension id to get all segments for the account.

Example:

abc123
dimension_typerequiredstring

Type of metric to be returned (size, converted, etc)

Example:

size
aggregationoptionalstring

Aggregation to apply to metrics (sum, max, min)

Example:

sum
intervaloptionalstring

Duration to roll-up metrics (2h for roll-up into two-hour buckets). Intervals smaller than two hours are not recommended.

Example:

2h
include_empty_rowsoptionalstring

Passing true will include zero values in the response for every interval whether metrics were logged during that period or not.

Example:

false
smoothoptionalstring

Smooth metrics using a moving-average function

Example:

true
start_dateoptionalstring

Fetch metrics after this date; both dates and relative-dates are supported

Example:

now-5w
end_dateoptionalstring

Fetch metrics before this date; both dates and relative-dates are supported

Example:

now-1w
rangeoptionalstring

Time string used to calculate range from now (e.g "2h" will return the last 2 hours). This parameter cannot

be used in conjunction with start_date and/or end_date)

Example:

2h

Headers

Authorizationoptionalstring

Hide Parameters

Query Parameters

account_idoptionalstring

Your Lytics account ID.

Headers

Authorizationoptionalstring

Body Parameters

dimensionoptionalstring

Value of supported dimension (segment, experience, stream, etc)

dimension_idoptionalstring

ID for the specific item within dimension such as a segment ID. Tip: If the type is a segment you can use all_segments as the dimension id to get all segments for the account.

dimension_typeoptionalstring

Type of metric to be returned (size, converted, etc)

intervaloptionalstring

Duration to roll-up metrics (2h for roll-up into two-hour buckets). Intervals smaller than two hours are not recommended.

aggregationoptionalstring

Aggregation to apply to metrics (sum, max, min)

smoothoptionalboolean

Smooth metrics using a moving-average function

include_empty_rowsoptionalboolean

Passing true will include zero values in the response for every interval whether metrics were logged during that period or not.

start_dateoptionalstring

Fetch metrics after this date; both dates and relative-dates are supported

end_dateoptionalstring

Fetch metrics before this date; both dates and relative-dates are supported