---
title: "Users counts"
description: "Count the unique users in a time period with the users_counts GraphQL function to track user growth."
---

# Users counts

> Count the unique users in a time period with the users_counts GraphQL function to track user growth.

## Overview

The `users_counts` function provides total unique user counts for a given time period. Use this endpoint to:

- Track unique user engagement
- Monitor user growth metrics
- Generate user count reports

## Quick start

```graphql
query UsersCounts(
  $accountId: uuid
  $deskIds: _uuid
  $brainIds: _uuid
  $integrationIds: _uuid
  $channels: _text
  $startDate: timestamp
  $endDate: timestamp
  $isTest: Boolean
  $minNumUserMessages: Int
) {
  rows: users_counts(
    args: {
      account_id: $accountId
      desk_ids: $deskIds
      brain_parent_ids: $brainIds
      integration_ids: $integrationIds
      channels: $channels
      start_time: $startDate
      end_time: $endDate
      is_test: $isTest
      min_num_user_messages: $minNumUserMessages
    }
  ) {
    counts
  }
}
```

**Variables:**

```json
{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "startDate": "2024-01-08",
  "endDate": "2024-01-17"
}
```

## Parameters

| Parameter            | Type        | Description                       |
| -------------------- | ----------- | --------------------------------- |
| `accountId`          | `uuid`      | Account identifier                |
| `deskIds`            | `_uuid`     | Filter by desk IDs                |
| `brainIds`           | `_uuid`     | Filter by AI agent IDs            |
| `integrationIds`     | `_uuid`     | Filter by integration IDs         |
| `channels`           | `_text`     | Filter by channels                |
| `startDate`          | `timestamp` | Start date (format: `yyyy-mm-dd`) |
| `endDate`            | `timestamp` | End date (format: `yyyy-mm-dd`)   |
| `isTest`             | `Boolean`   | Exclude test sessions             |
| `minNumUserMessages` | `Int`       | Minimum user messages in session  |

## Response fields

| Field    | Type  | Description             |
| -------- | ----- | ----------------------- |
| `counts` | `Int` | Total number of users   |

## Common use cases

## Try it

<GraphiQLPlayground
  query={`query UsersCounts(
  \$accountId: uuid
  \$deskIds: _uuid
  \$brainIds: _uuid
  \$integrationIds: _uuid
  \$channels: _text
  \$startDate: timestamp
  \$endDate: timestamp
  \$isTest: Boolean
  \$minNumUserMessages: Int
) {
  rows: users_counts(
    args: {
      account_id: \$accountId
      desk_ids: \$deskIds
      brain_parent_ids: \$brainIds
      integration_ids: \$integrationIds
      channels: \$channels
      start_time: \$startDate
      end_time: \$endDate
      is_test: \$isTest
      min_num_user_messages: \$minNumUserMessages
    }
  ) {
    counts
  }
}`}
  variables={`{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "startDate": "2024-01-08",
  "endDate": "2024-01-17"
}`}
  endpoint="https://logs.moveo.ai/v1/graphql"
/>

**Account total**

Get total user count for an account:

```json
{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "startDate": "2024-01-08",
  "endDate": "2024-01-17"
}
```

**Multiple AI agents**

Filter by multiple AI agents:

```json
{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "brainIds": "{a2wv9283-9b53-4d7b-b77d-2650f3a1a99c, 99xx33p9-dfab-44e5-9303-9b2bf13f1c94}",
  "startDate": "2024-01-08",
  "endDate": "2024-01-17"
}
```

**Specific channels**

Filter by specific channels:

```json
{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "channels": "{web, facebook}",
  "startDate": "2024-01-08",
  "endDate": "2024-01-17"
}
```

**Engaged users**

Users with at least 3 messages:

```json
{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "minNumUserMessages": 3,
  "startDate": "2024-01-08",
  "endDate": "2024-01-17"
}
```

## Example response

```json
{
  "data": {
    "rows": [
      {
        "counts": 8500
      }
    ]
  }
}
```
