---
title: "chat.stats-request@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/chat.stats-request"
updated: null
---

# chat.stats-request@1 · OpenVibe.Services

HTML: [chat.stats-request@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/chat.stats-request)

# ChatStatsRequest `chat.stats-request@1`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.0).

- Version: 1.0.0
- Owner: chat
- Visibility: first-party
- Status: active
- Compatibility: backward
- Schema: [`https://openvibe.network/contracts/chat/stats-request.v1.json`](/docs/contracts/chat.stats-request.json)

chat.stats-request@1: the body of POST /internal/chat/stats on OpenVibe.Chat (capability chat.stats.read): one count over chat\_messages, for the stats OpenVibe.Live shows without reading its own copy of Chat's tables (home and SEO stats, admin dashboard, star of the day, VOD and recap cards, stream analytics, top chatters, AI slogans). kind site counts all of chat; user one person's messages (user\_id); stream one stream's messages, chatters and soundboard plays (stream\_id); channel-top the top chatters, of one stream (stream\_id) or one channel (channel\_user\_id), or of all chat when neither is given; site-daily one row per UTC day in \[since, until), zero-filled, a kind that takes only since and until. since and until bound chat\_messages.timestamp, epoch ms, until exclusive. Deleted messages are never counted. Loopback only, service token.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `kind` | enum | yes |  | - `one of "site", "user", "stream", "channel-top", "site-daily"` |
| `user_id` | integer |  | Live user id; required for kind user. | - `minimum 1` |
| `stream_id` | integer |  | Live stream id; required for kind stream. | - `minimum 1` |
| `channel_user_id` | integer |  | The broadcaster whose channel room it is (chat\_messages.channel\_user\_id). | - `minimum 1` |
| `since` | integer |  | Count messages at or after this instant (epoch ms). | - `minimum 0` |
| `until` | integer |  | Count messages before this instant (epoch ms). | - `minimum 0` |
| `limit` | integer |  | How many top chatters (channel-top); Chat's default is 10. | - `minimum 1`<br>- `maximum 50` |

## Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

 Valid: channel-top

~~~~
{
  "kind": "channel-top",
  "channel_user_id": 77,
  "since": 1758326400000,
  "limit": 20
}
~~~~

Valid: site-daily

~~~~
{
  "kind": "site-daily",
  "since": 1759449600000,
  "until": 1759622400000
}
~~~~

Valid: site-since

~~~~
{
  "kind": "site",
  "since": 1759536000000
}
~~~~

Valid: stream

~~~~
{
  "kind": "stream",
  "stream_id": 4211
}
~~~~

Rejected: limit-too-high

~~~~
{
  "kind": "channel-top",
  "stream_id": 4211,
  "limit": 51
}
~~~~

Rejected: site-daily-without-until

~~~~
{
  "kind": "site-daily",
  "since": 1759449600000
}
~~~~

Rejected: unknown-kind

~~~~
{
  "kind": "global"
}
~~~~

Rejected: user-without-id

~~~~
{
  "kind": "user",
  "since": 1759536000000
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('chat.stats-request@1', value);   // { valid, errors: [{ path, message }] }
~~~~
