Register a Retention Query
Registers an asynchronous Retention analysis query and returns a request_id. Retention analysis groups users who performed a first event into cohorts, then measures how many return to perform a second event in each later period.
Use the request_id with Get Query Status to poll for completion, then Get Query Results to fetch the resolved series.
Rate Limit
The rate limits are at the workspace level. A maximum of 5 requests per second, 10 requests per minute, and 50 requests per hour are allowed per workspace.Authorizations
Authentication is done via Basic Auth. This requires a Base64-encoded string of your credentials in the format username:password.
- Username: Use your MoEngage Workspace ID (also known as the App ID). Find it in the MoEngage dashboard at Settings > Account > API keys.
- Password: Use an API key from Settings > Account > API keys.
Refer to API Key Dashboard for details on creating and managing API keys.
Body
Request body for registering a Retention analysis query.
Payload schema version.
"2.0"
The analysis type. Must be retention for this endpoint.
retention Exactly two events: the first event that places a user into a cohort, and the return event measured in later periods.
2 elementsSegments to scope the analysis (up to 5). Segmentation and comparison_timerange are mutually exclusive — do not send 2 or more segments together with a time comparison.
5The time window the analysis runs over.
Cohort period — h (hour), d (day), w (week), m (month), or e (entire range). Hourly is limited to a 24-hour window, daily to 90 days, and weekly to 180 days.
h, d, w, m, e "d"
Visual representation of the result.
line, area, bar, column, euler, pie "line"
The retention model to apply — every for N-Day retention (users who returned in that specific period), last for Unbounded retention (users who returned in that period or any later one), or first for First Occurrence retention (users whose first return fell in that period).
every, last, first Attributes to break the cohorts down by. Include up to 10.
10A second time range to compare against. Mutually exclusive with sending 2 or more segments. Pass an empty object for no comparison.
Response
Query registered. Poll status and fetch results with data.request_id.
Acknowledgement that a query was registered. Use data.request_id to poll status and fetch results.