---
title: "Meaningful sessions by hour range"
description: "Count the meaningful sessions per hour in a time range with the get_meaningful_sessions_count_by_hour_range GraphQL function."
---

# Meaningful sessions by hour range

> Count the meaningful sessions per hour in a time range with the get_meaningful_sessions_count_by_hour_range GraphQL function.

## Overview

The `get_meaningful_sessions_count_by_hour_range` function provides meaningful session counts per hour within a time range. Each session is counted in the hour when it first became meaningful. Use this endpoint to:

- Analyze sessions during business hours vs off-hours
- Compare morning vs afternoon engagement
- Track sessions during specific operational windows

## Quick start

```graphql
query GetMeaningfulSessionsCountByHourRange(
  $accountId: uuid!
  $startDate: timestamp
  $endDate: timestamp
) {
  rows: get_meaningful_sessions_count_by_hour_range(
    args: {
      account_id: $accountId
      start_time: $startDate
      end_time: $endDate
    }
  ) {
    hour
    sessions
  }
}
```

**Variables:**

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

## Parameters

| Parameter   | Type        | Description                                                        |
| ----------- | ----------- | ------------------------------------------------------------------ |
| `accountId` | `uuid!`     | Account identifier (required)                                      |
| `startDate` | `timestamp` | Start of the range (format: `yyyy-mm-dd` or `yyyy-mm-ddThh:mm:ss`) |
| `endDate`   | `timestamp` | End of the range, not included (same format as `startDate`)        |

## Response fields

| Field      | Type        | Description                                                  |
| ---------- | ----------- | ------------------------------------------------------------ |
| `hour`     | `timestamp` | Start of the hour                                            |
| `sessions` | `bigint`    | Number of sessions that first became meaningful in that hour |

## Common use cases

## Try it

<GraphiQLPlayground
  query={`query GetMeaningfulSessionsCountByHourRange(
  \$accountId: uuid!
  \$startDate: timestamp
  \$endDate: timestamp
) {
  rows: get_meaningful_sessions_count_by_hour_range(
    args: {
      account_id: \$accountId
      start_time: \$startDate
      end_time: \$endDate
    }
  ) {
    hour
    sessions
  }
}`}
  variables={`{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "startDate": "2024-01-08T09:00:00",
  "endDate": "2024-01-08T17:00:00"
}`}
  endpoint="https://logs.moveo.ai/v1/graphql"
/>

**Business hours**

Get sessions during business hours (9 AM - 5 PM):

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

**Off-hours**

Get sessions during off-hours (6 PM - 8 AM):

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

**Morning hours**

Get sessions during morning hours (6 AM - 12 PM):

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

## Example response

```json
{
  "data": {
    "rows": [
      {
        "hour": "2024-01-08T09:00:00",
        "sessions": 142
      },
      {
        "hour": "2024-01-08T10:00:00",
        "sessions": 187
      }
    ]
  }
}
```
