---
docId: doc_4a558bd4311e4ef6996f2b2026e97dd1
title: Count conversations
description: Get exact counts of conversations, filtered and broken down by operation, status, agent or channel.
version: v2
versionGroup: conversations-counts
api:
  group: conversaciones
  auth: bearer
  operations:
    - operationId: countConversationsV2
      method: GET
      path: /v2/conversations/counts
      postmanName: Count Conversations
---

<script>
  import { Ways, Note } from '$lib/components';
</script>

# Count conversations

Get exact counts of the conversations the credential may read, with the same filters as [List conversations](/api-reference/conversations/list) plus `assigneeId` and `kind`. Break them down by `operation` (default), `status`, `agent` or `channel`.

Counts have **no date window**: every matching conversation counts, however old.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl "https://api.platic.ai/v2/conversations/counts?channelId=wb-123&groupBy=operation,status" \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
const { data } = await platic.conversations.counts({
  channelId: "wb-123",
  groupBy: ["operation", "status"],
});
console.log(data.total, data.byOperation?.supervised, data.byStatus?.active);
```

</Ways.Way>
</Ways>

## Query parameters

All parameters are optional. List parameters take comma-separated values or the parameter repeated.

| Parameter | Type | Description |
|-----------|------|-------------|
| `contactId` | string | Only conversations of this contact |
| `channelId` | string | Only conversations on this channel |
| `agentId` | string | Only conversations whose main agent is this one |
| `platform` | string | Only conversations on this platform: `whatsapp`, `instagram`, `facebook`, `email`, `webchat`… |
| `status` | string | Only these visible states: `initiated`, `active`, `finished`, `archived`, `spam` |
| `operation` | string | Only these operations: `automatic`, `supervised`, `assistance` |
| `tags` | string | Tag names, up to 10. A conversation counts when it has **any** of them |
| `assigneeId` | string | Only conversations assigned to this team member (member ID or email) or to `team` |
| `kind` | string | `chat` (default): conversations. `post`: comment posts. `all`: both |
| `groupBy` | string | Breakdowns to return: `operation`, `status`, `agent`, `channel`. Up to all four. Default: `operation` |
| `workspace` | string | The workspace to read, for an API key that covers several. Other credentials always read their own workspace |

## Response

```json
{
  "status": "success",
  "data": {
    "total": 1234,
    "totalRelation": "exact",
    "byOperation": { "automatic": 900, "supervised": 300, "assistance": 34 },
    "byStatus": { "active": 400, "archived": 700, "finished": 134 }
  },
  "meta": { "requestId": "req_7f3b" }
}
```

| Field | Description |
|-------|-------------|
| `total` | Conversations that match the filters and that the credential may read |
| `totalRelation` | Always `exact` |
| `byOperation` | Count per operation (`automatic`, `supervised`, `assistance`). Only with `groupBy=operation` |
| `byStatus` | Count per visible state (`initiated`, `active`, `finished`, `archived`, `spam`). Only with `groupBy=status` |
| `byAgent` | Count per main agent ID. Only with `groupBy=agent` |
| `byChannel` | Count per channel ID. Only with `groupBy=channel` |
| `meta.requestId` | ID of the request, for support |

Only the breakdowns you ask for are returned. `status` and `operation` are explained in [Status and operation](/api-reference/conversations#status-and-operation).

<Note type="tip">

Use counts for totals, not the results of a search. A search works on a window of candidates (see `totalRelation` in [Search conversations](/api-reference/conversations/search#response)); counts are exact.

</Note>

## Who sees what

Counts follow the same reach as the list. An OAuth connection acts as the person who authorized it: if their role only reaches assigned conversations, `total` and every breakdown count only conversations assigned to them or to `team`.

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | A query parameter is invalid, for example an unknown `groupBy` value or more than 10 tags. `details.issues` says which |
| `400` | `INVALID_REQUEST` | The workspace in `?workspace=` is not covered by the credential. `details.available` lists the ones it covers |
| `400` | `INVALID_FILTER` | A filter has a value that cannot be applied |
| `401` | `UNAUTHENTICATED` | The credential is missing or invalid |
| `403` | `FORBIDDEN` | The credential has no access to conversations in this workspace |
| `503` | `SEARCH_UNAVAILABLE` | Counting is temporarily unavailable. `details.retryable` is `true`. Try again |

The general error format is in [Errors](/api-reference/errors).
