Skip to main content

User Profiles - List or Profile

Endpoint

/o?method=user_details

Enterprise Only
This API is available exclusively in Countly Enterprise.

Overview

Returns either a paginated users list, a single user profile (when uid or did is provided), or a user-property breakdown when projectionKey is provided.

Authentication

Authentication methods:

  • 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

  • User Profiles: Read permission.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApp ID
methodStringYesMust be user_details
uidStringNoUser ID for single-profile response
didStringNoDevice ID alternative to uid
queryString (JSON Object)NoDrill-style user filter for list mode. The endpoint runs Drill query preprocessing before reading users, so query-builder field names such as up.cc, up.p, up.av, chr, and custom user-property filters can be used.
projectionKeyString (JSON Array)NoUser breakdown field list. The server parses the first item only and groups users by that field, for example ["cc"], ["p"], or ["custom.plan"].
filterStringNoBuilt-in profile type filter. user-known returns users with profile info, user-anonymous returns users without profile info, and user-all disables this filter.
profile_groupStringNoCohort/profile group id; adds a chr.<profile_group>.in=true filter.
visibleColumnsString (JSON Array)NoAdditional fields to include in list rows. chr-group is mapped from the stored chr field.
fetchOnlyVisibleColumnsBoolean StringNoIf set, starts from a minimal projection and adds only requested visible columns.
iSortCol_0NumberNoSort column index
sSortDir_0StringNoSort direction (asc, desc)
iDisplayStartNumberNoPagination offset
iDisplayLengthNumberNoPagination page size
sSearchStringNoText search in indexed fields
exportToFileBoolean StringNoStreams matching users as an export file instead of returning JSON.
typeStringNoExport type used with exportToFile; json applies JSON line transformation.
filenameStringNoExport filename used with exportToFile.
report_nameStringNoLong-task/report name override for list or breakdown tasks.
report_descStringNoLong-task/report description.
period_descStringNoLong-task period label. Defaults to User Data.
autoRefreshBoolean StringNoLong-task auto-refresh flag.
forceBoolean StringNoForces long-task execution instead of reusing a matching running task.
r_hourNumberNoAuto-refresh hour for a long task. Defaults to 2.
linked_toStringNoOptional long-task link target.

Configuration Impact

SettingDefaultAffectsUser-visible impact
users.show_notes_in_listtrueList projection fieldsAdds/removes note field in aaData list rows

Response

List Response

{
"sEcho": "1",
"iTotalRecords": 245,
"iTotalDisplayRecords": 50,
"aaData": [
{
"_id": "d8f4d8f91ac1f1f5a8e6f0d9d3f4c0a71b2e3d4f",
"uid": "u_102",
"name": "Jane Doe",
"sc": 42,
"ls": 1739557500,
"cc": "US"
}
]
}

Single Profile Response

When uid or did is provided, the endpoint returns a profile document instead of a DataTables list.

{
"_id": "d8f4d8f91ac1f1f5a8e6f0d9d3f4c0a71b2e3d4f",
"uid": "u_102",
"did": "device-102",
"name": "Jane Doe",
"email": "jane@example.com",
"cc": "US",
"p": "iOS",
"sc": 42,
"ls": 1739557500,
"picture": "https://www.gravatar.com/avatar/..."
}

Breakdown Response

When projectionKey is provided in list mode, the endpoint groups matching users by the first projection key.

{
"sEcho": "1",
"breakDownData": [
{
"_id": "US",
"sum": 120
},
{
"_id": "DE",
"sum": 48
}
],
"projectionKey": "cc",
"total": 245
}

Long Task Response

For expensive list or breakdown requests, the task manager may return a task id instead of the final result.

{
"task_id": "67bd31c92e7f0b0012ab4567"
}

Response Fields

FieldTypeDescription
sEchoStringEcho value for table requests
iTotalRecordsNumberTotal users count
iTotalDisplayRecordsNumberFiltered users count
aaDataArrayUser row objects
aaData[].uidStringUser ID, when known.
aaData[].didStringDevice ID.
aaData[].nameStringDisplay name. Falls back to did or an empty string.
aaData[].ccStringCountry code.
aaData[].pStringPlatform.
aaData[].scNumberSession count.
aaData[].lsNumberLast seen timestamp.
breakDownDataArrayBreakdown rows returned when projectionKey is provided.
breakDownData[]._idAnyGroup value for the selected projection key.
breakDownData[].sumNumberNumber of matching users in this group.
projectionKeyStringFirst item parsed from the projectionKey array.
totalNumberEstimated total users in the app, used in breakdown mode.
task_idStringLong-task id returned when the request continues asynchronously.

Error Responses

  • HTTP 400 - Invalid request params (example):
{
"result": "Error. Please check logs."
}
  • HTTP 401 - Invalid auth:
{
"result": "User does not exist"
}

Behavior/Processing

  • Without uid/did, returns list mode with filtering, sorting, and pagination.
  • With uid/did, returns one user profile object.
  • Parses query as JSON. Invalid JSON is logged and treated as an empty filter.
  • Dispatches Drill query preprocessing for query, which lets query-builder user-property filters be translated before reading app_users{appId}.
  • Applies sSearch as a text search and filter as a built-in known/anonymous profile filter.
  • Parses projectionKey as a JSON array and uses only the first item for breakdown grouping.
  • For breakdown mode, aggregates matching users by projectionKey and returns breakDownData, projectionKey, and total.
  • For normal list mode, default projected fields include identity, location, device/platform, session counters, email, picture, and events; visibleColumns can add fields.
  • If users.show_notes_in_list is enabled, list rows include note.
  • Expensive list or breakdown requests can return { "task_id": "..." } while the task manager continues processing.

Database Collections

CollectionUsed forData touched by this endpoint
countly.app_users{appId}Per-app user profilesStores user-level properties and profile fields affected by this endpoint.

Examples

/o?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&method=user_details&iDisplayStart=0&iDisplayLength=20
/o?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&method=user_details&uid=u_102

Filter users with a Drill-style user query

/o?api_key=YOUR_API_KEY&
app_id=YOUR_APP_ID&
method=user_details&
query={"up.cc":{"$in":["US","CA"]},"up.p":{"$in":["iOS"]}}&
iDisplayStart=0&
iDisplayLength=20

Return a user-property breakdown

/o?api_key=YOUR_API_KEY&
app_id=YOUR_APP_ID&
method=user_details&
query={"up.cc":{"$in":["US","CA"]}}&
projectionKey=["cc"]

Include extra visible columns

/o?api_key=YOUR_API_KEY&
app_id=YOUR_APP_ID&
method=user_details&
visibleColumns=["email","custom.plan","chr-group"]&
iDisplayStart=0&
iDisplayLength=50

Ⓔ Enterprise

This feature is part of Countly Enterprise.

Get Access:

Already a Customer? Use support portal if you have any questions.


Last Updated

2026-04-17