Skip to main content
POST

Rate Limit

The rate limits are at the workspace level. A maximum of 5 requests per second, 20 requests per minute, and 350 requests per hour are allowed per workspace.

Authorizations

Authorization
string
header
required

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

application/json

Request body for registering a Behavior analysis query.

version
string
required

Payload schema version.

Example:

"2.0"

type
enum<string>
required

The analysis type. Must be behavior for this endpoint.

Available options:
behavior
analysis_type
enum<string>
required

The behavior metric to compute — for example, events (event counts), users (users who performed the event), or a per-user aggregation.

Available options:
events,
users,
session,
aggregation,
aggregation_distribution,
total_events_per_user,
attribute_aggregation_per_user
events
object[]
required

The events to analyze. Include 1 to 10 events. Each event has an id, one or more actions (event + attribute filters), an optional split_by, and an optional aggregation.

Required array length: 1 - 10 elements
segmentation
object[]
required

Segments used to scope the analysis to a subset of users. Include up to 5 segments. To analyze all users, pass a single segment with the All Users custom segment.

Maximum array length: 5
user_attr_grouped_by
object[]
required

User attributes to group the results by. Include up to 10; the combined total with all split_by entries must not exceed 10.

Maximum array length: 10
Example:
distribution
object
required

Custom distribution configuration. When using custom buckets, include at most 10 buckets. Pass an empty object for no custom distribution.

Example:
timerange
object
required

The time window the analysis runs over.

granularity
enum<string>
required

Time bucket for the series — h (hour), d (day), w (week), m (month), or e (entire range). When hourly, the time range must not exceed 31 days.

Available options:
h,
d,
w,
m,
e
Example:

"d"

chart_type
enum<string>
required

Visual representation of the result.

Available options:
line,
area,
bar,
column,
euler,
pie
Example:

"line"

comparison_timerange
object
required

A second time range to compare against. Time comparison is supported only on line, bar, and column charts, and cannot be combined with custom-segment comparison (2 or more segments). Pass an empty object for no comparison.

Example:
count_type
enum<string>

Whether metrics are returned as absolute counts (number) or as percentages (percentage).

Available options:
number,
percentage
Example:

"number"

chart_plot_type
enum<string>

Plot scale applied to the chart.

Available options:
linear,
logarithmic,
cumulative,
rolling_sum,
rolling_avg,
rolling_window
Example:

"linear"

rolling_value
integer

Rolling-window size for the metric, or -1 when not used.

Example:

-1

user_aggregation_type
string

The per-user aggregation to apply. Empty when not using an aggregation.

Example:

""

user_aggregation_percentile
integer

Percentile to compute when user_aggregation_type is a percentile aggregation. A value from 1 to 100, or -1 when not used.

Example:

-1

chart_sort_type
enum<string>

Sort order applied to the result series.

Available options:
ascending,
descending

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.

response_id
string

A unique identifier for the response, useful for correlating logs and support requests.

Example:

"fc803857-632e-4bf0-8df1-fbc2bdeedb66"

type
string

The analysis type echoed back for the registered query.

data
object