Skip to main content
Version: 25.03

Compliance Hub - Consent Search

Endpoint​

/o/consent/search

Overview​

Searches consent event history (countly.consent_history) with filtering, sorting, and skip/limit pagination.

Authentication​

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

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. If omitted or 0, no limit is applied.
skip / iDisplayStartNumberNoOffset.
periodStringNoOptional period filter applied to ts.
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.

Examples​

Search consents with pagination​

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

Response​

Success Response​

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

Response Fields​

FieldTypeDescription
sEchoString or NumberEcho value from request.
iTotalRecordsNumberTotal records for the app matching query/filter.
iTotalDisplayRecordsNumberRecords matching the full search (including sSearch and period).
aaDataArrayConsent history documents for the requested page.

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​

Behavior Modes​

ModeTriggerProcessing PathResponse Shape
Results modeAt least one record matches the app and query/filterQueries countly.consent_history with sort and skip/limit pagination.Raw DataTables-style object
Empty modeNo records match the app and query/filterReturns immediately without running the paged query.Raw DataTables-style object with empty aaData

Impact on Other Data​

  • Read-only endpoint.
Implementation details

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.consent_historyConsent-event history sourceCounts and reads consent history documents for the app.