---
title: "Get historical message statistics"
method: GET
path: "/v1/projects/{project_id}/message_stats"
tags: ["Message"]
---

# Get historical message statistics

`GET /v1/projects/{project_id}/message_stats`

## Request

- Base URL: `https://api.telerivet.com`
- URL: `https://api.telerivet.com/v1/projects/{project_id}/message_stats`
- Auth: one of:
  - HTTP basic
  - OAuth 2 (authorization code, authorization URL `https://telerivet.com/oauth/authorize`, token URL `https://api.telerivet.com/oauth/token`)

Retrieves statistics about messages sent or received via Telerivet. This endpoint returns historical data that is computed shortly after midnight each day in the project's time zone. If the date range includes the current day, it will include statistics for the current day so far.

## Path parameters

- `project_id` string, required

## Query parameters

- `start_date` string, required
- `end_date` string, required
- `rollup` 'day' | 'week' | 'month' | 'year' | 'all'
- `properties` string[]
- `metrics` string, required
- `filters` object

## Response `200`

Successful response

- object
  - `intervals` object[]: List of objects representing each date interval containing at least one message matching the filters.
    - `start_time` integer: UNIX timestamp of the start of the interval
    - `end_time` integer: UNIX timestamp of the end of the interval, exclusive
    - `start_date` string: Date of the start of the interval in YYYY-MM-DD format
    - `end_date` string: Date of the end of the interval in YYYY-MM-DD format, inclusive
    - `groups` object[]: Array of groups for each combination of requested property values
      - `properties` object: Key/value pairs for each distinct value of the requested properties
      - `metrics` object: Key/value pairs for each requested metric

## Other responses

- `400`: Invalid request parameters
- `401`: Invalid or missing API key or Bearer token
- `404`: Resource not found

---

[API](https://skmtc.dev/telerivet/apis/telerivet-api.md) · [All operations](https://skmtc.dev/telerivet/apis/telerivet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/telerivet/apis/telerivet-api/revisions/4e14b1c8d917?raw)
