# Status

Your backend reads where the workspace stands, to show it to the business's
owner next to its own numbers: the WhatsApp number the agent answers on, and
the agent's health. Both are counts, times and states: no conversation's words,
no contact.

```http
GET /api/server/v1/:slug/whatsapp
GET /api/server/v1/:slug/health
Authorization: Bearer vsk_…
```

Both take a secret key with the `status` scope. A key made with the inbox's
**New key** form has it; a key created before 2026-11-02, or with a narrower
list, does not, and gets `403 insufficient_scope`. Scopes are fixed when a key
is created, so create a new one in the inbox under **Settings → API keys**
([Secret keys and scopes](https://vatio.ai/docs/api/#scopes)). A backend that also keeps the team
needs a key the owner created with the `team` scope ticked, which has
`status` too.

## The WhatsApp number

`GET /api/server/v1/:slug/whatsapp` answers what the MCP's `get_whatsapp`
says:

```json
{
  "data": {
    "connected": true,
    "number": "+15550108455",
    "display_number": "+1 555-010-8455",
    "wa_me_url": "https://wa.me/15550108455",
    "live": true,
    "state": "live",
    "issue": null,
    "last_health_check_at": "2026-11-02T12:00:00Z",
    "connect_url": "https://inbox.vatio.ai/acme/whatsapp"
  }
}
```

| Field | Meaning |
|---|---|
| `connected` | Whether the workspace has its own number. Without one, only `connected: false` and `connect_url` come back. |
| `number` | The number in E.164, the one people write to. The agent cannot message it: leave it out of any list of people to notify. |
| `display_number` | The number as Meta writes it. |
| `wa_me_url` | The `wa.me` link that opens a chat with the agent, for a button or a QR code. |
| `live` | `true` while the agent answers everyone who writes; `false` when it is paused (the MCP's `update_whatsapp` with `live: false`, or **Live** off in the inbox). |
| `state` | The connection as the inbox's **WhatsApp** page shows it: `live` (answering), `paused`, `error` (see `issue`), `not_receiving` (Meta is not delivering its messages to Vatio; **Verify** in the inbox repairs it), or a step of connecting. |
| `issue` | `null`, or why Meta refuses every send from the number: `{ since, code, kind, message, fix }`, the same as the [`channel.issue`](https://vatio.ai/docs/api/webhooks#channel-issues) webhook. Sending is refused with `409 whatsapp_number_unhealthy` until it closes. |
| `connect_url` | Where the owner connects the number, or renews it, in the inbox. Meta's consent opens only in a browser, so connecting is never an API call. |

A number is connected only from the inbox: a fresh workspace answers
`connected: false` until someone opens `connect_url` and goes through Meta's
signup ([WhatsApp](https://vatio.ai/docs/channels/whatsapp)). To hear when that changes rather than
read it, subscribe to [`channel.connected`, `channel.disconnected`,
`channel.issue` and `channel.recovered`](https://vatio.ai/docs/api/webhooks#events).

## The agent's health

`GET /api/server/v1/:slug/health?days=30` takes `days` as 7, 30 (the default)
or 90. It counts your customers' conversations only (`live`), never your
team's tests, by the same rules as the inbox's **Analytics** page, and days in
the app's time zone.

```json
{
  "data": {
    "generated_at": "2026-11-02T12:00:00-03:00",
    "days": 30,
    "agent": {
      "live_version": 412,
      "published_at": "2026-10-31T18:20:00-03:00",
      "shipping": { "state": "live", "newest_version": 412, "changed_at": null },
      "tests": {
        "cases": 14,
        "passing": true,
        "run": { "version": "a1b2c3d", "started_at": "…", "finished": true, "cases": 14, "passed": 14, "failed": 0 }
      }
    },
    "whatsapp": { "connected": true, "number": "+15550108455", "…": "…" },
    "conversations": {
      "last_started_at": "2026-11-02T11:48:00-03:00",
      "last_message_at": "2026-11-02T11:52:10-03:00",
      "total": 318,
      "previous_total": 290,
      "asked_team": 12,
      "answered_by_team": 11,
      "team_replies": 27
    },
    "failed_messages": { "total": 3, "outreaches": 2, "whatsapp_deliveries": 1 },
    "series": [
      { "date": "2026-10-04", "conversations": 9, "asked_team": 0, "team_replies": 1 }
    ]
  }
}
```

| Field | Meaning |
|---|---|
| `agent.live_version` | The version everyone talks to (`null` before the first). |
| `agent.shipping.state` | `live` when everyone has the newest change, `testing` while the tests run on it, `held` when one that passes today failed on it and kept it back ([Deployments](https://vatio.ai/docs/deployments)). |
| `agent.tests.passing` | Whether the newest run of the tests on the live version passed every case: `true`, `false`, or `null` when none has finished on it (or there are no tests). `run` is that run's totals. |
| `conversations.last_started_at`, `last_message_at` | When the newest conversation started, and the newest message in any. |
| `conversations.total`, `previous_total` | Conversations started in the window, and in the window before it. |
| `conversations.asked_team`, `answered_by_team` | Questions the agent took to the team (`ask_team`) instead of guessing, and how many came back answered ([Who is asked](https://vatio.ai/docs/handoff#who-is-asked)). |
| `conversations.team_replies` | Replies a person sent as the agent, from the inbox or WhatsApp. |
| `failed_messages` | In the window: messages your backend sent that failed (`outreaches`, listed by the MCP's `list_failed_messages`) and the agent's WhatsApp replies Meta did not deliver. |
| `series` | One row per day of the window, oldest first, zeros included. |

`health` answers 30 calls a minute per key (`429 rate_limited` past that):
read it when the owner opens the dashboard, or cache it for a minute.

## Errors

| Status | Code | Meaning |
|---|---|---|
| 401 | `invalid_key` | The key is missing, invalid or revoked. |
| 403 | `workspace_forbidden` | The key belongs to another workspace. |
| 403 | `insufficient_scope` | The key does not have the `status` scope. |
| 429 | `rate_limited` | More than 30 `health` calls a minute with this key. |
