Skip to main content
Version: 25.03

Drill - Read Users of a Query

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?method=segmentation_users

Overview​

Returns the user IDs (uid) of the users who match a Drill query for one event in the requested period.

Authentication​

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

Permissions​

Requires drill Read permission.

Request Parameters​

ParameterTypeRequiredDescription
methodStringYesMust be segmentation_users.
app_idStringYesTarget app ID.
eventStringYesEvent key to query.
queryObjectJSON String (Object)YesMongo-style Drill filter object. Use {} for no additional filters.
periodString or JSON String (Array)Yesmonth, day, yesterday, hour, prevMonth, <number>days (for example 30days), or a custom range as a JSON array.
bucketStringYeshourly, daily, weekly, or monthly.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Examples​

Read users who ran an event in the last 30 days​

/o?method=segmentation_users&
app_id=64f5c0d8f4f7ac0012ab3456&
api_key=YOUR_API_KEY&
event=[CLY]_session&
queryObject={}&
period=30days&
bucket=daily

Response​

Success Response​

An array of user IDs:

[
"a1b2c3d4",
"e5f6a7b8"
]

Response Fields​

FieldTypeDescription
(root)Arrayuid values of the matching users. Empty when no user matches.

Error Responses​

  • 400
{
"result": "Missing request parameter: event"
}
  • 400
{
"result": "Missing request parameter: queryObject"
}
  • 400
{
"result": "Bad request parameter: queryObject"
}
  • 400
{
"result": "Missing request parameter: period"
}
  • 400
{
"result": "Bad request parameter: period"
}
  • 400
{
"result": "Missing request parameter: bucket"
}
  • 400
{
"result": "Bad request parameter: bucket"
}

Behavior​

  • The queryObject filter is applied to the event data of the period.
  • If the query refers to cohorts, the result is limited to users who are in those cohorts.