Skip to main content

/o/tasks/count

Endpoint

/o/tasks/count

Overview

Returns grouped task counts for tasks visible to current user.

Authentication

  • 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

  • Requires read access to feature core.
  • app_id is required for non-global users by read validation rules.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)Dashboard API authentication key.
auth_tokenStringYes (or use api_key)Dashboard auth token.
app_idStringYes (for non-global users)App context for read permission validation.
queryJSON String (Object) or ObjectNoAdditional task filter object.
periodStringNoTime range filter converted to task ts query.

Parameter Semantics

  • Visibility filter is always enforced: global tasks or tasks created by current member.
  • query parsing failures fall back to {}.
  • Unlike /o/tasks/all and /o/tasks/list, this endpoint does not add a subtask exclusion filter by default.

Response

Success Response

[
{
"_id": "6991c75b024cb89cdc04efd2",
"c": 14
},
{
"_id": "6991c75b024cb89cdc04efaa",
"c": 3
}
]

Response Fields

FieldTypeDescription
[]ArrayCount rows grouped by app_id.
[] ._idStringApp ID grouping key.
[] .cNumberTask count for that app group.

Error Responses

Status Code: 400 Bad Request

{"result":"Missing parameter \"api_key\" or \"auth_token\""}

Behavior/Processing

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Default count modeDefault call with or without queryApplies visibility filter (global or creator-owned), aggregates counts grouped by app_id.Raw array of { _id, c } rows
Period modeperiod is providedAdds ts range filter before count aggregation.Raw array of { _id, c } rows
Subtask-included modequery does not explicitly filter subtaskSubtasks can be included in group counts.Raw array of { _id, c } rows

Impact on Other Data

  • Read-only endpoint.

Audit & System Logs

  • No /systemlogs action is emitted by this endpoint.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuthentication and visibility scopingReads caller identity used by read validation and creator visibility filtering.
countly.long_tasksTask count sourceAggregates visible tasks grouped by app ID.

Examples

Example 1: Count visible tasks

/o/tasks/count?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2

Example 2: Count tasks for last 30 days

/o/tasks/count?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
period=30days

Limitations

  • Counts may include subtasks unless caller explicitly filters them out in query.

Last Updated

2026-02-17