---
title: "List top contacts by message volume"
method: GET
path: "/v1/analytics/top-contacts"
tags: ["Analytics"]
---

# List top contacts by message volume

`GET /v1/analytics/top-contacts`

## Request

- Base URL: `https://api.samva.dev`
- URL: `https://api.samva.dev/v1/analytics/top-contacts`
- Auth: API key in header `x-api-key`

Returns the contacts your organization exchanged the most messages with over the selected date range. `sortBy` chooses the traffic `messageCount` reports and ranks by: `sent` counts outbound messages addressed to the contact, `received` counts inbound messages the contact sent you, and `total` (the default) counts both. Contacts with no traffic in the range are omitted, and at most 100 are returned.

## Query parameters

- `after` string, nullable
- `before` string, nullable
- `limit` string, nullable
- `sortBy` 'sent' | 'received' | 'total', nullable

## Response `200`

Success

- object[]
  - `id` string, required
  - `name` string, nullable, required
  - `email` string, nullable, required
  - `phone` string, nullable, required
  - `messageCount` integer, required

## Other responses

- `400`: AnalyticsQueryError
- `401`: UnauthorizedError
- `403`: ForbiddenError
- `422`: ValidationError
- `500`: InternalError
- `504`: GatewayTimeoutError

---

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