Skip to main content

Metric query API

Last updated 10/03/2026

For how to call the API, see the calling method described in the Open API document.

We recommend that you first read the AE user guide to learn about the metric-related features: Metrics

1. Query the list of available metrics​

Query the definition of metrics by conditions

Endpoint URL

/open/metric-list?token=xxx

Request method

POST

Content-Type

application/json

Request query parameters

Parameter nameExample valueParameter typeRequiredDescription
tokenxxxStringYesQuery key

Request body parameters

{
"projectId": 102,
"metricName": "retention_1", //Metric name - supports fuzzy matching
"metricDesc": "Day-1 retention", // Metric display name - supports fuzzy matching
"metricModes": ["EVENT","RETENTION"], // Metric creation source
"createUser":"root", //Creator
"updateUser":"root", //Last modified by
"timeParticleSize":"day" //Time granularity supported by the metric
}
Parameter name

Example value

Parameter typeRequiredDescription
projectId102IntegerYesProject ID
metricNameretention_1StringNoMetric name - supports fuzzy matching
metricDescDay-1 retentionStringNoMetric display name - supports fuzzy matching
metricModes

["EVENT",

"RETENTION"]

List

No

Metric creation source

EVENT - event metric

RETENTION - retention metric

createUserrootStringNoLogin name of the metric creator
updateUserrootStringNoLogin name of the user who modified the metric
timeParticledayStringNo

Time unit supported by the metric

  • minute: by 1 minute
  • minute5: by 5 minutes (supported since v3.5)
  • minute10: by 10 minutes (supported since v3.5)
  • hour: by hour
  • day: by day
  • week: by week
  • month: by month
  • total: total

Response parameters

{
"data":
[
{
"metricId": 1,
"projectId": 2,
"metricName": "retention_1",
"metricDesc": "Day-1 retention",
"metricRemark": "Day-1 retention of registered users",
"metricMode": "EVENT",
"createUser": "root",
"updateUser": "root",
"createTime": "2022-12-12 10:10:00",
"updateTime": "2022-12-12 10:10:00",
"timeParticles":[ "minute"],
"format": "FORMAT_FLOAT"
}
],
"return_code": 0,
"return_message": "success"
}
Parameter name

Example value

Parameter typeDescription
data-Returned result
data.metricId1LongMetric ID
data.projectId102IntegerID of the project that the metric belongs to
data.metricNameretention_1StringMetric name
data.metricDescDay-1 retentionStringMetric display name
data.metricRemarkDay-1 retention of registered usersStringMetric remarks
data.metricModeRETENTIONStringMetric creation source
data.createUserrootStringUser who created the metric
data.updateUserrootStringUser who modified the metric
data.createTime2022-12-12 10:10:00DateMetric creation date
data.updateTime2022-12-12 10:10:00DateMetric modification date
data.timeParticles

['day',

'hour',

'month']

List

Time unit supported by the metric

  • minute: by 1 minute
  • minute5: by 5 minutes (supported since v3.5)
  • minute10: by 10 minutes (supported since v3.5)
  • hour: by hour
  • day: by day
  • week: by week
  • month: by month
  • total: total
data.formatFORMAT_FLOATString

Metric format

  • FORMAT_FLOAT: two decimal places
  • FORMAT_FLOAT2: three decimal places
  • FORMAT_FLOAT4: four decimal places
  • FORMAT_INTEGER: integer
  • FORMAT_PERCENT: percentage
return_code0IntegerReturn code
return_messagesuccessStringReturn message

2. Query metric data​

Endpoint URL

/open/metric-data?token=xxx

Request method

POST

Content-Type

application/json

Request query parameters

Parameter nameExample valueParameter typeRequiredDescription
tokenxxxStringYesQuery key

Request body parameters

{
"eventView": {
"comparedByTime": true,
"comparedStartTime": "2021-12-14 00:00:00",
"comparedEndTime": "2021-12-20 23:59:59",
"comparedRecentDay": "8-14",
"startTime": "2021-12-21 00:00:00",
"endTime": "2021-12-27 23:59:59",
"recentDay": "1-7",
"timeParticleSize": "day",
"groupBy": [{
"columnDesc": "Brand",
"columnName": "brand",
"propertyRange": "",
"specifiedClusterDate": "2021-12-28",
"tableType": "event"
}],
"relation": "and",
"filts": [{
"columnDesc": "Brand",
"columnName": "brand",
"comparator": "equal",
"filterType": "SIMPLE",
"ftv": ["Apple", "Xiaomi"],
"specifiedClusterDate": "2021-12-28",
"tableType": "event",
"timeUnit": ""
}],
"queryFeature": {
"approximateOn": true,
"globalQueryOn": false
}
},
"metrics":["retention_1","dau"],
"zoneOffset": 0,
"projectId": 377,
"useSameResultKey": false,
"useCache": true,
"limit": 1000,
"timeoutSeconds": 10
}
Parameter nameExample valueParameter typeRequiredDescription
eventView-ObjectYesCommon properties of the metrics
eventView.comparedByTimetrueBooleanNoWhether to compare time. TRUE: yes, FALSE: no

eventView.comparedStartTime

2021-12-14 00:00:00String

No

Start time of the comparison period (format: yyyy-MM-dd HH:mm:ss). Takes effect when the relative comparison time is empty
eventView.comparedEndTime2021-12-20 23:59:59StringNoEnd time of the comparison period (format: yyyy-MM-dd HH:mm:ss). Takes effect when the relative comparison time is empty
eventView.comparedRecentDay8-14StringNoRelative comparison time (when comparedByTime is TRUE, this item, the comparison start time, and the comparison end time can't all be empty)
eventView.startTime2021-12-21 00:00:00StringNoStart time (format: yyyy-MM-dd HH:mm:ss). Takes effect when the relative time is empty
eventView.endTime2021-12-27 23:59:59StringNoEnd time (format: yyyy-MM-dd HH:mm:ss). Takes effect when the relative time is empty
eventView.recentDay1-7StringNoRelative time (this item, the start time, and the end time can't all be empty)
eventView.relationandStringNoLogical relation. and: logical AND, or: logical OR

eventView.timeParticleSize

dayStringYes

Time unit of the analysis

  • minute: every 1 minute
  • minute5: every 5 minutes (supported since v3.5)
  • minute10: every 10 minutes (supported since v3.5)
  • hour: hourly
  • day: daily
  • week: weekly
  • month: monthly
  • total: total
eventView.groupBy-ListNoGroup-by properties. There can be zero or more
eventView.groupBy.columnNamebrandStringYesField name
eventView.groupBy.columnDescBrandStringNoField display name
eventView.groupBy.propertyRangeStringNoCustom property range
eventView.groupBy.propertyRangeTypeStringNo

Property range type. When you group by a numeric property, you can use custom bucketing conditions

  • def: default ranges, divided automatically by the system
  • discrete: each value is a separate group
  • user_defined: user-defined. The custom content is set in propertyRange
eventView.groupBy.specifiedClusterDate2021-12-28StringNoUses the historical version of the tag for the specified date
eventView.groupBy.tableTypeeventStringYesTable type enum values
eventView.filts-ListNoGlobal filters
eventView.filts.columnDescBrandStringNoField display name
eventView.filts.columnNamebrandStringYesField name
eventView.filts.comparatorequalStringYesSee Filter expressions in the Query API
eventView.filts.filterTypeSIMPLEStringNoFilter mode. SIMPLE: simple, COMPOUND: compound. Defaults to SIMPLE
eventView.filts.ftv["Apple", "Xiaomi"]ListNoLiteral constants used as boundaries for property comparison
eventView.filts.specifiedClusterDate2021-12-28StringNoUses the historical version of the tag for the specified date
eventView.filts.tableTypeeventStringYesTable type enum values
eventView.filts.timeUnitStringNoUnit of the property comparison value, valid only for relativeEvent*: day, hour, minute
eventView.queryFeature-ObjectNoQuery configuration
eventView.queryFeature.approximateOntrueBooleanNoWhether to enable approximate calculation
metrics["retention_1","dau"]listYesList of metric names
projectId377IntegerYesProject ID

zoneOffset

0IntegerNoTime zone used
useCachetrueBooleanNoWhether to use the cache. Optional. Defaults to true
limit1000IntegerNoMaximum number of groups per analysis object. Optional. Defaults to 1000, with a maximum of 10000
timeoutSeconds10IntegerNoRequest timeout. The query task is canceled when it times out

Success response example

{
"data": {
"result_generate_time": "2021-12-30 11:15:41",
"union_groups": [
[
"Safari",
"Apple"
],
[
"Firefox",
"Xiaomi"
],
[
"WeChat built-in browser",
"Apple"
],
[
"Overall",
"Apple"
],
[
"Overall",
"Xiaomi"
]
],
"x": [
"2021-12-23",
"2021-12-24",
"2021-12-25",
"2021-12-26",
"2021-12-27",
"2021-12-28",
"2021-12-29"
],
"x_compared": [
"2021-12-16",
"2021-12-17",
"2021-12-18",
"2021-12-19",
"2021-12-20",
"2021-12-21",
"2021-12-22"
],
"y": [
{
"retention_1": [
{
"group_cols": [
"Safari",
"Apple"
],
"group_num": 3,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"447",
"980",
"1584",
"321",
"285",
"74",
"0"
]
},
{
"group_cols": [
"Firefox",
"Xiaomi"
],
"group_num": 3,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"291",
"818",
"1128",
"272",
"219",
"58",
"0"
]
},
{
"group_cols": [
"WeChat built-in browser",
"Apple"
],
"group_num": 3,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"231",
"500",
"764",
"214",
"155",
"35",
"0"
]
}
]
},
{
"dau": [
{
"group_cols": [
"Overall",
"Apple"
],
"group_num": 2,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"640",
"811",
"1251",
"1253",
"720",
"113",
"0"
]
},
{
"group_cols": [
"Overall",
"Xiaomi"
],
"group_num": 2,
"values": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"values_compared": [
"277",
"439",
"600",
"666",
"364",
"59",
"0"
]
}
]
}
]
},
"return_code": 0,
"return_message": "success"
}

Response parameters

Parameter nameExample valueParameter typeDescription
data-ObjectReturned result
data.result_generate_time2021-12-29 12:00:00StringQuery result generation time
data.union_groups["Apple"]ListSet of all groups
data.x["2021-12-23"]ListX-axis time
data.x_compared["2021-12-16"]ListX-axis comparison time
data.y-ListList of Y-axis data
data.y.{metric name}-ListList of Y-axis metric information
data.y.{metric name}.group_cols["Apple"]ListY-axis metric groups
data.y.{metric name}.group_num3IntegerNumber of Y-axis metric groups
data.y.{metric name}.values["0"]ListY-axis metric values
data.y.{metric name}.values_compared["447"]ListY-axis metric values for the comparison period
return_code0IntegerReturn code
return_messagesuccessStringReturn message
Was this page helpful?