Skip to main content

Compliance Hub - Consent Search

Endpoint

/o/consent/search

Overview

Searches consent event history with filtering, sorting, and pagination. Supports MongoDB and ClickHouse adapters.

Authentication

Countly API supports three authentication methods:

  1. API key query parameter: api_key=YOUR_API_KEY
  2. Auth token query parameter: auth_token=YOUR_AUTH_TOKEN
  3. Auth token header: countly-token: YOUR_AUTH_TOKEN

Permissions

Requires compliance_hub Read permission.

Request Parameters

ParameterTypeRequiredDescription
app_idStringYesTarget app ID.
sSearchStringNoText search used against device ID.
filter / queryJSON String (Object)NoJSON-stringified filter object.
project / projectionJSON String (Object)NoProjection object for returned fields.
sortJSON String (Object)NoExplicit sort object.
iSortCol_0NumberNoDataTables sort column index.
sSortDir_0StringNoDataTables sort direction (asc/desc).
limit / iDisplayLengthNumberNoPage size (default 20).
skip / iDisplayStartNumberNoOffset (MongoDB mode).
cursorStringNoCursor token (ClickHouse mode).
paginationModeStringNoClickHouse pagination mode, defaults to snapshot.
periodStringNoOptional period filter.
db_overrideStringNoAdapter override (clickhouse uses ClickHouse path; other values use MongoDB path).
comparisonStringNoComparison mode forwarded to query execution layer.
sEchoString or NumberNoEcho value returned in DataTables-style response.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Response

Success Response

MongoDB path:

{
"sEcho": "1",
"iTotalRecords": 150,
"iTotalDisplayRecords": 40,
"aaData": [
{
"device_id": "device_123",
"uid": "user_1",
"type": "sessions",
"change": {
"sessions": true
},
"ts": 1739788800000
}
]
}

ClickHouse path (db_override=clickhouse):

{
"sEcho": "1",
"iTotalRecords": 150,
"iTotalDisplayRecords": 150,
"aaData": [
{
"device_id": "device_123",
"uid": "user_1",
"type": "sessions",
"change": {
"sessions": true
},
"ts": 1739788800000
}
],
"hasNextPage": true,
"nextCursor": "eyJ0cyI6MTczOTc4ODgwMDAwMCwiZGlkIjoiZGV2aWNlXzEyMyJ9",
"paginationMode": "snapshot",
"isApproximate": false
}

Response Fields

FieldTypeDescription
sEchoString or NumberEcho value from request.
iTotalRecordsNumberTotal records matched for base query.
iTotalDisplayRecordsNumberDisplay-count value (filteredTotal for MongoDB; total for ClickHouse).
aaDataArrayConsent event rows transformed to compatibility shape.
hasNextPageBooleanPresent in ClickHouse mode when more rows are available.
nextCursorStringNext cursor token for ClickHouse pagination.
paginationModeStringClickHouse pagination mode used.
isApproximateBooleanApproximation indicator from ClickHouse query engine.

Error Responses

  • 400
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
  • 400
{
"result": "Missing parameter \"app_id\""
}
  • 401
{
"result": "User does not have right"
}
  • 400
{
"result": "Error. Please check logs."
}

Behavior/Processing

Behavior Modes

ModeTriggerProcessing PathResponse Shape
MongoDB modedb_override absent/unsupportedQueries consent history from drill-events MongoDB path with skip/limit pagination.Raw DataTables-style object
ClickHouse modedb_override=clickhouseUses ClickHouse query adapter with cursor/snapshot pagination support.Raw DataTables-style object with optional cursor fields

Impact on Other Data

  • Read-only endpoint.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuthentication and permission checksReads member account and feature access for read validation.
countly.appsApp validation/context loadingValidates app_id and app context for search scope.
countly_drill.drill_eventsPrimary consent-event history sourceReads [CLY]_consent event rows for MongoDB adapter.
ClickHouse consent events tableConsent-event history source (ClickHouse adapter)Reads consent events via ClickHouse query adapter when enabled.

Examples

Search consents with MongoDB pagination

/o/consent/search?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
sSearch=device_123&
limit=20&
skip=0

Search consents with ClickHouse cursor

/o/consent/search?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
db_override=clickhouse&
limit=50&
paginationMode=snapshot

Last Updated

2026-02-17