Skip to main content

Trends API endpoint

Alex Bitca avatar
Written by Alex Bitca
Updated over a month ago

Retrieve detailed trend data for a specific trend group, including scores, trendlines, and respondent distributions.

Use this endpoint to access all the information needed to display or analyze trends for a given group.

  • [GET] https://app.retently.com/api/v2/trends/ - To get a list of all trend groups and the number of trends included in each one of them.

  • [GET] https://app.retently.com/api/v2/trends/:groupId - Pass the group ID to get all trends in that group.


Endpoint: api/v2/trends/:groupId

Parameters

  • "groupId" (string, required) - ID of the trend group. Use cases:

    • /api/v2/trends/default - pass "default" as a parameter to fetch the account’s default trend group (the one that it opened automatically when you access the Trends page).

  • "date" (string, optional) - Date range options. If "date" is not passed, then the default date range from your account will apply (the one that applies automatically when you access the Trends page).

    • Preset dates:

      • Options:

        • "today"

        • "yesterday"

        • "past-week"

        • "past-month"

        • "past-3-months"

        • "past-6-months"

        • "past-year"

        • "this-month-to-date"

        • "this-quarter-to-date"

        • "this-year-to-date"

      • Preset date request examples:

        • /api/v2/trends/:groupId?date=past-week

    • Custom date:

      • Options:

        • "startDate" (string, optional) - Custom start date in ISO or UNIX timestamp format. When used with "endDate", it overrides the "date" preset.

        • "endDate" (string, optional) - Custom end date in ISO or UNIX timestamp format. When used with "startDate", it overrides the "date" preset.

      • Custom date request example:

        • /api/v2/trends/:groupId?date=custom&startDate=2025-09-01&endDate=2025-09-30

Request Headers

Content-Type: application/json
Authorization: api_key={{your_Retently_api_key}}

Response Example

Clarifications:

  • trends.score.current - the current score the trend has, at the end of the time period that this trend is calculated for.

  • trends.score.previous - the initial score the trend has at the beginning of the time period for which this trend is calculated.

  • trends.score.change - the score difference between the "current" and "previous" score records.

  • trends.score.changePercentage - the difference between the "previous" and the "current" score in percentage.

{
"success": true,
"group": {
"_id": "645d33958c055989558a1",
"groupName": "CSAT Trends by Agent",
"metric": "CSAT",
"isDefault": true,
"createdDate": "2023-05-11T18:27:33.668Z",
"updatedDate": "2023-05-11T18:27:33.668Z"
},
"trends": [
{
"_id": "645d33c98f378dce41657",
"trendName": "Jim Smith",
"metric": "CSAT",
"score": {
"current": 88,
"previous": 100,
"change": -12,
"changePercentage": -12
},
"respondents": {
"counts": {
"promoters": 7,
"passives": 0,
"detractors": 1,
"total": 8
},
"percentages": {
"promoters": 88,
"passives": 0,
"detractors": 13
},
"distribution": {
"1": 1,
"5": 7
},
"metric": "CSAT"
},
"campaigns": [],
"attributes": [
{
"name": "Agent",
"op": "equal",
"value": {
"topic": "Jim Smith"
}
}
],
"question": [
{
"valueTitle": {
"title": "Main rating CSAT questions from selected campaigns",
"value": ""
}
}
],
"trend": [
{
"date": "2025-09-01T00:00:00.000Z",
"value": 100,
"counts": {
"promoters": 1,
"passives": 0,
"detractors": 0,
"total": 1
},
"distribution": {
"5": 1
}
}
]
}
],
"dateRange": {
"preset": "custom",
"start": "2025-09-01T07:00:00.000Z",
"end": "2025-10-01T06:59:59.999Z",
"timezone": "America/Los_Angeles"
}
}

Did this answer your question?