# Callback inbox counts

`GET https://api.morevoice.ai/v1/callbacks/counts`

The numbers on the callbacks inbox's badges and tabs: open, due, mine, queue, breached, voicemails, and the missed calls. With `agent_id`, as that agent's inbox counts them (their queues and their own); without it, for the whole organization. Test keys get zeros (callbacks are live).

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `callbacks_counts`.

## Parameters

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `agent_id` | `string` | no | Count as this agent sees the inbox (their badge): `mine`, `voicemails` and `missed_mine` are theirs. Default: the whole organization. |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |

## Responses

### 200 OK

OK Returns `CallbackCounts`.

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"callback_counts"` | — |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `agent_id` | `string \| null` | Whose counts these are; null: the whole organization. |
| `open` | `integer` | Open callbacks. |
| `due` | `integer` | Open callbacks whose time has come. |
| `mine` | `integer \| null` | Open callbacks assigned to or claimed by the agent; null without `agent_id`. |
| `queue` | `integer` | Open queue callbacks nobody has claimed. |
| `breached` | `integer` | Open callbacks past their SLA target. |
| `voicemails` | `integer \| null` | Open voicemail callbacks of the agent; null without `agent_id`. |
| `missed` | `integer` | The badge's missed calls: an agent's own and the unclaimed ones when missed calls are work items, else every open one. |
| `missed_open` | `integer \| null` | Open missed-call items (null when missed calls are not work items). |
| `missed_mine` | `integer \| null` | Open missed-call items assigned to the agent (null without `agent_id`, or when missed calls are not work items). |
| `missed_queue` | `integer \| null` | Open missed-call items nobody holds (null when missed calls are not work items). |

Example:

```json
{
  "agent_id": "usr_4Gk2LmN9pQ4rS6tV8wX0yZ",
  "breached": 1,
  "due": 3,
  "livemode": true,
  "mine": 2,
  "missed": 5,
  "missed_mine": 1,
  "missed_open": 6,
  "missed_queue": 4,
  "object": "callback_counts",
  "open": 7,
  "queue": 4,
  "voicemails": 1
}
```

### 400 Bad Request

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown. Returns `ErrorEnvelope`.

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

The key may not do this (a missing scope, a plan limit, or a compliance block). Returns `ErrorEnvelope`.

### 404 Not Found

No object with this ID (in the path or the body) exists in this organisation and mode. Returns `ErrorEnvelope`.

### 429 Too Many Requests

Too many requests, or no call capacity right now. Retry after the Retry-After delay. Returns `ErrorEnvelope`.

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const callbackCounts = await mv.callbacks.counts();
console.log(callbackCounts);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

callback_counts = client.callbacks.counts()
print(callback_counts)
```

**cURL**

```sh
curl https://api.morevoice.ai/v1/callbacks/counts \
  -H "Authorization: Bearer $MOREVOICE_API_KEY"
```
