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.
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). You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
- Password: Use your Data API Key, which you can find in the MoEngage dashboard at Settings > Account > APIs.
For more information, see Authentication.
Body
Request body for registering a Retention analysis query.
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 elementsThe time window the analysis runs over.
How return events are counted — every (return in every period), first (first return only), or last (last return only).
every, first, last Payload schema version.
"2.0"
Segments 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.
5Cohort period — h (hourly, window up to 24 hours), d (daily, up to 90 days), or w (weekly, up to 180 days).
h, d, w "d"
Visual representation of the result, such as line.
"line"
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.