Skip to main content

Compliance Hub - Consent Search Old

Endpoint

/o/consent/searchOld

Overview

Legacy backup endpoint that searches old consent history documents from consent_history.

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.
sSearchStringNoDevice ID regex text filter.
query / filterJSON String (Object)NoJSON-stringified filter object.
project / projectionJSON String (Object)NoProjection object.
sortJSON String (Object)NoExplicit sort object.
iSortCol_0NumberNoDataTables sort column index.
sSortDir_0StringNoDataTables sort direction (asc/desc).
periodStringNoPeriod filter translated to timestamp range on ts.
limit / iDisplayLengthNumberNoPage size.
skip / iDisplayStartNumberNoOffset.
sEchoString or NumberNoEcho value returned in response.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Response

Success Response

{
"sEcho": "1",
"iTotalRecords": 50,
"iTotalDisplayRecords": 12,
"aaData": [
{
"device_id": "device_123",
"uid": "user_1",
"type": "sessions",
"after": {
"sessions": true
},
"ts": 1739788800000,
"app_id": "6991c75b024cb89cdc04efd2"
}
]
}

Empty dataset response:

{
"sEcho": "1",
"iTotalRecords": 0,
"iTotalDisplayRecords": 0,
"aaData": []
}

Response Fields

FieldTypeDescription
sEchoString or NumberEcho value from request.
iTotalRecordsNumberTotal matched records for app-level query.
iTotalDisplayRecordsNumberTotal matched records after applied filters.
aaDataArrayConsent history records.

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": "MongoDB query error"
}

Behavior/Processing

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Legacy history searchMatching documents exist in consent_historyApplies query/search/sort/pagination and returns DataTables-style payload.Raw DataTables-style object
Empty historyNo documents for queryReturns empty DataTables-style payload.Raw object with zero totals and empty aaData

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.consent_historyLegacy consent history sourceReads old consent history documents by app/query filters.

Examples

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

Limitations

  • Legacy backup endpoint for old consent-history data path.
  • Uses legacy collection shape (after field) instead of transformed modern consent-event output.

Last Updated

2026-02-17