Skip to main content

/o/analytics/events

Endpoint

/o/analytics/events

Overview

Returns event analytics in different output modes based on event, events, and segmentation parameters.

Authentication

  • API Key (parameter): api_key=YOUR_API_KEY
  • Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
  • Auth Token (header): countly-token: YOUR_AUTH_TOKEN

Permissions

  • Requires read access to feature core for the target app.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)Dashboard API authentication key.
auth_tokenStringYes (or use api_key)Dashboard auth token.
app_idStringYesApp ID (24-char hex).
periodStringNoRequested period for event aggregation.
eventStringNoSingle event key mode.
eventsJSON String (Array) or ArrayNoMulti-event mode.
segmentationStringNoSegment key. If set (and not no-segment), segmented output is returned.
bucketStringNoBucket override for single-event subperiod mode (daily / monthly).
timezoneStringNoOptional timezone override.
timestampNumberNoOptional reference timestamp.

Parameter Semantics

  • event has priority over events when both are provided.
  • events can be a JSON string or array.
  • Invalid events JSON returns a validation error.
  • If neither event nor events is provided, endpoint returns top summary from all aggregate.

Response

Success Response

Single event mode (event=Playback Resumed):

[
{"_id": "2026-2-10", "c": 8, "s": 0, "dur": 0},
{"_id": "2026-2-11", "c": 6, "s": 0, "dur": 0}
]

Multi-event mode (events=["Playback Started","Playback Resumed"]):

{
"Playback Started": [
{"_id": "2026-2-10", "c": 4, "s": 0, "dur": 0}
],
"Playback Resumed": [
{"_id": "2026-2-10", "c": 8, "s": 0, "dur": 0}
]
}

No event filter mode:

{
"all": [
{"key": "Playback Completed", "c": 29, "s": 0, "dur": 147454},
{"key": "Playback Resumed", "c": 25, "s": 0, "dur": 0}
]
}

Response Fields

FieldTypeDescription
[]ArrayReturned in single-event mode.
[] ._idStringTime bucket key in subperiod outputs.
[] .cNumberEvent count.
[] .sNumberEvent sum.
[] .durNumberEvent duration total.
event_keyArrayReturned in multi-event mode; response object uses requested event names as keys.
allArrayReturned when neither event nor events is provided.
all[] .keyStringEvent key in summary mode.

Error Responses

Status Code: 400 Bad Request

{"result":"Must provide valid array with event keys as events param."}

Status Code: 400 Bad Request

{"result":"Missing parameter \"app_id\""}

Status Code: 401 Unauthorized

{"result":"App does not exist"}

Behavior/Processing

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Single-event subperiodevent is provided and segmentation is missing or no-segmentReads hashed event aggregate and returns subperiod data (optionally bucketed).Raw root array of event points.
Single-event segmentedevent is provided and segmentation is set to a segment keyReads hashed event aggregate and extracts segmented totals.Raw root array of segment rows.
Multi-event modeevent is missing and events is a valid array/JSON string arrayIterates events, reads each aggregate, and returns data per event key.Raw root object keyed by event name.
Summary modeevent and events are both missingReads all aggregate and returns key-based summary under all.Raw root object: { "all": [...] }.

Impact on Other Data

  • Read-only endpoint.

Audit & System Logs

  • No /systemlogs action is emitted by this endpoint.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuthentication and permission validationReads member record by api_key or auth_token to verify read access.
countly.appsApp context validationReads app record (timezone, app state) for the requested app_id.
countly.events_dataEvent aggregate sourceRead for event subperiod and segmented analytics.

Examples

Example 1: Single event

/o/analytics/events?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
event=Playback Resumed&
period=7days

Example 2: Multiple events

/o/analytics/events?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
events=["Playback Started","Playback Resumed"]&
period=7days

Example 3: Segmented single event

/o/analytics/events?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
event=Purchase&
segmentation=platform&
period=30days

Operational Considerations

  • Multi-event mode runs event reads per requested event key.
  • High-cardinality segmentation increases response size.

Limitations

  • Invalid events JSON fails request.
  • Missing/unknown event keys can yield empty arrays.

Last Updated

2026-02-17