Skip to main content

Read

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/o/active_users

Overview

Retrieve active user metrics (DAU, WAU, MAU) for a specified time period.

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

  • Read (active_users feature)

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key for authentication
auth_tokenStringYes (or api_key)Auth token for authentication
app_idStringYesApplication ID to fetch metrics for
periodString or ArrayNoTime period: "yesterday", "hour", "7days", "30days", "60days", "day", "month", or custom array [start_timestamp, end_timestamp] (default: "30days")
db_overrideStringNoOverride Drill adapter (ignored if set to "compare" or "config")
comparisonBooleanNoWhen true, enables QueryRunner comparison mode (runs query on all available adapters for comparison logging)

Examples

Example 1: Get Active Users for Last 30 Days

Description: Retrieves DAU/WAU/MAU metrics for the default 30-day period.

Request:

curl "https://your-server.com/o/active_users?api_key=YOUR_API_KEY&app_id=123456789&period=30days"

Response:

{
"calculating": false,
"data": {
"2024.2.11": {
"d": 245,
"w": 1820,
"m": 5340
},
"2024.2.12": {
"d": 258,
"w": 1943,
"m": 5467
},
"2024.2.13": {
"d": 201,
"w": 1756,
"m": 5289
}
}
}

Example 2: Get Active Users for Custom Date Range

Description: Retrieves active user metrics for a specific date range using timestamps.

Request:

curl "https://your-server.com/o/active_users?api_key=YOUR_API_KEY&app_id=123456789&period=[1707619200,1710297600]"

Response:

{
"calculating": false,
"data": {
"2024.2.11": {"d": 245, "w": 1820, "m": 5340},
"2024.2.12": {"d": 258, "w": 1943, "m": 5467}
}
}

Response

Success Response

{
"calculating": false,
"data": {
"2024.2.11": {
"d": 245,
"w": 1820,
"m": 5340
},
"2024.2.12": {
"d": 258,
"w": 1943,
"m": 5467
}
}
}

Response Fields

FieldTypeDescription
calculatingBooleantrue when background calculation is in progress
dataObjectDictionary of dates with metrics
data.<date>.dNumberDaily Active Users for that calendar day
data.<date>.wNumberWeekly Active Users (unique users in past 7 days including current day)
data.<date>.mNumberMonthly Active Users (unique users in past 30 days including current day)
drillDisabledBooleanPresent when Drill is disabled or unavailable

Error Responses

  • HTTP 400 - Missing authentication:
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
  • HTTP 401 - Missing app_id:
{
"result": "No app_id provided"
}

Behavior

  • Requires Drill to be enabled; otherwise returns drillDisabled: true with empty data.
  • Calculates missing or stale entries in the background and returns calculating: true until refreshed.
  • db_override selects a Drill adapter unless set to compare or config.
  • comparison=true enables comparison mode for query execution.
  • For period=month, the response is grouped by month keys (YYYY.M) and values are averaged from daily values within each month.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.active_usersEndpoint data sourceStores endpoint-related records this endpoint reads or modifies.
countly_drill.drill_eventsDrill event recordsStores granular event rows queried or updated by this endpoint.