Skip to main content

Compliance Hub - Consents Read

Endpoint​

/o?method=consents

Overview​

Returns consent metric time-series for the selected app and period.

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
methodStringYesMust be consents.
app_idStringConditionalRequired for non-global-admin users during read validation.
periodStringNoStandard Countly period value.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Examples​

/o?
method=consents&
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
period=30days

Response​

Success Response​

{
"2026": {
"2": {
"17": {
"0": {
"p": 12,
"e": 3
},
"1": {
"p": 9,
"e": 1
}
}
}
}
}

Response Fields​

FieldTypeDescription
(root object)ObjectTime-bucketed consent metric object for requested period.

Error Responses​

  • 400
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
  • 401
{
"result": "No app_id provided"
}
  • 401
{
"result": "User does not have right"
}

Behavior​

Behavior Modes​

ModeTriggerProcessing PathResponse Shape
Consent metrics readmethod=consentsValidates read rights and fetches consent time object via common fetch pipeline.Raw metrics object

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 timezone context when app-scoped validation applies.
countly.consentsConsent metric sourceReads consent metric documents by app/time period.